diff options
| author | John MacFarlane <[email protected]> | 2022-10-27 22:04:46 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-27 22:04:46 -0700 |
| commit | e9b3636bc113192b14b21049c43b118baf306e9e (patch) | |
| tree | 460ad1ce4ed52d8cca70659bdc1ec0cccc7d5c25 | |
| parent | 999916642c9adcf3d02eb2e9498cc520d36612d2 (diff) | |
Don't fail on inline metadata beginning with newline.
Closes #8358.
| -rw-r--r-- | src/Text/Pandoc/Readers/Metadata.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Metadata.hs b/src/Text/Pandoc/Readers/Metadata.hs index 05c1abc75..209c3ec6f 100644 --- a/src/Text/Pandoc/Readers/Metadata.hs +++ b/src/Text/Pandoc/Readers/Metadata.hs @@ -82,14 +82,18 @@ normalizeMetaValue pMetaValue x = -- not end in a newline, but a "block" set off with -- `|` or `>` will. if "\n" `T.isSuffixOf` (T.dropWhileEnd isSpaceChar x) -- see #6823 - then parseFromString' pMetaValue (x <> "\n") - else parseFromString' asInlines x + then parseFromString' pMetaValue (x <> "\n\n") + else parseFromString' asInlines (T.dropWhile isSpaceOrNlChar x) + -- see #8358 where asInlines = fmap b2i <$> pMetaValue b2i (MetaBlocks bs) = MetaInlines (blocksToInlines bs) b2i y = y isSpaceChar ' ' = True isSpaceChar '\t' = True isSpaceChar _ = False + isSpaceOrNlChar '\r' = True + isSpaceOrNlChar '\n' = True + isSpaceOrNlChar c = isSpaceChar c yamlToMetaValue :: (PandocMonad m, HasLastStrPosition st) => ParsecT Sources st m (Future st MetaValue) |
