diff options
author | Mauro Bieg <mb21@users.noreply.github.com> | 2018-06-28 13:35:54 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-06-28 13:35:54 +0200 |
commit | 0459d1be260ba9e9f51e181471368477a65409a9 (patch) | |
tree | dffd0a6192e1eba8f71d59a8d16080964e711c83 /src/Text | |
parent | 70275251515d6320c7d2d8aedf34f30e077928fe (diff) | |
download | pandoc-0459d1be260ba9e9f51e181471368477a65409a9.tar.gz |
TikiWiki reader: improve list parsing (#4723)
- remove trailing Space from list items
- parse lists that have no space after marker (fixes #4722)
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/TikiWiki.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/TikiWiki.hs b/src/Text/Pandoc/Readers/TikiWiki.hs index 5c7507248..333144c56 100644 --- a/src/Text/Pandoc/Readers/TikiWiki.hs +++ b/src/Text/Pandoc/Readers/TikiWiki.hs @@ -22,6 +22,7 @@ import Prelude import Control.Monad import Control.Monad.Except (throwError) import qualified Data.Foldable as F +import Data.List (dropWhileEnd) import Data.Maybe (fromMaybe) import Data.Text (Text) import qualified Data.Text as T @@ -319,7 +320,7 @@ listItem = choice [ bulletItem :: PandocMonad m => TikiWikiParser m (ListNesting, B.Blocks) bulletItem = try $ do prefix <- many1 $ char '*' - many1 $ char ' ' + many $ char ' ' content <- listItemLine (length prefix) return (LN Bullet (length prefix), B.plain content) @@ -331,7 +332,7 @@ bulletItem = try $ do numberedItem :: PandocMonad m => TikiWikiParser m (ListNesting, B.Blocks) numberedItem = try $ do prefix <- many1 $ char '#' - many1 $ char ' ' + many $ char ' ' content <- listItemLine (length prefix) return (LN Numbered (length prefix), B.plain content) @@ -346,7 +347,7 @@ listItemLine nest = lineContent >>= parseContent listContinuation = string (replicate nest '+') >> lineContent parseContent x = do parsed <- parseFromString (many1 inline) x - return $ mconcat parsed + return $ mconcat $ dropWhileEnd (== B.space) parsed -- Turn the CODE macro attributes into Pandoc code block attributes. mungeAttrs :: [(String, String)] -> (String, [String], [(String, String)]) |