diff options
-rw-r--r-- | src/Text/Pandoc/App.hs | 9 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index cf70f3971..cac86b142 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -211,10 +211,6 @@ convertWithOpts opts = do ("application/xml", jatsCSL) return $ ("csl", jatsEncoded) : optMetadata opts else return $ optMetadata opts - metadataFromFile <- - case optMetadataFile opts of - Nothing -> return mempty - Just file -> readFileLazy file >>= yamlToMeta case lookup "lang" (optMetadata opts) of Just l -> case parseBCP47 l of @@ -235,6 +231,11 @@ convertWithOpts opts = do , readerStripComments = optStripComments opts } + metadataFromFile <- + case optMetadataFile opts of + Nothing -> return mempty + Just file -> readFileLazy file >>= yamlToMeta readerOpts + let transforms = (case optBaseHeaderLevel opts of x | x > 1 -> (headerShift (x - 1) :) | otherwise -> id) . diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 43cb68b67..da6bdc1a0 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -249,12 +249,11 @@ yamlMetaBlock = try $ do -- | Read a YAML string and convert it to pandoc metadata. -- String scalars in the YAML are parsed as Markdown. -yamlToMeta :: PandocMonad m => BS.ByteString -> m Meta -yamlToMeta bstr = do +yamlToMeta :: PandocMonad m => ReaderOptions -> BS.ByteString -> m Meta +yamlToMeta opts bstr = do let parser = do meta <- yamlBsToMeta bstr return $ runF meta defaultParserState - opts = def{ readerExtensions = pandocExtensions } parsed <- readWithM parser def{ stateOptions = opts } "" case parsed of Right result -> return result |