git.iko.soy/typeable/pandoc
on master help sign in
Parsing: Fix romanNumeral parser.

We previously accepted 'DDC' as 1100. Closes #4480.

commite190912302fbc5780f38ec0bece13be0f09fbb0f authorJohn MacFarlane <jgm@berkeley.edu> dateWed 21 Mar 2018, 16:49 (9 years ago) parent6f50733
1 file changed+3−3
src/Text/Pandoc/Parsing.hs+3−3
src/Text/Pandoc/Parsing.hs+3−3
@@ -532,15 +532,15 @@ romanNumeral upperCase = do
532532 map char romanDigits
533533 thousands <- ((1000 *) . length) <$> many thousand
534534 ninehundreds <- option 0 $ try $ hundred >> thousand >> return 900
535− fivehundreds <- ((500 *) . length) <$> many fivehundred
535+ fivehundreds <- option 0 $ 500 <$ fivehundred
536536 fourhundreds <- option 0 $ try $ hundred >> fivehundred >> return 400
537537 hundreds <- ((100 *) . length) <$> many hundred
538538 nineties <- option 0 $ try $ ten >> hundred >> return 90
539− fifties <- ((50 *) . length) <$> many fifty
539+ fifties <- option 0 $ (50 <$ fifty)
540540 forties <- option 0 $ try $ ten >> fifty >> return 40
541541 tens <- ((10 *) . length) <$> many ten
542542 nines <- option 0 $ try $ one >> ten >> return 9
543− fives <- ((5 *) . length) <$> many five
543+ fives <- option 0 $ (5 <$ five)
544544 fours <- option 0 $ try $ one >> five >> return 4
545545 ones <- length <$> many one
546546 let total = thousands + ninehundreds + fivehundreds + fourhundreds +