Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rst references with one underscore g <www>_ not remembered #5081

Closed
rpuntaie opened this issue Nov 15, 2018 · 1 comment
Closed

rst references with one underscore g <www>_ not remembered #5081

rpuntaie opened this issue Nov 15, 2018 · 1 comment

Comments

@rpuntaie
Copy link

Pandoc 2.4

RST
distinguishes between one underscore and two underscore links.

Pandoc does not.

This works:

    echo "`g <www.google.com>`_. Go to `g`_" > t.txt
    rst2html.py t.txt

But Pandoc reports [WARNING] Reference not found for 'g' at line 1 column 35.

    pandoc -f rst -t html t.txt
@jgm
Copy link
Owner

jgm commented Nov 15, 2018

Test case, for convenience:

Go to `g`_  `g <www.google.com>`_. 

(Note that these can be in either order.)

From the docutils manual, for convenience:

A hyperlink reference may directly embed a target URI or (since Docutils 0.11) a hyperlink reference within angle brackets ("<...>") as follows:

See the `Python home page <http://www.python.org>`_ for info.

This `link <Python home page_>`_ is an alias to the link above.
This is exactly equivalent to:

See the `Python home page`_ for info.

This link_ is an alias to the link above.

.. _Python home page: http://www.python.org
.. _link: `Python home page`_
The bracketed URI must be preceded by whitespace and be the last text before the end string.

With a single trailing underscore, the reference is named and the same target URI may be referred to again. With two trailing underscores, the reference and target are both anonymous, and the target cannot be referred to again. These are "one-off" hyperlinks.

(I see this is docutils 0.11+, which explains why pandoc didn't have it originally.)

This will be tricky to implement, given the current two-pass parsing strategy, since we only pick up references from explicit reference definitions. We may need to change to using the F Monad, as we do in the Markdown reader, to support this properly.

@jgm jgm changed the title g_ reference not found, because rst references with one underscore g <www>_ not remembered rst references with one underscore g <www>_ not remembered Nov 15, 2018
@jgm jgm closed this as completed in e9e1684 Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants