aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas V. R <[email protected]>2022-02-03 01:26:11 -0300
committerAlbert Krewinkel <[email protected]>2022-02-06 23:08:27 +0100
commitae846381c33866a6c5646d82da455182bca4fcc5 (patch)
tree8c8f6047269c93d5aaca1cac294c33a2711b15a5
parent61f4771c55933042c891aa30816a286adb0fdd5d (diff)
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.
-rw-r--r--src/Text/Pandoc/Readers/Org/DocumentTree.hs4
1 files changed, 4 insertions, 0 deletions
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