On Sep 7, 12:54 am, Ondrej Certik <ond...@certik.cz> wrote:
> On Fri, Sep 4, 2009 at 2:28 PM, John H Palmieri<jhpalmier...@gmail.com> wrote:
>
> I tried your patch (I made a sphinx extension out of it), but it
> didn't work for me --- the backsubstitution to docstringlines failed
> in the extension (maybe sphinx is inconsistent here), but this can be
> fixed easily by just doing
>
>     docstringlines[:] = [s]

That's strange.  Maybe the issue is that mine is interacting with the
Sphinx autodoc extension, which passes "docstringlines" as an
argument: this is a list of strings, the lines of the doc string that
autodoc has extracted.   You're using "source-read" which passes a
list containing one element, the entire docstring. Maybe you can
change the first line of your code to

   s = source[0]

and then the last line would be

  source[0] = s      or       source = [s]

I couldn't figure out how to use "source-read" for the Sage reference
manual, since "source" in our case is some autogenerated string that
doesn't contain the actual docstring -- you have to interact with
autodoc to get that.

> worse problem is that I want to change it to math:`sd`, not just `sdf`
> (I have not figured it out how to do that using your indices
> approach). In any case, I rewrote it so that it works for me,
> attached.

Oh, I like your approach.  I see that you're not worrying about `$ or
$` in the code, but there are strings like that in the Sage code --
e.g., ``$SAGE_ROOT...`` -- so I had to test for this and not replace
such dollar signs.

> So that's a very convenient solution, as I can ship it with my sphinx
> notes and it will just work. Later on, after I gain more experience,
> I'll ask on the sphinx list, if they want to ship this with sphinx
> itself.

Sounds good.  I'm curious: for your own use, why don't you use

  default_role = 'math'

so you can use `x=y` instead of :math:`x=y` ?  Maybe a better
question, which just occurred to me: is it worth adding some sort of
parameter to your extension so that it replaces $x=y$ by
either :math:`x=y` or `x=y`, depending on that parameter?

  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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to