From e190912302fbc5780f38ec0bece13be0f09fbb0f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 21 Mar 2018 16:49:55 -0700 Subject: Parsing: Fix romanNumeral parser. We previously accepted 'DDC' as 1100. Closes #4480. --- src/Text/Pandoc/Parsing.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index d488ea5cb..d812f5ee5 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -532,15 +532,15 @@ romanNumeral upperCase = do map char romanDigits thousands <- ((1000 *) . length) <$> many thousand ninehundreds <- option 0 $ try $ hundred >> thousand >> return 900 - fivehundreds <- ((500 *) . length) <$> many fivehundred + fivehundreds <- option 0 $ 500 <$ fivehundred fourhundreds <- option 0 $ try $ hundred >> fivehundred >> return 400 hundreds <- ((100 *) . length) <$> many hundred nineties <- option 0 $ try $ ten >> hundred >> return 90 - fifties <- ((50 *) . length) <$> many fifty + fifties <- option 0 $ (50 <$ fifty) forties <- option 0 $ try $ ten >> fifty >> return 40 tens <- ((10 *) . length) <$> many ten nines <- option 0 $ try $ one >> ten >> return 9 - fives <- ((5 *) . length) <$> many five + fives <- option 0 $ (5 <$ five) fours <- option 0 $ try $ one >> five >> return 4 ones <- length <$> many one let total = thousands + ninehundreds + fivehundreds + fourhundreds + -- cgit v1.2.3