diff options
author | defanor <defanor@uberspace.net> | 2017-10-30 02:24:17 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-10-30 02:24:17 +0300 |
commit | 2489d6808500b0395546216a9c6a9f2785496f6f (patch) | |
tree | a7377401448e27d12ae18b42df8f0b1838461acf /Text/Pandoc/Readers | |
parent | b27e1f15a689b033d024d1791a8add301eed5a35 (diff) |
Handle Gopher+
By ignoring it.
Diffstat (limited to 'Text/Pandoc/Readers')
-rw-r--r-- | Text/Pandoc/Readers/Gopher.hs | 10 |
1 files changed, 8 insertions, 2 deletions
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. |