diff options
author | Nikolay Yakimov <root@livid.pp.ru> | 2015-03-28 02:53:33 +0300 |
---|---|---|
committer | Nikolay Yakimov <root@livid.pp.ru> | 2015-03-28 02:53:33 +0300 |
commit | 6960b2a4cce65479e15f19369e7c3268d4b8a8a5 (patch) | |
tree | 31dc6e81b47f64e6d1022c8da0e6c4e50332dca2 /src | |
parent | d09b7593f60e056d82108a20ca13c48e6b51fc04 (diff) | |
download | pandoc-6960b2a4cce65479e15f19369e7c3268d4b8a8a5.tar.gz |
Markdown Reader: Disable meta exts for meta values
Disable all metadata block extensions when parsing metadata field
values. Issue #2026
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 55ec256f8..bd436da87 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -281,13 +281,18 @@ ignorable t = T.pack "_" `T.isSuffixOf` t toMetaValue :: ReaderOptions -> Text -> MetaValue toMetaValue opts x = - case readMarkdown opts (T.unpack x) of + case readMarkdown opts' (T.unpack x) of Pandoc _ [Plain xs] -> MetaInlines xs Pandoc _ [Para xs] | endsWithNewline x -> MetaBlocks [Para xs] | otherwise -> MetaInlines xs Pandoc _ bs -> MetaBlocks bs where endsWithNewline t = T.pack "\n" `T.isSuffixOf` t + opts' = opts{readerExtensions=readerExtensions opts `Set.difference` meta_exts} + meta_exts = Set.fromList [ Ext_pandoc_title_block + , Ext_mmd_title_block + , Ext_yaml_metadata_block + ] yamlToMeta :: ReaderOptions -> Yaml.Value -> MetaValue yamlToMeta opts (Yaml.String t) = toMetaValue opts t |