Discussion:
[Docutils-users] Link bookmark
Sergio
2016-04-18 16:25:16 UTC
Permalink
I would know what is the way to implement in ReST an internal link bookmark
<html>
<body>
<p>This text stand for an example of text containing a
<a name="B3Pa9-5ZRIx-1">bookmarked target</a> bookmark.</p>
<p>So let's go all together to visit the bookmarked target
clicking on <a href="#B3Pa9-5ZRIx-1">this link</a>.</p>
</body>
</html>
The string that is the name of the anchor ("B3Pa9-5ZRIx-1") is produced by
an algorithm and 1) cannot be left away and 2) cannot be seen in the printed
document, just as it was an html bookmark link.

Thanks.


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
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.
Sergio
2016-04-19 08:59:39 UTC
Permalink
Post by Sergio
I would know what is the way to implement in ReST an internal link bookmark
<html>
<body>
<p>This text stand for an example of text containing a
<a name="B3Pa9-5ZRIx-1">bookmarked target</a> bookmark.</p>
<p>So let's go all together to visit the bookmarked target
clicking on <a href="#B3Pa9-5ZRIx-1">this link</a>.</p>
</body>
</html>
The string that is the name of the anchor ("B3Pa9-5ZRIx-1") is produced by
an algorithm and 1) cannot be left away and 2) cannot be seen in the printed
document, just as it was an html bookmark link.
Thanks.
I've tried some experiments looking for a hint:

# file: test.htm

<html>
<body>

<p>This text stand for an example of text containing
a <a name="B3Pa9-5ZRIx-1">bookmarked target</a> bookmark.</p>

<p>So let's go all together to visit the bookmarked target
clicking on <a href="#B3Pa9-5ZRIx-1">this link</a>.</p>

</body>
</html>

First try:

# test.htm converted at http://www.siafoo.net/html.xml

This text stand for an example of text containig a `target <>`_ bookmark.

So let's go all together to visit the target clicking on `this
link <#B3Pa9-5ZRIx-1>`_ .

that is not what I'm looking for;

# pandoc -f html test.htm -s -o test.rst

This text stand for an example of text containig a target bookmark.

So let's go all together to visit the target clicking on `this
link <#B3Pa9-5ZRIx-1>`__.

that is not what I'm looking for;

# html2rst.py taken from
http://docutils.sourceforge.net/sandbox/cliechti/html2rst/html2rst.py
# python html2rst.py test.htm > test.rst

This text stand for an example of text containig a target bookmark.

So let's go all together to visit the target clicking on `this
link`_.

.. _this link: #B3Pa9-5ZRIx-1

Not a good try.

Is there a better way ?



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
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-04-20 08:27:11 UTC
Permalink
Post by Sergio
Post by Sergio
I would know what is the way to implement in ReST an internal link bookmark
# file: test.htm
<html>
<body>
<p>This text stand for an example of text containing
a <a name="B3Pa9-5ZRIx-1">bookmarked target</a> bookmark.</p>
<p>So let's go all together to visit the bookmarked target
clicking on <a href="#B3Pa9-5ZRIx-1">this link</a>.</p>
</body>
</html>
...
Post by Sergio
Is there a better way ?
This depends on what is the important part of your task and what can be
changed to match the way Docutils structures things.

Do you want convert HTML documents to rST or write rST?


AFAI can see, there is no way to have an *inline* anchor with specified but
invisible name or id (except for a raw HTML role).


The following alternatives exist.

This text stand for an example of text containig
a _`target` bookmark. An inline target must be
uniquely named and mapped to the desired
non-visible string in a separate step.

.. _B3Pa9-5ZRIx-1: target_


.. _B3Pa9-5ZRIx-2:

This paragraph is given the
id "b3pa9-5zrix-2" (see name conversions).
From the same document, it can be reached under the given spelling.
From other documents, ist is reaced as ``<filename>#b3pa9-5zrix-2``


So let's go all together to visit the targets clicking on
`this link <B3PA9-5ZRIX-1_>`__
or `this link <B3PA9-5ZRIX-2_>`__.

Alternative syntax: visit the targets clicking on
`this link`__ or `this link`__.

__ B3PA9-5ZRIX-1_
__ B3PA9-5ZRIX-2_


Next alternative: link to of the `tagged paragraph <#b3pa9-5zrix-2>`__ via
its URL.


See also
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#hyperlink-references
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#hyperlink-targets


hope this helps

Günter


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to re

Loading...