Man reader: Moved handling of P, PP, LP to parser phase.

This commit is contained in:
John MacFarlane 2018-10-21 12:53:26 -07:00
parent f3a71d723b
commit 6b553c2e22

View file

@ -155,13 +155,18 @@ parseBlock = choice [ parseList
, parseDefinitionList , parseDefinitionList
, parseBlockQuote , parseBlockQuote
, parseTitle , parseTitle
, parseNewParagraph
, parsePara , parsePara
, parseSkippedContent
, parseCodeBlock , parseCodeBlock
, parseHeader , parseHeader
, skipUnkownMacro , skipUnkownMacro
] ]
parseNewParagraph :: PandocMonad m => ManParser m Blocks
parseNewParagraph = do
mmacro "P" <|> mmacro "PP" <|> mmacro "LP" <|> memptyLine
return mempty
eofline :: Stream s m Char => ParsecT s u m () eofline :: Stream s m Char => ParsecT s u m ()
eofline = void newline <|> eof eofline = void newline <|> eof
@ -299,7 +304,7 @@ lexMacro = do
"\\\"" -> return mempty "\\\"" -> return mempty
"\\#" -> return mempty "\\#" -> return mempty
"de" -> lexMacroDef args "de" -> lexMacroDef args
x | x `elem` [ "P", "PP", "LP", "sp"] -> return $ singleTok MEmptyLine "sp" -> return $ singleTok MEmptyLine
_ -> resolveMacro macroName args _ -> resolveMacro macroName args
where where
@ -479,9 +484,6 @@ parseTitle = do
modifyState $ \st -> st{ metadata = adjustMeta $ metadata st } modifyState $ \st -> st{ metadata = adjustMeta $ metadata st }
return mempty return mempty
parseSkippedContent :: PandocMonad m => ManParser m Blocks
parseSkippedContent = mempty <$ memptyLine
linePartsToInlines :: [LinePart] -> Inlines linePartsToInlines :: [LinePart] -> Inlines
linePartsToInlines = go linePartsToInlines = go