diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-28 06:58:20 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-28 06:58:20 +0000 |
commit | 0c475bfd4792a29e5527f63d3adfa4256d75af68 (patch) | |
tree | 38d53fbe736823d480f308b9687444f128680ab3 /src/Text/Pandoc | |
parent | 18b379c1ca575b55edfedbcbf47255b9282f1705 (diff) | |
download | pandoc-0c475bfd4792a29e5527f63d3adfa4256d75af68.tar.gz |
Refactored setext header parsing in Markdown reader for greater
speed.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@933 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 600742bee..057aec2ee 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -231,12 +231,10 @@ atxHeader = try $ do atxClosing = try $ skipMany (char '#') >> blanklines -setextHeader = choice $ map setextH $ enumFromTo 1 (length setextHChars) - -setextH level = try $ do +setextHeader = try $ do text <- many1Till inline newline >>= return . normalizeSpaces - many1 $ char (setextHChars !! (level - 1)) - blanklines + level <- choice $ zipWith (\ch lev -> try (many1 $ char ch) >> blanklines >> return lev) + setextHChars [1..(length setextHChars)] return $ Header level text -- |