diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-10-22 12:05:34 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-10-22 12:05:34 -0700 |
commit | 0327226d4c8976bd997fd00dea1faf4120905c27 (patch) | |
tree | 47b4631826074209a00f891c6cbaeed7a32b53ff | |
parent | 7a111d2d334687b3a099d260ffd6bf774453d273 (diff) | |
download | pandoc-0327226d4c8976bd997fd00dea1faf4120905c27.tar.gz |
Man reader: don't parse \[ul] as unicode escape.
-rw-r--r-- | src/Text/Pandoc/Readers/Man.hs | 4 | ||||
-rw-r--r-- | test/Tests/Readers/Man.hs | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs index 6916e56db..96d31b9d1 100644 --- a/src/Text/Pandoc/Readers/Man.hs +++ b/src/Text/Pandoc/Readers/Man.hs @@ -204,9 +204,11 @@ escapeLexer = try $ do <|> charCode `sepBy1` (many1 Parsec.space) ) <* char ']' - ucharCode = do + ucharCode = try $ do char 'u' cs <- many1 (satisfy isHexDigit) + let lcs = length cs + guard $ lcs >= 4 && lcs <= 6 case chr <$> safeRead ('0':'x':cs) of Nothing -> escUnknown ("\\[u" ++ cs ++ "]") '\xFFFD' Just c -> return c diff --git a/test/Tests/Readers/Man.hs b/test/Tests/Readers/Man.hs index 7fd265122..fdb6718e2 100644 --- a/test/Tests/Readers/Man.hs +++ b/test/Tests/Readers/Man.hs @@ -76,7 +76,7 @@ tests = [ , "two letter escapes" =: "\\(oA\\(~O" =?> (para $ text "ÅÕ") , "bracketed escapes" =: - "\\[oA]\\[~O]\\[Do]\\[Ye]\\[product]" =?> (para $ text "ÅÕ$¥∏") + "\\[oA]\\[~O]\\[Do]\\[Ye]\\[product]\\[ul]" =?> (para $ text "ÅÕ$¥∏_") , "unicode escapes" =: "\\[u2020]" =?> (para $ text "†") , "unicode escapes (combined)" =: |