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

Incorrect parsing of reST hyperlink targets #262

Closed
jgm opened this issue Jun 10, 2011 · 5 comments
Closed

Incorrect parsing of reST hyperlink targets #262

jgm opened this issue Jun 10, 2011 · 5 comments

Comments

@jgm
Copy link
Owner

jgm commented Jun 10, 2011

From googlecode Issue #6
Reported by project member fiddlosopher, Feb 11, 2007

RST allows "internal" hyperlink targets that refer to the next element.
They can also be "chained." Pandoc's parser doesn't handle either case
correctly. See
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#hyperlink-targets

What steps will reproduce the problem?

  1. Run pandoc on the following input:
`hello`_

.. _hello:

paragraph

Expected output: "hello" should link to the paragraph "paragraph", which
should get id="hello".

  1. Run pandoc on the following input:
`hello`_ and `goodbye`_

.. _hello:
.. _goodbye: foo.bar.com

Expected output: Both "hello" and "goodbye" should be links to foo.bar.com.

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

Implementing this would require the ability to put attributes (at least an id) on arbitrary block elements.

@mpickering
Copy link
Collaborator

I think this could now be implemented without too much effort.

@jgm jgm added this to the pandoc 2.0 milestone Mar 11, 2017
jgm added a commit that referenced this issue Jun 27, 2017
For example,

    .. _hello:
    .. _goodbye: example.com

Here both `hello` and `goodbye` should link to `example.com`.

Fixes the first part of #262.
@jgm
Copy link
Owner Author

jgm commented Jun 27, 2017

To fix the second part of this, we'll need to rewrite the RST reader using the F monad, instead of the current two-phase parse. Otherwise we can't parse

`hello`_

.. _hello:

paragraph

properly, since this requires (a) adding a div around paragraph, which we can't do in the initial parsing phase, and (b) adding something to the table of stateKeys, which we can only do in the initial parsing phase.

@jgm
Copy link
Owner Author

jgm commented Jun 27, 2017

Scrap that, I figured out a way to do it.

@jgm jgm closed this as completed in 33a29fb Jun 27, 2017
@jgm
Copy link
Owner Author

jgm commented Jun 27, 2017

Feels good to close a bug that has been open 10 years!

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