aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorYan Pas <yanp.bugz@gmail.com>2018-10-07 22:41:11 +0300
committerYan Pas <yanp.bugz@gmail.com>2018-10-09 23:59:12 +0300
commit07b4d7b297dfc83f47aa1d708b7405a5e4b3cc4f (patch)
tree28d671d6a4a89c36d1c71a46a1ffe6f288aac797 /src/Text
parent753a4d376df9faecce20d2b60a1d56b9ee0c9357 (diff)
downloadpandoc-07b4d7b297dfc83f47aa1d708b7405a5e4b3cc4f.tar.gz
posix man files parsed successfully
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Man.hs10
1 files changed, 6 insertions, 4 deletions
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