#17371: The rst contents directive does not work with sagenb (wrong anchors)
----------------------------+------------------------
       Reporter:  tmonteil  |        Owner:
           Type:  defect    |       Status:  new
       Priority:  major     |    Milestone:  sage-6.5
      Component:  notebook  |   Resolution:
       Keywords:            |    Merged in:
        Authors:            |    Reviewers:
Report Upstream:  N/A       |  Work issues:
         Branch:            |       Commit:
   Dependencies:            |     Stopgaps:
----------------------------+------------------------

Comment (by slabbe):

 Bonjour Karl, Thierry,

  - At #13297, I had the 2 years old project of adding tests for cmd line
 rst2txt and rst2sws. If I had done this, it would have prevented the
 second issue raised in this ticket. Thanks for the report, you motivated
 me to add those doctests (I also fixed the script as you suggested). It
 now needs review.

  - I was able to reproduce the table of content problem in three ways from
 the Upload page using three different files : file.rst, file.txt and
 file.sws. The file.rst is below. The file.sws was obtained from {{{sage
 -rst2sws}}}. The {{{file.txt}}} was obtained from {{{sage -rst2txt}}}.

  - The {{{file.rst}}} I used for my test is:

 {{{
 ****
 Tile
 ****

 .. contents:: Table of contents

 First Section
 =============

 ::

     sage: 3+4
     7

 Second Section
 ==============

 ::

     sage: 8
     8
 }}}

  - The output of {{{sage -rst2txt file.rst file.txt}}} (with #13297)
 contains the problem. But the problem seems to really come from docutils.
 Compare {{{href="#first-section"}}} with {{{href="#id1"}}}:

 {{{
 sage: rst = open('file.rst','r').read()
 sage: from docutils.core import publish_string
 sage: html = publish_string(rst, writer_name='html')
 sage: print html
 ...
 <h1 class="title">Tile</h1>

 <div class="contents topic" id="table-of-contents">
 <p class="topic-title first">Table of contents</p>
 <ul class="simple">
 <li><a class="reference internal" href="#first-section" id="id1">First
 Section</a></li>
 <li><a class="reference internal" href="#second-section" id="id2">Second
 Section</a></li>
 </ul>
 </div>
 <div class="section" id="first-section">
 <h1><a class="toc-backref" href="#id1">First Section</a></h1>
 <pre class="literal-block">
 sage: 3+4
 7
 </pre>
 </div>
 <div class="section" id="second-section">
 <h1><a class="toc-backref" href="#id2">Second Section</a></h1>
 <pre class="literal-block">
 ...
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/17371#comment:5>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to