On Mar 1, 8:22 am, tommct <tom.mctav...@gmail.com> wrote:
> I am using Sphinx to document my package. If I place the resulting
> html in my SAGE notebook server, I get a nice, interactive reference,
> but only when each line in my code examples are prefixed with "sage:"
> or ">>>". I would like my chunks of example code to exist in my Python
> modules, simply embedded in the docstrings without the "sage:" or
> ">>>" prefix on each line. Is there a way to tweak Sphinx to
> automatically insert the prefix or is there another alternative?

>From the Sage notebook, type "latex?".  (This comes from the docstring
for the class Latex in sage/misc/latex.py.) The resulting docstring
has an indented code block without any "sage" prompts. Is that what
you want? To get it, format your docstring like this, noting the
double colon:

"""
stuff
stuff
stuff::

   indented code block
   indented code block

more stuff
"""

This will turn the double colon into a colon when you view it.  If you
don't want a colon to appear, put a space before the double colon:

stuff ::

--
John

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to