git.iko.soy/typeable/pandoc
on master help sign in
Markdown Reader: Disable meta exts for meta values

Disable all metadata block extensions when parsing metadata field values. Issue #2026

commit6960b2a4cce65479e15f19369e7c3268d4b8a8a5 authorNikolay Yakimov <root@livid.pp.ru> dateSat 28 Mar 2015, 02:53 (12 years ago) parentd09b759
1 file changed+6−1
src/Text/Pandoc/Readers/Markdown.hs+6−1
src/Text/Pandoc/Readers/Markdown.hs+6−1
@@ -281,13 +281,18 @@ ignorable t = T.pack "_" `T.isSuffixOf` t
281281
282282toMetaValue :: ReaderOptions -> Text -> MetaValue
283283toMetaValue opts x =
284− case readMarkdown opts (T.unpack x) of
284+ case readMarkdown opts' (T.unpack x) of
285285 Pandoc _ [Plain xs] -> MetaInlines xs
286286 Pandoc _ [Para xs]
287287 | endsWithNewline x -> MetaBlocks [Para xs]
288288 | otherwise -> MetaInlines xs
289289 Pandoc _ bs -> MetaBlocks bs
290290 where endsWithNewline t = T.pack "\n" `T.isSuffixOf` t
291+ opts' = opts{readerExtensions=readerExtensions opts `Set.difference` meta_exts}
292+ meta_exts = Set.fromList [ Ext_pandoc_title_block
293+ , Ext_mmd_title_block
294+ , Ext_yaml_metadata_block
295+ ]
291296
292297yamlToMeta :: ReaderOptions -> Yaml.Value -> MetaValue
293298yamlToMeta opts (Yaml.String t) = toMetaValue opts t