mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-30 17:59:17 +08:00
Citeproc: put bibliography in a div with id .*__refs
as well as `refs`. Reason: when `--file-scope` is used, a Div with id `refs` gets a prefix attached, derived from the filename. The prefix ends in `__`. Closes #11072.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user