diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-01-16 09:17:20 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-01-16 09:17:20 -0800 |
commit | 4926645578aecc08ea496860f1608fa3e8ffd572 (patch) | |
tree | 365808605fea13a4af0aa6b4ee20151feb8c76c7 /src | |
parent | 923204d5531e34a665c907c9e590b8e440d81d94 (diff) | |
download | pandoc-4926645578aecc08ea496860f1608fa3e8ffd572.tar.gz |
Implemented Ext_mmd_header_identifiers in markdown reader.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Options.hs | 1 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 26 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index f64926f67..8ebbef0be 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -169,6 +169,7 @@ multimarkdownExtensions :: Set Extension multimarkdownExtensions = Set.fromList [ Ext_pipe_tables , Ext_raw_html + , Ext_markdown_attribute , Ext_raw_tex , Ext_tex_math_double_backslash , Ext_intraword_underscores diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 8141187e7..05f6b084e 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -396,12 +396,30 @@ atxHeader = try $ do attr' <- addToHeaderList attr text return $ B.headerWith attr' level <$> text -atxClosing :: Parser [Char] st Attr -atxClosing = - try $ skipMany (char '#') >> skipSpaces >> option nullAttr attributes <* blanklines +atxClosing :: MarkdownParser Attr +atxClosing = try $ do + attr' <- option nullAttr + (guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier) + skipMany (char '#') + skipSpaces + attr <- option attr' + (guardEnabled Ext_header_attributes >> attributes) + blanklines + return attr setextHeaderEnd :: MarkdownParser Attr -setextHeaderEnd = try $ option nullAttr attributes <* blankline +setextHeaderEnd = try $ do + attr <- option nullAttr + $ (guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier) + <|> (guardEnabled Ext_header_attributes >> attributes) + blanklines + return attr + +mmdHeaderIdentifier :: MarkdownParser Attr +mmdHeaderIdentifier = do + ident <- stripFirstAndLast . snd <$> reference + skipSpaces + return (ident,[],[]) setextHeader :: MarkdownParser (F Blocks) setextHeader = try $ do |