summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-11-02 11:03:16 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2023-11-02 11:03:54 -0700
commitdb92f61f1e29f7da63016e2f86400097bafdb214 (patch)
treea4f27928dd26eb2ff03faa27ae10a7dc24c243bb /src/Text
parentd3d0406515cb6aae6f43e60dfa37014bdd91e79c (diff)
Citeproc: don't link citations if `suppress-bibliography` specified.
For there will be nothing to link to. Closes #9163.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Citeproc.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs
index e38239763..b590acc3f 100644
--- a/src/Text/Pandoc/Citeproc.hs
+++ b/src/Text/Pandoc/Citeproc.hs
@@ -76,7 +76,9 @@ processCitations (Pandoc meta bs) = do
let citations = getCitations locale otherIdsMap $ Pandoc meta' bs
- let linkCites = maybe False truish $ lookupMeta "link-citations" meta
+ let linkCites = maybe False truish (lookupMeta "link-citations" meta) &&
+ -- don't link citations if no bibliography to link to:
+ not (maybe False truish (lookupMeta "suppress-bibliography" meta))
let linkBib = maybe True truish $ lookupMeta "link-bibliography" meta
let opts = defaultCiteprocOptions{ linkCitations = linkCites
, linkBibliography = linkBib }
@@ -479,9 +481,9 @@ isYesValue _ = False
insertRefs :: [(Text,Text)] -> [Text] -> [Block] -> Pandoc -> Pandoc
insertRefs _ _ [] d = d
insertRefs refkvs refclasses refs (Pandoc meta bs) =
- if isRefRemove meta
- then Pandoc meta bs
- else case runState (walkM go (Pandoc meta bs)) False of
+ case lookupMeta "suppress-bibliography" meta of
+ Just x | truish x -> Pandoc meta bs
+ _ -> case runState (walkM go (Pandoc meta bs)) False of
(d', True) -> d'
(Pandoc meta' bs', False)
-> Pandoc meta' $
@@ -517,10 +519,6 @@ refTitle meta =
Just (MetaBlocks [Para ils]) -> Just ils
_ -> Nothing
-isRefRemove :: Meta -> Bool
-isRefRemove meta =
- maybe False truish $ lookupMeta "suppress-bibliography" meta
-
legacyDateRanges :: Reference Inlines -> Reference Inlines
legacyDateRanges ref =
ref{ referenceVariables = M.map go $ referenceVariables ref }