git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: try to parse lists before trying to parse table

This ensures that tables inside lists are parsed correctly.

commite34a0703f557ed4ceeadaa6cb29edb6239255d96 authorAlexander Krotov <ilabdsf@gmail.com> dateSun 28 Oct 2018, 03:52 (8 years ago) parentd8135b2
2 files changed+15−3
src/Text/Pandoc/Readers/Muse.hs+3−3 test/Tests/Readers/Muse.hs+12
src/Text/Pandoc/Readers/Muse.hs+3−3
@@ -256,8 +256,8 @@ parseBlocks :: PandocMonad m
256256parseBlocks =
257257 try (parseEnd <|>
258258 nextSection <|>
259− blockStart <|>
260259 listStart <|>
260+ blockStart <|>
261261 paraStart)
262262 where
263263 nextSection = mempty <$ lookAhead headingStart
@@ -287,7 +287,7 @@ parseBlocksTill end = continuation
287287 blockStart = (B.<>) <$> blockElements <*> allowPara continuation
288288 listStart = uncurry (B.<>) <$> allowPara (anyListUntil (parseEnd <|> continuation))
289289 paraStart = uncurry (B.<>) <$> paraUntil (parseEnd <|> continuation)
290− continuation = try $ parseEnd <|> blockStart <|> listStart <|> paraStart
290+ continuation = try $ parseEnd <|> listStart <|> blockStart <|> paraStart
291291
292292listItemContentsUntil :: PandocMonad m
293293 => Int
@@ -296,7 +296,7 @@ listItemContentsUntil :: PandocMonad m
296296 -> MuseParser m (F Blocks, a)
297297listItemContentsUntil col pre end = p
298298 where
299− p = try blockStart <|> try listStart <|> try paraStart
299+ p = try listStart <|> try blockStart <|> try paraStart
300300 parsePre = (mempty,) <$> pre
301301 parseEnd = (mempty,) <$> end
302302 paraStart = do
test/Tests/Readers/Muse.hs+12
@@ -1328,6 +1328,18 @@ tests =
13281328 ]
13291329 ])
13301330 ]
1331+ , "Definition list with table" =:
1332+ " foo :: bar | baz" =?>
1333+ definitionList [ ("foo", [ table mempty [(AlignDefault, 0.0), (AlignDefault, 0.0)]
1334+ []
1335+ [[plain "bar", plain "baz"]]
1336+ ])]
1337+ , "Definition list with table inside bullet list" =:
1338+ " - foo :: bar | baz" =?>
1339+ bulletList [definitionList [ ("foo", [ table mempty [(AlignDefault, 0.0), (AlignDefault, 0.0)]
1340+ []
1341+ [[plain "bar", plain "baz"]]
1342+ ])]]
13311343 , test emacsMuse "Multi-line definition lists from Emacs Muse manual"
13321344 (T.unlines
13331345 [ "Term1 ::"