#10637: Implement sage -sws2rst
------------------------------------------------------------+---------------
       Reporter:  nthiery                                   |         Owner:  
jason, mpatel, was                                                            
           Type:  enhancement                               |        Status:  
needs_work                                                                    
       Priority:  major                                     |     Milestone:  
sage-5.3                                                                      
      Component:  notebook                                  |    Resolution:    
                                                                            
       Keywords:  ReST, worksheet                           |   Work issues:  
answer questions, math formatting, lists, maybe absolute paths?               
Report Upstream:  Workaround found; Bug reported upstream.  |     Reviewers:  
Nicolas ThiƩry, Jason Grout, Karl-Dieter Crisman, Jason Bandlow, John Palmieri
        Authors:  Pablo Angulo, Karl-Dieter Crisman         |     Merged in:    
                                                                            
   Dependencies:  #11080, #11459                            |      Stopgaps:    
                                                                            
------------------------------------------------------------+---------------

Comment (by pang):

 Replying to [comment:63 kcrisman]:
 >  * As I suspected, intra-worksheets links are not respected.

 They are now

 >  * The way you replace a span by a `\n` means that sometimes TinyMCE
 stuff left over from trying to unformat things gets in a new line.
 TinyMCE is annoying that way - sometimes to unitalicize you have to do a
 few things.  Anyway, users will have to expect lots of newlines because of
 that.  In one case, I ''intentionally'' had used a lot of different ones,
 and since bold isn't a span, but everything else you can do is, the doc
 looked kind of weird, lots of new lines.  In another case, the text was
 colored on purpose.
 > {{{
 > Plot a green <span style="color: #008000;">$y=\sin(x)$</span> together
 with...
 > }}}
 >    and then it made a new line there.  I'm wondering why you chose to
 make {{{\n}}} instead of just a space - surely you encountered some "real-
 life" examples where that was the better option.  I'm assuming we can't
 easily take the color info in, if that's the only info.

 I don't really remember why I did that, but it also screwed html tables in
 some situations, so it's best, and more naturally, made into a space.

 >  * I think one might need a few other new lines in other places.



 >  * Here's an even worse example of math not behaving right.
 > {{{
 > <ul>
 > <li>For instance, it isn't too hard to add things like
 $$\zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^s}=\prod_p
 \left(\frac{1}{1-p^{-s}}\right)\; .$$&nbsp;</li>
 > <li>One just types things
 like&nbsp;"\$\$\zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^s}=\prod_p
 \left(\frac{1}{1-p^{-s}}\right)\$\$" in the word processor. &nbsp;</li>
 > <li>Whether this shows up as nicely as possible depends on what fonts
 you have in your browser, but it should be legible. &nbsp;</li>
 > <li>More realistically, we might type "\$f(x)=x^2\$" so that we remember
 that $f(x)=x^2$ in this worksheet.</li>
 > </ul>
 > }}}
 >    became all math mode, because the indentation
 > {{{
 >   - For instance, it isn't too hard to add things like
 > .. MATH::
 >
 >     \zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^s}=\prod_p
 \left(\frac{1}{1-p^{-s}}\right)\; .
 >
 >
 >
 >   - One just types things like
 "\$\$\zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^s}=\prod_p
 \left(\frac{1}{1\-p^{\-s}}\right)\$\$$
 >
 >   - Whether this shows up as nicely as possible depends on what fonts
 you have in your browser, but it should be legible.
 >
 > }}}
 >    all was interpreted as being part of the math block!  Instead, the
 math block should have been inside the list, I guess?

 That was solved by unindenting the list items one place, as proposed in
 other place. Would not work if you have display math inside a nested list.
 A solution was to place comments ".. end of MATH" after any display math
 environment. I could do the same with lists and any other indentation-
 dependent environment.


 >  * This is just amusing.
 > {{{
 > arrow $\mapsto$ as "|--&gt;").
 > }}}
 >    becomes the same thing, so it doesn't turn back into {{{|-->}}}, the
 arrow!  Not sure what to do about that; why didn't the greater than sign
 just become a greater than sign when translated from html back?    Also, I
 thought that {{{|}}} was one of the characters you escaped, but maybe this
 one escaped being escaped?

 Solved: now I replace those chars outside of LaTex as many times as
 needed.

 >  * Dumb question; is there a way to have an empty cell?  Currently you
 remove them, but if the input ''and'' output are empty, then maybe it's
 supposed to be an empty cell in the "live" documentation... that's
 obviously very low priority.

 forgot that one too

 >  * Hyperlinks (to other sites, which do work) add an extra space on
 either side.  That looks ok if there isn't punctuation, but if there is,
 it looks weird.
 > {{{
 > the  `Sage website <http://www.sagemath.org/help.html>`_ , which
 > }}}
 >    Note the space before the comma, which shows up in the built doc as
 well.

 fixed


 >  * I found one thing that doesn't show up properly because of the html
 blocks being removed - documentation!  If one evaluates a cell like
 {{{binomial??}}} then that is all html, and just disappears.  Maybe just
 making it plain text?  I'm not sure either, you are right about that being
 a pain in the neck to do anything intelligent with.

 Regarding docstring like in binomial??, how about we change the sage code
 that turns the doctring into html and displays the result, so that it also
 leaves a comment with the plain rst? The we could simply catch the
 comment...


 >  * There isn't much you can do about this, but since "the order enforced
 will be the order as encountered" with section heading markup, one can
 pretty easily get a lot of {{{SEVERE: Title level inconsistent:}}}
 warnings.  This is because we have a WYSIWYG editor which doesn't remember
 state between cells.

 The use case that I find more likely is a worksheet with no heading at
 all. I could catch those ones and use the file name as a title: what do
 you think?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10637#comment:74>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to