diff options
| -rw-r--r-- | changelog.md | 7 | ||||
| -rw-r--r-- | src/Text/Pandoc/Citeproc.hs | 18 |
2 files changed, 18 insertions, 7 deletions
diff --git a/changelog.md b/changelog.md index cff9f2903..870f2aaad 100644 --- a/changelog.md +++ b/changelog.md @@ -286,6 +286,13 @@ * Text.Pandoc.Citeproc: + Don't move footnotes around em-dashes (#11046). + + Allow `--citeproc` to put the bibliography in a Div with id `refs` + even when `--file-scope` is used (#11072). When `--file-scope` + is used, a prefix will be added based on the filename, so the Div + will end up having an identifier like `myfile.md__refs`. + Previously, this prevented the bibliography from being added to + the marked Div. Now pandoc will add the bibliography to any Div + with the id `refs` or any id ending in `__refs`. * Text.Pandoc.Citeproc.BibTeX: Protect case in periodical titles (#11048). Thus, for example, `{npj} Quantum Information` should translate as diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs index 199eb9d48..f10761136 100644 --- a/src/Text/Pandoc/Citeproc.hs +++ b/src/Text/Pandoc/Citeproc.hs @@ -485,7 +485,10 @@ isYesValue _ = False -- if document contains a Div with id="refs", insert -- references as its contents. Otherwise, insert references --- at the end of the document in a Div with id="refs" +-- at the end of the document in a Div with id="refs" or +-- id=".*__refs" (where .* stands for any string -- this is +-- because --file-scope will add such a prefix based on the filename, +-- see #11072.) insertRefs :: [(Text,Text)] -> [Text] -> [Block] -> Pandoc -> Pandoc insertRefs _ _ [] d = d insertRefs refkvs refclasses refs (Pandoc meta bs) = @@ -510,12 +513,13 @@ insertRefs refkvs refclasses refs (Pandoc meta bs) = refDiv = Div ("refs", refclasses, refkvs) refs addUnNumbered cs = "unnumbered" : [c | c <- cs, c /= "unnumbered"] go :: Block -> State Bool Block - go (Div ("refs",cs,kvs) xs) = do - put True - -- refHeader isn't used if you have an explicit references div - let cs' = nubOrd $ cs ++ refclasses - let kvs' = nubOrd $ kvs ++ refkvs - return $ Div ("refs",cs',kvs') (xs ++ refs) + go (Div (ident,cs,kvs) xs) + | ident == "refs" || "__refs" `T.isSuffixOf` ident = do + put True + -- refHeader isn't used if you have an explicit references div + let cs' = nubOrd $ cs ++ refclasses + let kvs' = nubOrd $ kvs ++ refkvs + return $ Div (ident,cs',kvs') (xs ++ refs) go x = return x refTitle :: Meta -> Maybe [Inline] |
