On Sep 3, 5:54 pm, Jason Grout <jason-s...@creativetrax.com> wrote:
> John H Palmieri wrote:
> > On Sep 3, 12:37 pm, "William A. Stein" <wst...@gmail.com> wrote:
> >> On Sep 3, 2009, at 12:28 PM, Ondrej Certik wrote:
>
> >>> So how about submitting a patch to sphinx  
> >>> fixing it?
> >>> Ondrej
> >> That's a good idea.  It would certainly be better than having to  
> >> change Sage -- it would keep things "pure", but allow $'s, and even  
> >> benefit you.  Great idea.   It's hard to argue with that.
>
> > Well, dollar signs are mentioned (briefly) in the Sphinx
> > documentation, in the part about writing extensions.  So we could
> > write an extension for Sphinx which replaces "$" with "`", or
> > optionally replaces "$blah$" with ":math:`blah`".  I don't want to
> > make it too fancy, so it ought to be a pretty simple regular
> > expression search and replace.  How does that sound?
>
> > More precisely: we can have a Sphinx extension with a configurable
> > option; set one way, it will replace "$blah$" with "`blah`" (and
> > replace "\$" with "$").  Set the other way, it will replace "$blah$"
> > with ":math:`blah`" (and replace "\$" with "$").
>
> > What else should we do?  Do we have to deal with "$$ blah $$"?  "\
> > [ blah \]"?  I don't want this to be too involved, or we'll end up
> > writing a LaTeX compiler.
>
> Would it be too hard to make a more general (and useful)
> "custom-delimiter" extension, that would allow a person to specify a
> right and left delimiter that is just textually replaced with the mode
> of their choice?  Our configuration would look something like:
>
> right_delimiter='$'
> left_delimiter='$'
> mode=math

Since writing my previous message, I realized that it's easier to not
write our own extension but instead to work with Sphinx's autodoc
extension.  The autodoc extension is what extracts the docstrings to
create the reference manual, and it can be configured to pass the
docstrings to user-defined functions for preprocessing.  I think
that's the right thing for us to do: search for "$" and replace it
with "`".

So while I think that we could make custom delimiters work, the whole
thing won't be a stand-alone extension, so this approach may not be
that useful.  But I'll try to play with it.

  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