diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-04-07 08:23:32 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-04-07 08:24:47 -0700 |
| commit | e89a3edf24a025d5bb0fe8c4c7a8e6e0208fa846 (patch) | |
| tree | c495c5f15094583ee3900fd37838649a3167dc29 | |
| parent | 483bfa4b7fad2e9f8f7ae9c8227255bf462a5851 (diff) | |
Typst writer: omit bibliography if `citations` not enabled.
With this change, the typst writer will omit the `#bibliography`
command when `citations` is not enabled. (If you want to use
pandoc's own `--citeproc`, you should combine it with
`-t typst-citations` to disable native typst citations.
Closes #8763.
| -rw-r--r-- | data/templates/default.typst | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Typst.hs | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/data/templates/default.typst b/data/templates/default.typst index c04b5e40f..94a9c88fb 100644 --- a/data/templates/default.typst +++ b/data/templates/default.typst @@ -92,6 +92,7 @@ $if(notes)$ $notes$ ] $endif$ +$if(citations)$ $if(bibliographystyle)$ #set bibliography(style: "$bibliographystyle$") @@ -100,6 +101,7 @@ $for(bibliography)$ #bibliography("$bibliography$") $endfor$ +$endif$ $for(include-after)$ $include-after$ diff --git a/src/Text/Pandoc/Writers/Typst.hs b/src/Text/Pandoc/Writers/Typst.hs index b290506a8..a3267f911 100644 --- a/src/Text/Pandoc/Writers/Typst.hs +++ b/src/Text/Pandoc/Writers/Typst.hs @@ -78,6 +78,9 @@ pandocToTypst options (Pandoc meta blocks) = do let context = defField "body" main $ defField "notes" notes $ defField "toc" (writerTableOfContents options) + $ (if isEnabled Ext_citations options + then defField "citations" True + else id) $ (case lookupMetaString "lang" meta of "" -> id lang -> |
