aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/App.hs12
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs2
-rw-r--r--src/Text/Pandoc/Readers/Vimwiki.hs4
3 files changed, 8 insertions, 10 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 79346855f..0d34eca11 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -230,12 +230,8 @@ convertWithOpts opts = do
metadataFromFile <-
case optMetadataFiles opts of
[] -> 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.
+ paths -> mapM readFileLazy paths >>=
+ fmap mconcat . mapM (yamlToMeta readerOpts)
let transforms = (case optShiftHeadingLevelBy opts of
0 -> id
@@ -286,8 +282,8 @@ convertWithOpts opts = do
( (if isJust (optExtractMedia opts)
then fillMediaBag
else return)
- >=> return . adjustMetadata (<> metadataFromFile)
- >=> return . adjustMetadata (metadata <>)
+ >=> return . adjustMetadata (metadataFromFile <>)
+ >=> return . adjustMetadata (<> metadata)
>=> applyTransforms transforms
>=> applyFilters readerOpts filters' [format]
>=> maybe return extractMedia (optExtractMedia opts)
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 7692cfac9..9f1905741 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -155,7 +155,7 @@ options =
, Option "" ["metadata-file"]
(ReqArg
(\arg opt -> return opt{ optMetadataFiles =
- normalizePath arg : optMetadataFiles opt })
+ optMetadataFiles opt ++ [normalizePath arg] })
"FILE")
""
diff --git a/src/Text/Pandoc/Readers/Vimwiki.hs b/src/Text/Pandoc/Readers/Vimwiki.hs
index 57fa6fa1a..27b7d7245 100644
--- a/src/Text/Pandoc/Readers/Vimwiki.hs
+++ b/src/Text/Pandoc/Readers/Vimwiki.hs
@@ -427,7 +427,9 @@ ph s = try $ do
contents <- trimInlines . mconcat <$> manyTill inline (lookAhead newline)
--use lookAhead because of placeholder in the whitespace parser
let meta' = B.setMeta s contents nullMeta
- updateState $ \st -> st { stateMeta = stateMeta st <> meta' }
+ -- this order ensures that later values will be ignored in favor
+ -- of earlier ones:
+ updateState $ \st -> st { stateMeta = meta' <> stateMeta st }
noHtmlPh :: PandocMonad m => VwParser m ()
noHtmlPh = try $