diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-10-28 20:41:17 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-10-28 20:41:17 -0700 |
commit | 6b8e595e7285210f018186af93cee3df23da9060 (patch) | |
tree | f0e043785d17538d580ead6025b6a7d194870fb4 /src/Text | |
parent | b1e71013933f0f5b98188639ea7e11f0c5f65ec8 (diff) | |
download | pandoc-6b8e595e7285210f018186af93cee3df23da9060.tar.gz |
Roff reader: use escapeArg in macroArg.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Roff.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs index cf9056aa7..7383d95ae 100644 --- a/src/Text/Pandoc/Readers/Roff.hs +++ b/src/Text/Pandoc/Readers/Roff.hs @@ -53,7 +53,7 @@ import Control.Monad (void, mzero, guard, when, mplus) import Control.Monad.Except (throwError) import Text.Pandoc.Class (getResourcePath, readFileFromDirs, PandocMonad(..), report) -import Data.Char (isLower, toLower, toUpper, chr, ord, +import Data.Char (isLower, toLower, toUpper, chr, isAscii, isAlphaNum, isSpace) import Data.Default (Default) import qualified Data.Map as M @@ -602,9 +602,14 @@ linePart = macroArg <|> escape <|> macroArg :: PandocMonad m => RoffLexer m [LinePart] macroArg = try $ do + pos <- getPosition string "\\\\$" - x <- digit - return [MacroArg $ ord x - ord '0'] + x <- escapeArg <|> count 1 digit + case safeRead x of + Just i -> return [MacroArg i] + Nothing -> do + report $ SkippedContent ("illegal macro argument " ++ x) pos + return [] regularText :: PandocMonad m => RoffLexer m [LinePart] regularText = do |