aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-09-21 12:26:29 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-09-21 12:26:29 +0300
commit23725f3a20f488547aa4d2d2601d34c8e2b628bf (patch)
treededd278327d46af98f78a9f63b7c1694132e95b7
parente26313dd62e1513a9bc2f75f2198a8dd8e9097ea (diff)
downloadpandoc-23725f3a20f488547aa4d2d2601d34c8e2b628bf.tar.gz
Muse reader: rewrite headingStart in applicative style
and remove heading level limit
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index ee93c6777..6cb732c42 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -378,13 +378,11 @@ separator = try $ pure B.horizontalRule
<* eol
headingStart :: PandocMonad m => MuseParser m (String, Int)
-headingStart = try $ do
- anchorId <- option "" $ try (parseAnchor <* manyTill spaceChar eol)
- firstColumn
- level <- fmap length $ many1 $ char '*'
- guard $ level <= 5
- spaceChar
- return (anchorId, level)
+headingStart = try $ (,)
+ <$> option "" (try (parseAnchor <* manyTill spaceChar eol))
+ <* firstColumn
+ <*> fmap length (many1 $ char '*')
+ <* spaceChar
-- | Parse a single-line heading.
emacsHeading :: PandocMonad m => MuseParser m (F Blocks)