Skip to content

Commit

Permalink
Typst writer: omit bibliography if citations not enabled.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jgm committed Apr 7, 2023
1 parent 483bfa4 commit e89a3ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions data/templates/default.typst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ $if(notes)$
$notes$
]
$endif$
$if(citations)$
$if(bibliographystyle)$

#set bibliography(style: "$bibliographystyle$")
Expand All @@ -100,6 +101,7 @@ $for(bibliography)$

#bibliography("$bibliography$")
$endfor$
$endif$
$for(include-after)$

$include-after$
Expand Down
3 changes: 3 additions & 0 deletions src/Text/Pandoc/Writers/Typst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down

0 comments on commit e89a3ed

Please sign in to comment.