diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-04-22 10:59:07 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-04-22 10:59:07 -0700 |
| commit | 281e2599dc56e837b06051a0bf1ea8b1511d107e (patch) | |
| tree | 1dfe3f69d9c0f3aab9bd7d50a09db64680e23c0a /src | |
| parent | f9b2ca7465e53e78fa70115a803d403b5c71bc82 (diff) | |
RIS reader: make parser more forgiving.
Allow blank lines after entries.
Allow entries with no space after the `-`, provided they
just have a newline, e.g. `DB -\n`.
Closes #8034.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/RIS.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/RIS.hs b/src/Text/Pandoc/Readers/RIS.hs index 27c92cec9..18ac60959 100644 --- a/src/Text/Pandoc/Readers/RIS.hs +++ b/src/Text/Pandoc/Readers/RIS.hs @@ -66,8 +66,7 @@ risLine = do key <- T.pack <$> count 2 (satisfy (\c -> isAsciiUpper c || isDigit c)) _ <- many1 spaceChar char '-' - _ <- many1 spaceChar - val <- anyLine + val <- (many1 spaceChar *> anyLine) <|> mempty <$ newline return (key, T.strip val) risSeparator :: PandocMonad m => RISParser m () @@ -76,7 +75,7 @@ risSeparator = do _ <- many1 spaceChar char '-' _ <- anyLine - return () + optional blanklines risRecord :: PandocMonad m => RISParser m [(Text, Text)] risRecord = manyTill risLine risSeparator |
