diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-11-13 08:42:09 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-11-13 08:42:09 -0800 |
commit | 7aecddd0f7c22ed2beb1ccf268d3b0e8b2d08831 (patch) | |
tree | f6c23499f8f6ead59fd27a611f314de64d62cdcc | |
parent | 1fa2973da690ba81a80337d9d3f0f6e2c786b602 (diff) | |
download | pandoc-7aecddd0f7c22ed2beb1ccf268d3b0e8b2d08831.tar.gz |
Replaced --biblio-file with --bibliography, removed --biblio-format.
Bibliography format is guessed from the file extension of the
bibliography.
Also, the bibliography entries are now read during option parsing.
-rw-r--r-- | src/pandoc.hs | 27 | ||||
-rw-r--r-- | tests/RunTests.hs | 2 |
2 files changed, 10 insertions, 19 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs index 349d86ca2..d6b40cc94 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -163,8 +163,7 @@ data Opt = Opt , optIndentedCodeClasses :: [String] -- ^ Default classes for indented code blocks , optDataDir :: Maybe FilePath #ifdef _CITEPROC - , optBiblioFile :: String - , optBiblioFormat :: String + , optBibliography :: [Reference] , optCslFile :: String #endif } @@ -205,8 +204,7 @@ defaultOpts = Opt , optIndentedCodeClasses = [] , optDataDir = Nothing #ifdef _CITEPROC - , optBiblioFile = [] - , optBiblioFormat = [] + , optBibliography = [] , optCslFile = [] #endif } @@ -520,16 +518,14 @@ options = "FORMAT") "" -- "Print default template for FORMAT" #ifdef _CITEPROC - , Option "" ["biblio"] + , Option "" ["bibliography"] (ReqArg - (\arg opt -> return opt { optBiblioFile = arg} ) + (\arg opt -> do + refs <- readBiblioFile arg "" + return opt { optBibliography = + optBibliography opt ++ refs } ) "FILENAME") "" - , Option "" ["biblio-format"] - (ReqArg - (\arg opt -> return opt { optBiblioFormat = arg} ) - "STRING") - "" , Option "" ["csl"] (ReqArg (\arg opt -> return opt { optCslFile = arg} ) @@ -684,9 +680,8 @@ main = do , optIndentedCodeClasses = codeBlockClasses , optDataDir = mbDataDir #ifdef _CITEPROC - , optBiblioFile = biblioFile - , optBiblioFormat = biblioFormat - , optCslFile = cslFile + , optBibliography = refs + , optCslFile = cslFile #endif } = opts @@ -746,10 +741,6 @@ main = do let standalone' = standalone || isNonTextOutput writerName' -#ifdef _CITEPROC - refs <- if null biblioFile then return [] else readBiblioFile biblioFile biblioFormat -#endif - variables' <- case (writerName', standalone', offline) of ("s5", True, True) -> do inc <- s5HeaderIncludes datadir diff --git a/tests/RunTests.hs b/tests/RunTests.hs index 468451562..688731317 100644 --- a/tests/RunTests.hs +++ b/tests/RunTests.hs @@ -106,7 +106,7 @@ main = do "latex-reader.latex" "latex-reader.native" r11 <- runTest "native reader" ["-r", "native", "-w", "native", "-s"] "testsuite.native" "testsuite.native" - r14 <- runTest "markdown reader (citations)" ["-r", "markdown", "-w", "plain", "--biblio", "biblio.bib", "--csl", "chicago-author-date.csl"] "markdown-citations.txt" "markdown-citations.plain" + r14 <- runTest "markdown reader (citations)" ["-r", "markdown", "-w", "plain", "--bibliography", "biblio.bib", "--csl", "chicago-author-date.csl"] "markdown-citations.txt" "markdown-citations.plain" r12s <- if runLhsTests then mapM runLhsWriterTest lhsWriterFormats else putStrLn "Skipping lhs writer tests because they presuppose highlighting support" >> return [] |