Skip to content

Commit 2182ec6

Browse files
committed
typst: port Pandoc 3.13 csl-settings template block for citeproc bibliographies
Pandoc 3.12.1 feeds CSL hanging-indent and entry-spacing to the typst template as csl-hanging-indent/csl-entry-spacing and applies them via a show rule on the <refs> label the writer puts on citeproc bibliographies (jgm/pandoc#11926). Quarto's modular typst template lacked the rule, so CSL-mandated hanging indents were silently dropped. Port the block into quarto/definitions.typ (must precede $body$ for the show rule to apply).
1 parent 5831cb0 commit 2182ec6

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎llm-docs/pandoc-quarto-typst-templates.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Combines Pandoc definitions with Quarto-specific functionality:
8888
- `content-to-string` helper to extract text from content nodes (used for PDF metadata and link colors)
8989
- `horizontalrule` definition for horizontal rules
9090
- Term list hanging indent (`#set terms(hanging-indent: 1.5em)`; Pandoc 3.13 dropped its custom `terms.item` show rule)
91+
- CSL citeproc formatting (`#show <refs>: set par(...)` with `csl-hanging-indent` / `csl-entry-spacing` under `$if(csl-settings)$`, from Pandoc 3.12.1's `default.typst`; applies CSL hanging indent and entry spacing to Pandoc-citeproc bibliographies)
9192
- Code highlighting definitions (conditionally included)
9293

9394
**Quarto additions**:

‎src/resources/formats/typst/pandoc/quarto/definitions.typ‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919

2020
#set terms(hanging-indent: 1.5em)
2121

22+
$if(csl-settings)$
23+
// formatting called for by CSL style
24+
#show <refs>: set par(
25+
$if(csl-hanging-indent)$
26+
hanging-indent: $csl-hanging-indent$,
27+
$endif$
28+
$if(csl-entry-spacing)$
29+
spacing: $csl-entry-spacing$,
30+
$endif$
31+
)
32+
33+
$endif$
2234
// Some quarto-specific definitions.
2335

2436
#show raw.where(block: true): set block(

‎tests/docs/smoke-all/typst/typst-citeproc.qmd‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _quarto:
99
tests:
1010
typst:
1111
ensureTypstFileRegexMatches:
12-
- ['<refs>', '<ref-Cronbach_1951>']
12+
- ['<refs>', '<ref-Cronbach_1951>', '\#show <refs>: set par\(', 'hanging-indent: 1.5em']
1313
- ['\#bibliography\([^)]*\)']
1414
ensurePdfRegexMatches:
1515
# Locators appear inline after author-date (citeproc drops "p." prefix)

0 commit comments

Comments
 (0)