aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Org/BlockStarts.hs4
-rw-r--r--test/Tests/Readers/Org/Block.hs12
2 files changed, 14 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Org/BlockStarts.hs b/src/Text/Pandoc/Readers/Org/BlockStarts.hs
index d1e13eb70..58db4f46c 100644
--- a/src/Text/Pandoc/Readers/Org/BlockStarts.hs
+++ b/src/Text/Pandoc/Readers/Org/BlockStarts.hs
@@ -92,7 +92,9 @@ metaLineStart :: Monad m => OrgParser m ()
metaLineStart = try $ skipSpaces <* string "#+"
commentLineStart :: Monad m => OrgParser m ()
-commentLineStart = try $ skipSpaces <* string "# "
+commentLineStart = try $
+ -- the first char after '#' must be a plain space character or a newline
+ skipSpaces <* string "#" <* lookAhead (oneOf " \n")
exampleLineStart :: Monad m => OrgParser m ()
exampleLineStart = () <$ try (skipSpaces *> string ": ")
diff --git a/test/Tests/Readers/Org/Block.hs b/test/Tests/Readers/Org/Block.hs
index f5ea66343..35fd4c1fa 100644
--- a/test/Tests/Readers/Org/Block.hs
+++ b/test/Tests/Readers/Org/Block.hs
@@ -73,13 +73,23 @@ tests =
"----- em and en dash" =?>
para "\8212\8211 em and en dash"
- , "Comment Block" =:
+ , testGroup "Comments"
+ [ "Comment Block" =:
T.unlines [ "#+BEGIN_COMMENT"
, "stuff"
, "bla"
, "#+END_COMMENT"] =?>
(mempty::Blocks)
+ , "Comment line" =:
+ T.unlines [ "# this is a comment" ] =?>
+ (mempty :: Blocks)
+
+ , "Empty comment line" =:
+ T.unlines [ " #" ] =?>
+ (mempty :: Blocks)
+ ]
+
, testGroup "Blocks and fragments"
[ "HTML block" =:
T.unlines [ "#+BEGIN_HTML"