Support multiple bibliography files with natbib and biblatex output.

This commit is contained in:
Nathan Gass 2010-12-15 11:40:53 +01:00 committed by John MacFarlane
parent 63d5e0c5f9
commit 43fee5e7f7
3 changed files with 5 additions and 4 deletions

View file

@ -566,7 +566,7 @@ data WriterOptions = WriterOptions
, writerSourceDirectory :: FilePath -- ^ Directory path of 1st source file
, writerUserDataDir :: Maybe FilePath -- ^ Path of user data directory
, writerCiteMethod :: CiteMethod -- ^ How to print cites
, writerBiblioFile :: String -- ^ Biblio file to use for citations
, writerBiblioFiles :: [FilePath] -- ^ Biblio files to use for citations
} deriving Show
-- | Default writer options.
@ -594,7 +594,7 @@ defaultWriterOptions =
, writerSourceDirectory = "."
, writerUserDataDir = Nothing
, writerCiteMethod = Citeproc
, writerBiblioFile = ""
, writerBiblioFiles = []
}
--

View file

@ -36,6 +36,7 @@ import Data.List ( (\\), isSuffixOf, isPrefixOf, intersperse, intercalate )
import Data.Char ( toLower )
import Control.Monad.State
import Text.PrettyPrint.HughesPJ hiding ( Str )
import System.FilePath (dropExtension)
data WriterState =
WriterState { stInNote :: Bool -- @True@ if we're in a note
@ -76,7 +77,7 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
body <- blockListToLaTeX blocks
let main = render body
st <- get
let biblio = takeWhile ((/=) '.') $ writerBiblioFile options
let biblio = intercalate "," $ map dropExtension $ writerBiblioFiles options
citecontext = case writerCiteMethod options of
Natbib -> [ ("biblio", biblio)
, ("natbib", "yes")

View file

@ -739,7 +739,7 @@ main = do
writerIncremental = incremental,
writerXeTeX = xetex,
writerCiteMethod = citeMethod,
writerBiblioFile = head reffiles,
writerBiblioFiles = reffiles,
writerIgnoreNotes = False,
writerNumberSections = numberSections,
writerSectionDivs = sectionDivs,