Closed gordonwoodhull closed 7 months ago
I'll have a look at this.
This is a Pandoc 3.1.12 change - the intermediates .md gives
Hello #cite(<Cronbach_1951>, form: "prose")
Hello @Cronbach_1951@Cronbach_1952
where we see the second line treating the double citations is not correct.
With 3.1.11.1 we get
Hello #cite(<Cronbach_1951>)
Hello #cite(<Cronbach_1951>);#cite(<Cronbach_1952>)
I'll see if this is a bug in Pandoc or if support has changed for this syntax.
I think this is a pandoc issue, so I'll report to them.
3.1.13
❯ echo "[@Cronbach_1951; @Cronbach_1952]" | pandoc.exe --to typst
@Cronbach_1951@Cronbach_1952
3.1.12
❯ echo "[@Cronbach_1951; @Cronbach_1952]" | pandoc.exe --to typst
@Cronbach_1951@Cronbach_1952
3.1.11.1
❯ echo "[@Cronbach_1951; @Cronbach_1952]" | pandoc.exe --to typst
#cite(<Cronbach_1951>);#cite(<Cronbach_1952>)
The extensions +citations
should apply and typst writer should correct handle the multiple item case.
https://pandoc.org/MANUAL.html#extension-citations
Oh I was wrong... It changes for good reason because Typst supports @
syntax. Sorry I missed that the code you shared was ours... 🤦♂️
https://github.com/quarto-dev/quarto-cli/blob/b24caa36965240404d0bffcaca3b2235ebae45a3/src/resources/formats/typst/pandoc/quarto/definitions.typ#L102-L107
So we need to adapt to our template. I took this by the wrong side. sorry... 😓
Thanks @cderv! Good to know!
It's not a new feature, right? Pandoc is just emitting more terse/idiomatic Typst for this case?
Oh, I think there is a simple, obvious solution here. Will file PR.
The easy fix here is to move the target
definition.
diff --git a/tests/docs/smoke-all/2023/12/04/7784/subdir/index.typ b/tests/docs/smoke-all/2023/12/04/7784/subdir/index.typ
index 21eed240f..64e239c47 100644
--- a/tests/docs/smoke-all/2023/12/04/7784/subdir/index.typ
+++ b/tests/docs/smoke-all/2023/12/04/7784/subdir/index.typ
@@ -97,7 +97,6 @@
}
#show ref: it => locate(loc => {
- let target = query(it.target, loc).first()
if it.at("supplement", default: none) == none {
it
return
@@ -105,6 +104,7 @@
let sup = it.supplement.text.matches(regex("^45127368-afa1-446a-820f-fc64c546b2c5%(.*)")).at(0, default: none)
if sup != none {
+ let target = query(it.target, loc).first()
let parent_id = sup.captures.first()
let parent_figure = query(label(parent_id), loc).first()
let parent_location = parent_figure.location()
This is useful only for our own custom ref. this will solve this failure, but we should test the rest.
What I noticed is that locate()
behavior is changing in Typst 0.11 and I think we need to adapt as it won't take a closure anymore in the future, following the introduction of Context
In Typst 0.10 and lower, the locate function took a closure that made the current location in the document available (like here does now). Compatibility with the old way will remain for a while to give package authors time to upgrade. To that effect, locate detects whether it received a selector or a user-defined function and adjusts its semantics accordingly. This behaviour will be removed in the future.
Also related to our usage of query
which assumes Context
The query functions lets you search your document for elements of a particular type or with a particular label. To use it, you first need to ensure that context is available.
Even simpler solution than the one I came up with. Will file PR.
Let's look into ramifications of these changes soon.
Bug description
Posting as an issue because this is a little too involved for Slack. I have only scratched the surface, don't know much about citeproc, and have not diagnosed whether this is a Quarto or Pandoc bug.
Hoping that someone else recognizes this problem.
Running against latest Pandoc 3.1.12.3 we have one failure in
docs/smoke-all/typst/typst-no-citeproc.qmd
https://github.com/quarto-dev/quarto-cli/actions/runs/8591298602/job/23539917424#step:26:862
This
query()
returns no results:The markdown that triggers the bug is
I.e. this double citation crashes but the single citation above it is okay.
Steps to reproduce
Set pandoc version to 3.1.12.3 and run the tests
Expected behavior
Test should pass and line should produce two linked citations in parentheses.
Actual behavior
Test failure quoted above.
Your environment
Quarto check output