--bibliography again implies -F pandoc-citeproc.

But only if pandoc-citeproc isn't already specified as a filter.
This commit is contained in:
John MacFarlane 2013-09-10 20:23:03 -07:00
parent 96f64c7c49
commit d47eadaf56
2 changed files with 14 additions and 7 deletions

5
README
View file

@ -606,8 +606,9 @@ Citation rendering
`--bibliography=`*FILE*
: Set the `bibliography` field in the document's metadata to *FILE*,
overriding any value set in the metadata. (This is equivalent to
`--metadata bibliography=FILE`.)
overriding any value set in the metadata, and process citations
using `pandoc-citeproc`. (This is equivalent to
`--metadata bibliography=FILE --filter pandoc-citeproc`.)
`--csl=`*FILE*
: Set the `csl` field in the document's metadata to *FILE*,

View file

@ -140,7 +140,7 @@ data Opt = Opt
, optReferenceLinks :: Bool -- ^ Use reference links in writing markdown, rst
, optWrapText :: Bool -- ^ Wrap text
, optColumns :: Int -- ^ Line length in characters
, optPlugins :: [[String] -> Pandoc -> IO Pandoc] -- ^ Plugins to apply
, optFilters :: [FilePath] -- ^ Filters to apply
, optEmailObfuscation :: ObfuscationMethod
, optIdentifierPrefix :: String
, optIndentedCodeClasses :: [String] -- ^ Default classes for indented code blocks
@ -195,7 +195,7 @@ defaultOpts = Opt
, optReferenceLinks = False
, optWrapText = True
, optColumns = 72
, optPlugins = []
, optFilters = []
, optEmailObfuscation = JavascriptObfuscation
, optIdentifierPrefix = ""
, optIndentedCodeClasses = []
@ -285,8 +285,7 @@ options =
, Option "F" ["filter"]
(ReqArg
(\arg opt -> return opt { optPlugins = externalFilter arg :
optPlugins opt })
(\arg opt -> return opt { optFilters = arg : optFilters opt })
"PROGRAM")
"" -- "External JSON filter"
@ -913,7 +912,7 @@ main = do
, optReferenceLinks = referenceLinks
, optWrapText = wrap
, optColumns = columns
, optPlugins = plugins
, optFilters = filters
, optEmailObfuscation = obfuscationMethod
, optIdentifierPrefix = idPrefix
, optIndentedCodeClasses = codeBlockClasses
@ -933,6 +932,13 @@ main = do
mapM_ (\arg -> UTF8.hPutStrLn stdout arg) args
exitWith ExitSuccess
-- --bibliography implies -F pandoc-citeproc for backwards compatibility:
let filters' = case lookup "bibliography" metadata of
Just _ | "pandoc-citeproc" `notElem` filters ->
"pandoc-citeproc" : filters
_ -> filters
let plugins = map externalFilter filters'
let sources = if ignoreArgs then [] else args
datadir <- case mbDataDir of