@@ -32,7 +32,7 @@ module Main where
3232import Text.Pandoc
3333import Text.Pandoc.S5 (s5HeaderIncludes)
3434import Text.Pandoc.Shared ( tabFilter, ObfuscationMethod (..), readDataFile,
35− headerShift, findDataFile, findFirstFile )
35+ headerShift, findDataFile )
3636#ifdef _HIGHLIGHTING
3737import Text.Pandoc.Highlighting ( languages )
3838#endif
@@ -767,25 +767,6 @@ main = do
767767 return $ ("mathml-script", s) : variables'
768768 _ -> return variables'
769769
770−#ifdef _CITEPROC
771− cslfile' <- if null cslfile
772− then findDataFile datadir "default.csl"
773− else return cslfile
774− csl <- readCSLFile cslfile'
775− refs' <- if null refs
776− then do
777− f <- findFirstFile datadir
778− ["biblio.xml","biblio.json","biblio.bib"]
779− case f of
780− Just x -> catch (readBiblioFile x) $ \e -> do
781− UTF8.hPutStrLn stderr $
782− "Error reading bibliography `" ++ x ++ "'"
783− UTF8.hPutStrLn stderr $ show e
784− exitWith (ExitFailure 23) >> return []
785− Nothing -> return []
786− else return refs
787−#endif
788−
789770 let sourceDir = if null sources
790771 then "."
791772 else takeDirectory (head sources)
@@ -803,7 +784,7 @@ main = do
803784 lhsExtension sources,
804785 stateStandalone = standalone',
805786#ifdef _CITEPROC
806− stateCitations = map refId refs',
787+ stateCitations = map refId refs,
807788#endif
808789 stateSmart = smart || writerName' `elem`
809790 ["latex", "context", "latex+lhs", "man"],
@@ -863,7 +844,13 @@ main = do
863844
864845 doc'' <- do
865846#ifdef _CITEPROC
866− processBiblio csl refs' doc'
847+ if null refs
848+ then return doc'
849+ else do
850+ cslfile' <- if null cslfile
851+ then findDataFile datadir "default.csl"
852+ else return cslfile
853+ processBiblio cslfile' refs doc'
867854#else
868855 return doc'
869856#endif