aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-09-29 15:09:46 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2012-09-29 15:09:46 -0400
commit28fe9c1ae9d81c8f082abe492db8415c3f6310da (patch)
treea9011724a102df7405b25ad8cbfe40c771ad400f
parentc78cc02abf793539e4bcd6c1037d7007946103ca (diff)
downloadpandoc-28fe9c1ae9d81c8f082abe492db8415c3f6310da.tar.gz
Adjusted pandoc.hs for changes in Biblio module.
-rw-r--r--src/pandoc.hs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 484f7ca44..e85cfdba1 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -34,7 +34,7 @@ import Text.Pandoc
import Text.Pandoc.PDF (tex2pdf)
import Text.Pandoc.Readers.LaTeX (handleIncludes)
import Text.Pandoc.Shared ( tabFilter, readDataFile, safeRead,
- headerShift, findDataFile, normalize, err, warn )
+ headerShift, normalize, err, warn )
import Text.Pandoc.XML ( toEntities, fromEntities )
import Text.Pandoc.SelfContained ( makeSelfContained )
import Text.Pandoc.Highlighting ( languages, Style, tango, pygments,
@@ -127,7 +127,7 @@ data Opt = Opt
, optDataDir :: Maybe FilePath
, optCiteMethod :: CiteMethod -- ^ Method to output cites
, optBibliography :: [String]
- , optCslFile :: FilePath
+ , optCslFile :: Maybe FilePath
, optAbbrevsFile :: Maybe FilePath
, optListings :: Bool -- ^ Use listings package for code blocks
, optLaTeXEngine :: String -- ^ Program to use for latex -> pdf
@@ -179,7 +179,7 @@ defaultOpts = Opt
, optDataDir = Nothing
, optCiteMethod = Citeproc
, optBibliography = []
- , optCslFile = ""
+ , optCslFile = Nothing
, optAbbrevsFile = Nothing
, optListings = False
, optLaTeXEngine = "pdflatex"
@@ -573,7 +573,7 @@ options =
, Option "" ["csl"]
(ReqArg
- (\arg opt -> return opt { optCslFile = arg })
+ (\arg opt -> return opt { optCslFile = Just arg })
"FILENAME")
""
@@ -814,7 +814,7 @@ main = do
, optIndentedCodeClasses = codeBlockClasses
, optDataDir = mbDataDir
, optBibliography = reffiles
- , optCslFile = cslfile
+ , optCslFile = mbCsl
, optAbbrevsFile = cslabbrevs
, optCiteMethod = citeMethod
, optListings = listings
@@ -1007,18 +1007,18 @@ main = do
doc2 <- do
if citeMethod == Citeproc && not (null refs)
then do
- csldir <- getAppUserDataDirectory "csl"
- cslfile' <- if null cslfile
- then findDataFile datadir "default.csl"
- else do
- ex <- doesFileExist cslfile
- if ex
- then return cslfile
- else findDataFile datadir $
- replaceDirectory
- (replaceExtension cslfile "csl")
- csldir
- processBiblio cslfile' cslabbrevs refs doc1
+ csl <- case mbCsl of
+ Nothing -> readDataFile datadir "default.csl"
+ Just cslfile -> do
+ exists <- doesFileExist cslfile
+ if exists
+ then UTF8.readFile cslfile
+ else do
+ csldir <- getAppUserDataDirectory "csl"
+ print csldir
+ readDataFile datadir (replaceDirectory
+ (replaceExtension cslfile "csl") csldir)
+ processBiblio csl cslabbrevs refs doc1
else return doc1
let writeBinary :: B.ByteString -> IO ()