diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-03-21 16:49:55 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-03-21 16:49:55 -0700 |
commit | e190912302fbc5780f38ec0bece13be0f09fbb0f (patch) | |
tree | 7a1adacc6808abb2fbb2afac884990f1ff531213 /src/Text/Pandoc | |
parent | 6f507336918baa016eefce854f00fad1e1a78068 (diff) | |
download | pandoc-e190912302fbc5780f38ec0bece13be0f09fbb0f.tar.gz |
Parsing: Fix romanNumeral parser.
We previously accepted 'DDC' as 1100. Closes #4480.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Parsing.hs | 6 |
1 files changed, 3 insertions, 3 deletions
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 + |