git.iko.soy/typeable/pandoc
on master help sign in
Creole reader: fixed lists with trailing white space.
commitfa67d6e86ff1464874480cde84d329f02f132474 authorSascha Wilde <wilde@sha-bang.de> dateTue 31 Oct 2017, 18:55 (9 years ago) parenta496979
2 files changed+12−1
src/Text/Pandoc/Readers/Creole.hs+2−1 test/Tests/Readers/Creole.hs+10
src/Text/Pandoc/Readers/Creole.hs+2−1
@@ -154,7 +154,8 @@ listItem :: PandocMonad m => Char -> Int -> CRLParser m B.Blocks
154154listItem c n =
155155 fmap (B.plain . B.trimInlines .mconcat) (listStart >> many1Till inline itemEnd)
156156 where
157− listStart = try $ optional newline >> skipSpaces >> count n (char c)
157+ listStart = try $ skipSpaces >> optional newline >> skipSpaces
158+ >> count n (char c)
158159 >> lookAhead (noneOf [c]) >> skipSpaces
159160 itemEnd = endOfParaElement <|> nextItem n
160161 <|> if n < 3 then nextItem (n+1)
test/Tests/Readers/Creole.hs+10
@@ -127,6 +127,11 @@ tests = [
127127 =?> bulletList [ plain "foo"
128128 <> bulletList [ plain "bar", plain "baz" ]
129129 , plain "blubb" ]
130+ , "nested unordered list, one separating space, trailing space" =:
131+ "* foo \n** bar \n** baz \n* blubb "
132+ =?> bulletList [ plain "foo"
133+ <> bulletList [ plain "bar", plain "baz" ]
134+ , plain "blubb" ]
130135 , "ordered list, two entries, one separating space" =:
131136 "# foo\n# bar"
132137 =?> orderedList [ plain "foo", plain "bar" ]
@@ -141,6 +146,11 @@ tests = [
141146 =?> orderedList [ plain "foo"
142147 <> orderedList [ plain "bar", plain "baz" ]
143148 , plain "blubb" ]
149+ , "nested ordered list, one separating space, trailing space" =:
150+ "# foo \n## bar \n## baz \n# blubb "
151+ =?> orderedList [ plain "foo"
152+ <> orderedList [ plain "bar", plain "baz" ]
153+ , plain "blubb" ]
144154 , "nested many ordered lists, one separating space" =:
145155 ("# foo\n## bar\n### third\n### third two\n## baz\n### third again\n"
146156 <> "#### fourth\n##### fith\n# blubb")