On Tue, Mar 20, 2018 at 12:26 PM, Komiya Takeshi <
i.tk...@gmail.com> wrote:
> Hi Matthias,
>
>>Is there somewhere a list/dict with all the <target> nodes in the
> current document?
>
> All targetable nodes are listed into the nameids attribute of document node.
> This is also an answer for another question.
Thanks a lot, "nameids" (and "ids") was exactly the information I needed!
I ended up using this instead of trying to manipulate the <target> nodes.
This worked much better with my already existing code.
If you are (or someone else on this list is) interested, this is what
I did with your help:
https://github.com/spatialaudio/nbsphinx/pull/173
The idea for this came from a recent posting on this list:
https://groups.google.com/forum/#!topic/sphinx-users/ZoYI_-ZKMDw
You can see the result here:
http://nbsphinx.readthedocs.io/en/local-links/a-normal-rst-file.html
(at some point the URL will change to
http://nbsphinx.readthedocs.io/en/latest/a-normal-rst-file.html)
The links work in Sphinx, but they also work on Github, see
https://github.com/spatialaudio/nbsphinx/blob/7e791655205beebccce65b920d4cf798c8f6d614/doc/a-normal-rst-file.rst
> docutils uses the attribute to resolve reference. So you need to
> register the new target node before resolving.
> To do that, you can use document.note_implicit_target() and
> note_explicit_target().
>
> Note: implicit and explicit target are described here.
>
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#implicit-hyperlink-targets
>
> In addition, Sphinx also uses the attribute to realize cross
> reference. So I suppose note_*_target() API will resolve your case.
>
> For more information, please read the document and source code of
> docutils. I've read it again and again.
Yes, I know, I've read some parts of the docutils documentation over
and over again, but they mostly talk about the behavior and not about
how it is implemented.
I also grep around in the source code a lot, but it's really not that
easy to follow what's happening.
I appreciate your help very much, because I wouldn't be able to find
this information on my own!
cheers,
Matthias