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

Footnotes that share the same ID are duplicated #3690

Closed
Nadreck opened this issue Jun 24, 2020 · 5 comments · Fixed by #3691
Closed

Footnotes that share the same ID are duplicated #3690

Nadreck opened this issue Jun 24, 2020 · 5 comments · Fixed by #3691
Assignees
Labels
bug compliance v2.0.11 Issues resolved in the 2.0.11 release
Milestone

Comments

@Nadreck
Copy link
Contributor

Nadreck commented Jun 24, 2020

According to Externalizing a Footnote, you should be able to create a footnote as an attribute, and then call the attribute to be able to reuse a footnote:

This approach works since attribute references are expanded before footnotes are parsed. The redundant text in the second disclaimer footnote is simply ignored.

However, this does not appear to be working. Using the text from the docs example:

:fn-hail-and-rainbow: footnote:[The double hail-and-rainbow level makes my toes tingle.]
:fn-disclaimer: footnote:disclaimer[Opinions are my own.]

The hail-and-rainbow protocol can be initiated at five levels:
double, tertiary, supernumerary, supermassive, and apocalyptic party.{fn-hail-and-rainbow}
A bold statement!{fn-disclaimer}

Another outrageous statement.{fn-disclaimer}

The result I get has the first use of fn-disclaimer as footnote 2, and the second use as footnote 3:

  1. The double hail-and-rainbow level makes my toes tingle.
  2. Opinions are my own.
  3. Opinions are my own.

I feel like this used to work. I've tried this in Antora, and also Asciidoctor.js, using the latest LTS for node and npm (12.18.1 and 6.14.5, respectively).

@mojavelinux mojavelinux transferred this issue from asciidoctor/asciidoctor.js Jun 25, 2020
@mojavelinux
Copy link
Member

I have tried this example in all versions of Asciidoctor and it doesn't work in any version. However, a case could be made that if the ID is specified, and a footnote is already registered with that ID, the parser should not create another footnote (effectively ignoring the text in the second instance, regardless of whether it's the same). So let's address this as a bug.

@mojavelinux mojavelinux added this to the v2.0.x milestone Jun 25, 2020
@mojavelinux mojavelinux changed the title Externalized footnotes are duplicated Externalized footnotes that share the same ID are duplicated Jun 25, 2020
@mojavelinux mojavelinux changed the title Externalized footnotes that share the same ID are duplicated Footnotes that share the same ID are duplicated Jun 25, 2020
@mojavelinux
Copy link
Member

For the record, this has nothing to do with externalizing the footnote (though it's easy to reproduce that way).

@mojavelinux mojavelinux self-assigned this Jun 25, 2020
mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Jun 25, 2020
@mojavelinux mojavelinux added compliance v2.0.11 Issues resolved in the 2.0.11 release labels Jun 25, 2020
@dflock
Copy link

dflock commented Feb 15, 2021

This still happens if you don't give the footnote an explicit id. If you change footnote:disclaimer to footnote:, like this:

:fn-hail-and-rainbow: footnote:[The double hail-and-rainbow level makes my toes tingle.]
:fn-disclaimer: footnote:[Opinions are my own.]

The hail-and-rainbow protocol can be initiated at five levels:
double, tertiary, supernumerary, supermassive, and apocalyptic party.{fn-hail-and-rainbow}
A bold statement!{fn-disclaimer}

Another outrageous statement.{fn-disclaimer}

You get this:

image

Using 2.0.12:

asciidoctor --version
Asciidoctor 2.0.12 [https://asciidoctor.org]
Runtime Environment (ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

@elextr
Copy link

elextr commented Feb 15, 2021

The disclaimer ID is what tells Asciidoctor that these two reference the same footnote. When a footnote does not have an ID its considered a different footnote, doesn't matter if the text is the same.

@mojavelinux
Copy link
Member

Yep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug compliance v2.0.11 Issues resolved in the 2.0.11 release
Projects
None yet
4 participants