-
Notifications
You must be signed in to change notification settings - Fork 335
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
Citation order within brackets affects citation grouping #11971
Comments
Without testing, I would say, this is likely on my extension/me. To be sure, only the first line is not expected, right? |
If you shorten the IDs of the references ...
That's very weird, it's not really about the length but it is ... Here is a fully self-contained example: ---
title: "Bug demo"
format: html
references:
- id: soto-perez-crispr-cas-2019
type: article-journal
title: "Article 1a"
author:
- "John Doe"
- "Jane Doe"
issued: 2019
- id: soto-perez-crispr-cas-201
type: article-journal
title: "Article 1b"
author:
- "John Doe"
- "Jane Doe"
issued: 2019
- id: soto-perezH-crispr-cas-2019
type: article-journal
title: "Article 1c"
author:
- "John Doe"
- "Jane Doe"
issued: 2019
- id: gregory_2020
type: article-journal
title: "Article 2"
author: "John Doe"
issued: 2020
- id: nayfach_2021
type: article-journal
title: "Article 3"
author: "Jane Doe"
issued: 2021
---
- Issue
[(Figures 1A and S1A, Table S1)]{} [@soto-perez-crispr-cas-2019; @gregory_2020; @nayfach_2021].
- No span before the citation
(Figures 1A and S1A, Table S1) [@soto-perez-crispr-cas-2019; @gregory_2020; @nayfach_2021].
- Id a bit shorter
[(Figures 1A and S1A, Table S1)]{} [@soto-perez-crispr-cas-201; @gregory_2020; @nayfach_2021].
- extra space before semi-colon
[(Figures 1A and S1A, Table S1)]{} [@soto-perez-crispr-cas-2019 ; @gregory_2020; @nayfach_2021].
- One extra character in the id
[(Figures 1A and S1A, Table S1)]{} [@soto-perezH-crispr-cas-2019; @gregory_2020; @nayfach_2021].
|
To me, that's a parsing issue somewhere:
will produce the expected output. Note the extra space Indeed Figures/Tables seems to trigger some feature somewhere when inside |
The issue is not the output, it's before that, use |
This is quite a puzzling issue but I believe this is related to Pandoc parsing. I can reproduce using this simple doc (with this bib file https://raw.githubusercontent.com/apcamargo/quarto-citations-bug/refs/heads/main/references.bib) ---
title: "Bug demo"
bibliography: "references.bib"
---
[(xxxxxxxxxxxxxxxxxxxxxxxxxxxx)]{key=value} [@soto_perez_crispr_cas_2019; @gregory_gut_2020].
See the brackets Now remove on No more brackets and correct parenthesis ---
title: "Bug demo"
bibliography: "references.bib"
---
[(xxxxxxxxxxxxxxxxxxxxxxxxxxx)]{key=value} [@soto_perez_crispr_cas_2019; @gregory_gut_2020].
So this is something to understand and open on pandoc side. |
There is definitely a difference in native representation diff --git "a/.\\test2.native" "b/.\\test.native"
index 6087bf1..04ce27f 100644
--- "a/.\\test2.native"
+++ "b/.\\test.native"
@@ -1,48 +1,43 @@
[ Para
[ Span
( "" , [] , [ ( "key" , "value" ) ] )
- [ Str "(xxxxxxxxxxxxxxxxxxxxxxxxxxxx)" ]
+ [ Str "(xxxxxxxxxxxxxxxxxxxxxxxxxxx)" ]
, Space
- , Str "["
, Cite
[ Citation
{ citationId = "soto_perez_crispr_cas_2019"
, citationPrefix = []
, citationSuffix = []
- , citationMode = AuthorInText
+ , citationMode = NormalCitation
, citationNoteNum = 1
, citationHash = 0
}
- ]
- [ Str "Soto-Perez"
- , Space
- , Str "et"
- , Space
- , Str "al."
- , Space
- , Str "(2019)"
- ]
- , Str ";"
- , Space
- , Cite
- [ Citation
+ , Citation
{ citationId = "gregory_gut_2020"
, citationPrefix = []
, citationSuffix = []
- , citationMode = AuthorInText
- , citationNoteNum = 2
+ , citationMode = NormalCitation
+ , citationNoteNum = 1
, citationHash = 0
}
]
- [ Str "Gregory"
+ [ Str "(Soto-Perez"
+ , Space
+ , Str "et"
+ , Space
+ , Str "al."
+ , Space
+ , Str "2019;"
+ , Space
+ , Str "Gregory"
, Space
, Str "et"
, Space
, Str "al."
, Space
- , Str "(2020)"
+ , Str "2020)"
]
- , Str "]."
+ , Str "."
]
, Div
( "refs" So definitely something in the pandoc parser 🤔 |
Adding space after This gives expected output: ---
title: "Bug demo"
bibliography: "references.bib"
---
[ (xxxxxxxxxxxxxxxxxxxxxxxxxxxx) ]{key=value} [@soto_perez_crispr_cas_2019; @gregory_gut_2020]. |
More minimal reprex ---
title: "Bug demo"
references:
- author: Jane
id: soto_perez_crispr_cas_2019
issued: 2019-09
title: Title 1
type: article-journal
- author: John
id: gregory_gut_2020
issued: 2020-11
title: Title 2
type: article-journal
---
[(xxxxxxxxxxxxxxxxxxxxxxxxxxxx)]{key=value} [@soto_perez_crispr_cas_2019; @gregory_gut_2020].
Using
This is recommended in the doc https://pandoc.org/MANUAL.html#extension-citations
@apcamargo you could try adding those curly braces in your project to see if this helps. |
I wasn't sure if the ids were related, so I reduced again. This reproduce ---
title: "Bug demo"
references:
- author: Jane
id: aaaaaaaaaaaaaaaaaaaaaaaaaa
issued: 2019-09
title: Title 1
type: article-journal
- author: John
id: id2
issued: 2020-11
title: Title 2
type: article-journal
---
[(xxxxxxxxxxxxxxxxxxxxxxxxxxxx)]{key=value} [@aaaaaaaaaaaaaaaaaaaaaaaaaa; @id2].
Adding ---
title: "Bug demo"
references:
- author: Jane
id: aaaaaaaaaaaaaaaaaaaaaaaaa
issued: 2019-09
title: Title 1
type: article-journal
- author: John
id: id2
issued: 2020-11
title: Title 2
type: article-journal
---
[(xxxxxxxxxxxxxxxxxxxxxxxxxxxx)]{key=value} [@{aaaaaaaaaaaaaaaaaaaaaaaaa} ; @id2]. I think we need to look into the Haskell code in Pandoc now to understand what could be the problem here |
This is reported to Pandoc - we'll see. Thanks for the report here @apcamargo ! |
Bug description
This issue is triggered under very specific conditions. I tried to reduce the problem as much as possible, and a reproducible example is available in this repository: https://github.com/apcamargo/quarto-citations-bug
In certain cases, multiple citations within square brackets fail to group correctly in the resulting HTML (see the first line of the screenshot below). Through testing, I identified that this issue is triggered, in this specific example, when the following conditions are met:
quarto-highlight-text
.()
.Figures
is used instead ofFigure
.[@soto_perez_crispr_cas_2019; @gregory_gut_2020; @nayfach_metagenomic_2021]
or[@soto_perez_crispr_cas_2019; @nayfach_metagenomic_2021; @gregory_gut_2020]
.Steps to reproduce
Expected behavior
Citations within square brackets should be grouped regardless of the order of the citations or the text preceding the opening of the brackets.
Actual behavior
The text preceding the citations as well as the order of citations within the square brackets can prevent citations from being grouped.
Your environment
Quarto check output
The text was updated successfully, but these errors were encountered: