From ae846381c33866a6c5646d82da455182bca4fcc5 Mon Sep 17 00:00:00 2001 From: "Lucas V. R" Date: Thu, 3 Feb 2022 01:26:11 -0300 Subject: [PATCH] Org reader: allow comments above property drawer The Org Manual page at https://orgmode.org/manual/Property-Syntax.html says (as of 2022-02-03): "Property blocks defined before first headline needs to be located at the top of the buffer, allowing only comments above." This commit allows comments above. --- src/Text/Pandoc/Readers/Org/DocumentTree.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Text/Pandoc/Readers/Org/DocumentTree.hs b/src/Text/Pandoc/Readers/Org/DocumentTree.hs index ff86a533f..afa73f203 100644 --- a/src/Text/Pandoc/Readers/Org/DocumentTree.hs +++ b/src/Text/Pandoc/Readers/Org/DocumentTree.hs @@ -41,6 +41,7 @@ documentTree :: PandocMonad m -> OrgParser m (F Inlines) -> OrgParser m (F Headline) documentTree blocks inline = do + many commentLine properties <- option mempty propertiesDrawer initialBlocks <- blocks headlines <- sequence <$> manyTill (headline blocks inline 1) eof @@ -59,6 +60,9 @@ documentTree blocks inline = do , headlineContents = initialBlocks' , headlineChildren = headlines' } + where + commentLine :: Monad m => OrgParser m () + commentLine = commentLineStart <* anyLine -- | Create a tag containing the given string. toTag :: Text -> Tag