Handle 'nocite' better with --biblatex and --natbib.
Previously the nocite metadata field was ignored with these formats. Now it populates a `nocite-ids` template variable and causes a `\nocite` command to be issued. Closes #4585.
This commit is contained in:
parent
c55a73b642
commit
3622097da3
2 changed files with 13 additions and 2 deletions
|
@ -372,6 +372,9 @@ $for(bibliography)$
|
||||||
\addbibresource{$bibliography$}
|
\addbibresource{$bibliography$}
|
||||||
$endfor$
|
$endfor$
|
||||||
$endif$
|
$endif$
|
||||||
|
$if(nocite-ids)$
|
||||||
|
\nocite{$for(nocite-ids)$$it$$sep$, $endfor$}
|
||||||
|
$endif$
|
||||||
$if(csl-refs)$
|
$if(csl-refs)$
|
||||||
\newlength{\cslhangindent}
|
\newlength{\cslhangindent}
|
||||||
\setlength{\cslhangindent}{1.5em}
|
\setlength{\cslhangindent}{1.5em}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE LambdaCase #-}
|
||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
{-# LANGUAGE PatternGuards #-}
|
{-# LANGUAGE PatternGuards #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
@ -145,6 +146,11 @@ pandocToLaTeX options (Pandoc meta blocks) = do
|
||||||
|
|
||||||
let dirs = query (extract "dir") blocks
|
let dirs = query (extract "dir") blocks
|
||||||
|
|
||||||
|
let nociteIds = query (\case
|
||||||
|
Cite cs _ -> map citationId cs
|
||||||
|
_ -> [])
|
||||||
|
$ lookupMetaInlines "nocite" meta
|
||||||
|
|
||||||
let context = defField "toc" (writerTableOfContents options) $
|
let context = defField "toc" (writerTableOfContents options) $
|
||||||
defField "toc-depth" (tshow
|
defField "toc-depth" (tshow
|
||||||
(writerTOCDepth options -
|
(writerTOCDepth options -
|
||||||
|
@ -177,9 +183,11 @@ pandocToLaTeX options (Pandoc meta blocks) = do
|
||||||
else id) $
|
else id) $
|
||||||
(case writerCiteMethod options of
|
(case writerCiteMethod options of
|
||||||
Natbib -> defField "biblio-title" biblioTitle .
|
Natbib -> defField "biblio-title" biblioTitle .
|
||||||
defField "natbib" True
|
defField "natbib" True .
|
||||||
|
defField "nocite-ids" nociteIds
|
||||||
Biblatex -> defField "biblio-title" biblioTitle .
|
Biblatex -> defField "biblio-title" biblioTitle .
|
||||||
defField "biblatex" True
|
defField "biblatex" True .
|
||||||
|
defField "nocite-ids" nociteIds
|
||||||
_ -> id) $
|
_ -> id) $
|
||||||
defField "colorlinks" (any hasStringValue
|
defField "colorlinks" (any hasStringValue
|
||||||
["citecolor", "urlcolor", "linkcolor", "toccolor",
|
["citecolor", "urlcolor", "linkcolor", "toccolor",
|
||||||
|
|
Loading…
Add table
Reference in a new issue