-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 28.03.2010 12:11, schrieb Václav Šmilauer:
> By reading writers/latex.py, I found that the cause was referencing
> relative HTML url like yade.wrapper.html#yade.wrapper.Sphere (there
> were warning about unusable reference target which I overlooked).
> 
> I am at loss now as to what is the reference format that will work for
> both HTML and LaTeX...
> 
> For LaTeX, refuri='#targetName', such as #yade.wrapper.Shape, works
> (it is in the same document).
> 
> For HTML, this will not work accross file boundary (it creates
> hyperlink to anchor named #yade.wrapper.Shape in the _current_ HTML
> file, rather than the file that really contains yade.wrapper.Shape
> target). The original form mentioning explicitly html filename works,
> however.

The question is, how do you create that link?  Normal cross-references
in Sphinx are created by inserting a "pending_xref" node while parsing
the document.  In a second step, the pending_xref is then resolved when
all documents are parsed, so that possible reference targets are known.

This second step introduces builder-specific behavior by calling the
selected builder's "get_target_uri" or "get_relative_uri" methods.
This is where HTML and LaTeX builders differ.

See the resolve_xrefs() method of the Environment class in the
sphinx.environment module, and especially the "doctree-resolved"
event that is emitted, in which you can resolve your own references
(if they can't be made using normal pending_xrefs).

cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAku51roACgkQN9GcIYhpnLAdJgCfaii4MXF27CX+i7sxg0mq9cD9
lvoAn3N0sWYjKebI4NzJjIcFimtVVNNE
=uveJ
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" 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/sphinx-dev?hl=en.

Reply via email to