git.iko.soy/typeable/pandoc
on master help sign in
Change in ordered lists in Markdown reader:
d5f9b1dfiddlosopher
README+11−12
@@ -394,8 +394,8 @@ behavior is consistent with the official markdown syntax
394description, even though it is different from that of `Markdown.pl`.)
394description, even though it is different from that of `Markdown.pl`.)
395
395
396Unlike standard markdown, Pandoc allows ordered list items to be
396Unlike standard markdown, Pandoc allows ordered list items to be
397−marked with single letters, instead of numbers. So, for example,
397+marked with single lowercase letters (from 'a' to 'n'), instead of
398−this source yields a nested ordered list:
398+numbers. So, for example, this source yields a nested ordered list:
399
399
400 1. First
400 1. First
401 2. Second
401 2. Second
@@ -403,24 +403,23 @@ this source yields a nested ordered list:
403 b. Fie
403 b. Fie
404 3. Third
404 3. Third
405
405
406−Pandoc also extends standard markdown in allowing list item markers
406+The letters may be followed by either '.' or ')':
407−to be terminated by ')':
408
407
409− 1) First
408+ 1. First
410− 2) Second
409+ 2. Second
411− A) Fee
410+ a) Fee
412− B) Fie
411+ b) Fie
413− 3) Third
412+ 3. Third
414
413
415Note that Pandoc pays no attention to the *type* of ordered list
414Note that Pandoc pays no attention to the *type* of ordered list
416item marker used. Thus, the following is treated just the same as
415item marker used. Thus, the following is treated just the same as
417the example above:
416the example above:
418
417
419− A) First
418+ a) First
420 1. Second
419 1. Second
421 2. Fee
420 2. Fee
422− B) Fie
421+ b) Fie
423− C) Third
422+ c. Third
424
423
425Reference links
424Reference links
426---------------
425---------------
src/Text/Pandoc/Readers/Markdown.hs+12−6
@@ -77,7 +77,6 @@ autoLinkEnd = '>'
77mathStart = '$'
77mathStart = '$'
78mathEnd = '$'
78mathEnd = '$'
79bulletListMarkers = "*+-"
79bulletListMarkers = "*+-"
80−orderedListDelimiters = ".)"
81escapeChar = '\\'
80escapeChar = '\\'
82hruleChars = "*-_"
81hruleChars = "*-_"
83quoteChars = "'\""
82quoteChars = "'\""
@@ -360,14 +359,21 @@ bulletListStart = try (do
360 spaceChar
359 spaceChar
361 skipSpaces)
360 skipSpaces)
362
361
362+standardOrderedListStart = do
363+ many1 digit
364+ char '.'
365+
366+extendedOrderedListStart = do
367+ failIfStrict
368+ oneOf ['a'..'n']
369+ oneOf ".)"
370+
363−orderedListStart = try (do
371+orderedListStart = try $ do
364 option ' ' newline -- if preceded by a Plain block in a list context
372 option ' ' newline -- if preceded by a Plain block in a list context
365 nonindentSpaces
373 nonindentSpaces
366− many1 digit <|> (do{failIfStrict; count 1 letter})
374+ standardOrderedListStart <|> extendedOrderedListStart
367− delim <- oneOf orderedListDelimiters
368− if delim /= '.' then failIfStrict else return ()
369 oneOf spaceChars
375 oneOf spaceChars
370− skipSpaces)
376+ skipSpaces
371
377
372-- parse a line of a list item (start = parser for beginning of list item)
378-- parse a line of a list item (start = parser for beginning of list item)
373listLine start = try (do
379listLine start = try (do