summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-09-10 20:23:03 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-09-10 20:23:03 -0700
commitd47eadaf5645a807385f62b5b265274594182967 (patch)
treeb65351f7f7b7b0ffed08936f4fde0f1a6dca2fcc
parent96f64c7c495443366420025d360ff47fdb08f46f (diff)
`--bibliography` again implies `-F pandoc-citeproc`.
But only if pandoc-citeproc isn't already specified as a filter.
-rw-r--r--README5
-rw-r--r--pandoc.hs16
2 files changed, 14 insertions, 7 deletions
diff --git a/README b/README
index 7a827ef7b..ddc2697be 100644
--- a/README
+++ b/README
@@ -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*,
diff --git a/pandoc.hs b/pandoc.hs
index 2c20e16b5..7507e8334 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -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