diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2015-12-13 18:47:21 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2015-12-13 18:47:21 -0700 |
commit | 96bc2d5d41922daaec6315c5c0da27701a84b091 (patch) | |
tree | fdbf7431a6f886baa51421d85d423ae1e3eb5e98 | |
parent | 1de000fcfd3db9e451bcecd1fce5d26d78111100 (diff) | |
download | pandoc-citeproc-preamble-96bc2d5d41922daaec6315c5c0da27701a84b091.tar.gz |
don't insert preamble if there aren't any refs
-rw-r--r-- | src/pandoc-citeproc-preamble.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pandoc-citeproc-preamble.hs b/src/pandoc-citeproc-preamble.hs index 5572fe1..919ed2a 100644 --- a/src/pandoc-citeproc-preamble.hs +++ b/src/pandoc-citeproc-preamble.hs @@ -31,7 +31,12 @@ import Text.Pandoc.JSON insertPreamble :: Block -> [Block] -> [Block] insertPreamble preamble = foldr step [] where - step refs@(Div (_, ["references"], _) _) xs = preamble : refs : xs + step refsDiv@(Div (_, ["references"], _) theRefs) xs = + -- check whether pandoc-citeproc actually inserted any + -- references + if null theRefs + then refsDiv : xs + else preamble : refsDiv : xs step x xs = x:xs doPreamble :: Maybe Format -> Pandoc -> IO Pandoc |