Discussion:
[Docutils-users] rst2html: TOC with custom links?
Oleksandr Gavenko
2016-02-15 23:34:28 UTC
Permalink
With text:

Section level 1
===============

.. _sec-xxx:

This is a paragraph.

I expect that TOC points to book.html#sec-xxx, but instead it refer to
book.html#section-level-1:

<a class="reference internal" href="#section-level-1" id="id9">Section level 1</a>
...
<a class="toc-backref" href="#id9">Section level 1</a>
<p id="sec-xxx">This is a paragraph.</p>

I use Cyrillic RST texts and ``rst2html`` doesn't generate meaningful hashes
as "section-level-1" is.

Also for long running documents I would prefer to assign fixed links that
doesn't depends on changes in section title.
--
http://defun.work/


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Guenter Milde
2016-02-16 11:29:39 UTC
Permalink
Post by Oleksandr Gavenko
I expect that TOC points to book.html#sec-xxx, but instead it refer to
The manually set anchor/target/id is always applied to the *following*
element. If you write::

.. contents::

.. _sec-xxx:

Section level 1
===============

.. _par-xxx:

This is a paragraph.


you will get a section heading that can be linked to with both names:


...
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="simple">
<li><a class="reference internal" href="#section-level-1" id="id1">Section level 1</a></li>
</ul>
</div>
<div class="section" id="section-level-1">
<span id="sec-xxx"></span><h1><a class="toc-backref" href="#id1">Section level 1</a></h1>
<p id="par-xxx">This is a paragraph.</p>
</div>
</div>
...
Post by Oleksandr Gavenko
I use Cyrillic RST texts and ``rst2html`` doesn't generate meaningful hashes
as "section-level-1" is.
There is a TODO item to use a latin transliteration for non-ASCII
characters...


Günter


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply

Loading...