aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-10-19 16:09:56 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-10-19 16:09:56 -0700
commit574f9250a795f7baf7a470613b41bd6ff1b3b683 (patch)
tree5e063f5187b3678b907053b5761cc703a5067b2d /src/Text
parent31821451f06714cd416d8d73ff4788d456d47cfd (diff)
downloadpandoc-574f9250a795f7baf7a470613b41bd6ff1b3b683.tar.gz
Man reader: got rid of MUnknownMacro and simplified code.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Man.hs25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs
index 4a1be17e7..f8f984562 100644
--- a/src/Text/Pandoc/Readers/Man.hs
+++ b/src/Text/Pandoc/Readers/Man.hs
@@ -74,7 +74,6 @@ data ManToken = MStr RoffStr
| MEmptyLine
| MHeader Int [RoffStr]
| MMacro MacroKind [RoffStr]
- | MUnknownMacro String [RoffStr]
| MComment String
deriving Show
@@ -387,8 +386,8 @@ mmaybeLink = msatisfy isMMaybeLink where
isMMaybeLink (MMaybeLink _) = True
isMMaybeLink _ = False
-memplyLine :: PandocMonad m => ManParser m ManToken
-memplyLine = msatisfy isMEmptyLine where
+memptyLine :: PandocMonad m => ManParser m ManToken
+memptyLine = msatisfy isMEmptyLine where
isMEmptyLine MEmptyLine = True
isMEmptyLine _ = False
@@ -408,11 +407,6 @@ mmacroAny = msatisfy isMMacro where
isMMacro (MMacro _ _) = True
isMMacro _ = False
-munknownMacro :: PandocMonad m => ManParser m ManToken
-munknownMacro = msatisfy isMUnknownMacro where
- isMUnknownMacro (MUnknownMacro _ _) = True
- isMUnknownMacro _ = False
-
mcomment :: PandocMonad m => ManParser m ManToken
mcomment = msatisfy isMComment where
isMComment (MComment _) = True
@@ -439,18 +433,7 @@ parseTitle = do
pst {stateMeta = metaUp}
parseSkippedContent :: PandocMonad m => ManParser m Blocks
-parseSkippedContent = do
- tok <- munknownMacro <|> mcomment <|> memplyLine
- onToken tok
- return mempty
-
- where
-
- onToken :: PandocMonad m => ManToken -> ManParser m ()
- onToken (MUnknownMacro mname _) = do
- pos <- getPosition
- report $ SkippedContent ("Unknown macro: " ++ mname) pos
- onToken _ = return ()
+parseSkippedContent = mempty <$ (mcomment <|> memptyLine)
strToInlines :: RoffStr -> Inlines
strToInlines (s, fonts) = inner $ S.toList fonts where
@@ -514,7 +497,7 @@ parseInlines = do
parseCodeBlock :: PandocMonad m => ManParser m Blocks
parseCodeBlock = do
mmacro "nf"
- toks <- many (mstr <|> mline <|> mmaybeLink <|> memplyLine <|> munknownMacro <|> mcomment)
+ toks <- many (mstr <|> mline <|> mmaybeLink <|> memptyLine <|> mcomment)
mmacro "fi"
return $ codeBlock (removeFinalNewline $
intercalate "\n" . catMaybes $