From 07b4d7b297dfc83f47aa1d708b7405a5e4b3cc4f Mon Sep 17 00:00:00 2001 From: Yan Pas Date: Sun, 7 Oct 2018 22:41:11 +0300 Subject: posix man files parsed successfully --- src/Text/Pandoc/Readers/Man.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs index 9802216c6..aea53a375 100644 --- a/src/Text/Pandoc/Readers/Man.hs +++ b/src/Text/Pandoc/Readers/Man.hs @@ -182,7 +182,8 @@ escapeLexer = do let skipSeqs = ["%", "{", "}", "&", "\n", ":", "\"", "0", "c"] subsSeqs = [ ("-", '-'), (" ", ' '), ("\\", '\\'), ("[lq]", '“'), ("[rq]", '”') , ("[em]", '—'), ("[en]", '–'), ("*(lq", '«'), ("*(rq", '»') - , ("t", '\t'), ("e", '\\'), ("`", '`') ] + , ("t", '\t'), ("e", '\\'), ("`", '`'), ("^", ' '), ("|", ' ') + , ("'", '`') ] substitute :: PandocMonad m => (String,Char) -> ManLexer m EscapeThing substitute (from,to) = try $ string from >> return (EChar to) skip :: PandocMonad m => String -> ManLexer m EscapeThing @@ -219,7 +220,7 @@ escapeLexer = do escUnknown = do c <- anyChar pos <- getPosition - logOutput $ SkippedContent ("Unknown escape seq \\" ++ [c]) pos + logOutput $ SkippedContent ("Unknown escape sequence \\" ++ [c]) pos return ENothing currentFont :: PandocMonad m => ManLexer m FontKind @@ -240,7 +241,7 @@ lexMacro :: PandocMonad m => ManLexer m ManToken lexMacro = do char '.' <|> char '\'' many spacetab - macroName <- many1 (letter <|> oneOf ['\\', '"']) + macroName <- many1 (letter <|> oneOf ['\\', '"', '&']) args <- lexArgs let joinedArgs = unwords $ fst <$> args knownMacro mkind = MMacro mkind args @@ -269,7 +270,8 @@ lexMacro = do -- TODO better would be [[RoffStr]], since one arg may have different fonts lexArgs :: PandocMonad m => ManLexer m [RoffStr] lexArgs = do - args <- many oneArg + args <- many $ try oneArg + many spacetab eofline return args -- cgit v1.2.3