From 2489d6808500b0395546216a9c6a9f2785496f6f Mon Sep 17 00:00:00 2001 From: defanor Date: Mon, 30 Oct 2017 02:24:17 +0300 Subject: Handle Gopher+ By ignoring it. --- Text/Pandoc/Readers/Gopher.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Text/Pandoc') diff --git a/Text/Pandoc/Readers/Gopher.hs b/Text/Pandoc/Readers/Gopher.hs index 694720d..3909e3d 100644 --- a/Text/Pandoc/Readers/Gopher.hs +++ b/Text/Pandoc/Readers/Gopher.hs @@ -37,7 +37,7 @@ pInfo = do -- entry. pLink :: Parser [Inline] pLink = do - t <- alphaNum + t <- anyChar name <- manyTill unascii tab selector <- manyTill unascii tab host <- manyTill unascii tab @@ -51,8 +51,14 @@ pLastLine :: Parser () -- sometimes LF is used instead of CRLF. pLastLine = optional (optional endOfLine *> char '.' *> endOfLine) *> eof +-- | Parses end-of-line, skipping Gopher+ extensions if present. +pEOL :: Parser () +pEOL = (endOfLine *> pure ()) + <|> (tab >> char '+' >> manyTill anyChar endOfLine *> pure ()) + +-- | Parses a directory. pDirEntries :: Parser [Inline] -pDirEntries = concat <$> manyTill (choice [pInfo, pLink] <* endOfLine) pLastLine +pDirEntries = concat <$> manyTill (choice [pInfo, pLink] <* pEOL) pLastLine -- | Reads Gopher directory entries, falls back to plain text on -- failure. -- cgit v1.2.3