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

bug: asciidoc export: literal "]" interrupts footnote. #6424

Closed
Will47 opened this issue Jun 4, 2020 · 2 comments
Closed

bug: asciidoc export: literal "]" interrupts footnote. #6424

Will47 opened this issue Jun 4, 2020 · 2 comments

Comments

@Will47
Copy link

Will47 commented Jun 4, 2020

If a footnote text includes right brackets - ] - the first one will match with the "footnote:[" markup of asciidoc, provoking an early interruption of the footnote, and pushing back the end of the footnote text in the main text.

Example, using test.docx, and running:
pandoc -f docx -t asciidoc test.docx
produces the following output:
textfootnote:[[…] footnote]

Escaping the inner right brackets should fix the issue (cf. asciidoctor/asciidoctor#2495 (comment)), producing this output instead:
textfootnote:[[…\] footnote]

I used Pandoc v2.5 for the test, but it should still apply to the latest version from my understanding of the AsciiDoc writer code.

@jgm
Copy link
Owner

jgm commented Jun 8, 2020

The big question is whether we can get away with just always escaping literal bracket characters.

@Will47
Copy link
Author

Will47 commented Jun 8, 2020

Escaping ] is only required inside macros, cf. https://asciidoc.org/userguide.html#_macros:

  • <attrlist> is a list of attributes enclosed in square brackets.
  • ] characters inside attribute lists must be escaped with a backslash.

Outside of macros, ] has no particular meaning and \] will be rendered as \]. So if that's what you mean by always, I'm afraid you won't get away with that.

AsciiDoctor seems a bit more generic but aligned nevertheless on AsciiDoc on this particular issue, cf. https://asciidoctor.org/docs/user-manual/#attribute-list-substitutions:

If the attribute value contains the same quote character being used to enclose the value, escape the quote character in the value by prefixing it with a backslash (e.g., title="\"Dark Horse\" is a song by George Harrison").

@jgm jgm closed this as completed in a14d843 Dec 29, 2024
jgm added a commit that referenced this issue Dec 29, 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

3 participants