diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-10-10 10:00:45 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-10-10 10:00:45 -0700 |
commit | a3cd74c29be02dde0d65e0dcf79bccc8d41952ed (patch) | |
tree | 65f24b37937234835d4177fd9d77e22ca262e8da /src | |
parent | 68b09a6d81b24b928b1629ecb3061a51a5ce2352 (diff) | |
download | pandoc-a3cd74c29be02dde0d65e0dcf79bccc8d41952ed.tar.gz |
`--metadata-file`: when multiple files specified, second takes precedence...
on conflicting fields. This changes earlier behavior (but not in
a release), where first took precedence.
Note that this may seem inconsistent with the behavior of
multiple YAML blocks within a document, where the first takes
precedence. Still, it is convenient to be able to override
defaults with options later on the command line.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/App.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index ed5963f1a..f3d342ebf 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -231,6 +231,10 @@ convertWithOpts opts = do [] -> return mempty paths -> mapM readFileLazy paths >>= mapM (yamlToMeta readerOpts) >>= return . (foldr1 (<>)) + -- Note: this list is in reverse order from the order on the + -- command line. So this code ensures that metadata files + -- specified later in the command line take precedence over + -- those specified earlier. let transforms = (case optShiftHeadingLevelBy opts of 0 -> id diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index f9f825a44..a7b20a6e3 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -209,7 +209,7 @@ options = , Option "" ["metadata-file"] (ReqArg (\arg opt -> return opt{ optMetadataFile = - (optMetadataFile opt) <> [normalizePath arg] }) + normalizePath arg : optMetadataFile opt }) "FILE") "" |