diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-10-05 18:47:45 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-10-05 18:47:45 +0300 |
commit | 131dcff71d65c343d1721ec0e577b5a773d9e737 (patch) | |
tree | a75e262a5cb66e10a318b34fbbcebb8a71cfe3c3 | |
parent | 659cce8442ee8ba89000b8f499f46a9bbead9cda (diff) | |
download | pandoc-131dcff71d65c343d1721ec0e577b5a773d9e737.tar.gz |
Muse reader: use getIndent in parseHtmlContent
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 7dc2f0c2a..a87ce97a2 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -169,6 +169,10 @@ firstColumn = getPosition >>= \pos -> guard (sourceColumn pos == 1) eol :: Stream s m Char => ParserT s st m () eol = void newline <|> eof +getIndent :: PandocMonad m + => MuseParser m Int +getIndent = subtract 1 . sourceColumn <$ many spaceChar <*> getPosition + someUntil :: (Stream s m t) => ParserT s u m a -> ParserT s u m b @@ -202,11 +206,10 @@ parseHtmlContent :: PandocMonad m => String -- ^ Tag name -> MuseParser m (Attr, F Blocks) parseHtmlContent tag = try $ do - many spaceChar - pos <- getPosition + indent <- getIndent attr <- openTag tag manyTill spaceChar eol - content <- parseBlocksTill $ try $ count (sourceColumn pos - 1) spaceChar *> closeTag tag + content <- parseBlocksTill $ try $ count indent spaceChar *> closeTag tag manyTill spaceChar eol -- closing tag must be followed by optional whitespace and newline return (htmlAttrToPandoc attr, content) @@ -548,10 +551,6 @@ lineBlock = try $ do -- *** List parsers -getIndent :: PandocMonad m - => MuseParser m Int -getIndent = subtract 1 . sourceColumn <$ many spaceChar <*> getPosition - bulletListItemsUntil :: PandocMonad m => Int -- ^ Indentation -> MuseParser m a -- ^ Terminator parser |