From c91f168fc93f22b8c281fb2933052ff6da63d47b Mon Sep 17 00:00:00 2001
From: Albert Krewinkel <albert@zeitkraut.de>
Date: Wed, 8 Mar 2017 15:36:48 +0100
Subject: Org reader: disallow tables on list marker lines

Fixes: #3499
---
 src/Text/Pandoc/Readers/Org/Blocks.hs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
index 72d1f31dc..75019f74f 100644
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -721,10 +721,11 @@ data OrgTable = OrgTable
 
 table :: PandocMonad m => OrgParser m (F Blocks)
 table = try $ do
-  -- don't allow a table inside a list item; org requires that
+  -- don't allow a table on the first line of a list item; org requires that
   -- tables start at first non-space character on the line
-  ctx <- orgStateParserContext <$> getState
-  guard (ctx == NullState)
+  let isFirstInListItem st = (orgStateParserContext st == ListItemState) &&
+                             (orgStateLastPreCharPos st == Nothing)
+  guard =<< not . isFirstInListItem <$> getState
   blockAttrs <- blockAttributes
   lookAhead tableStart
   do
-- 
cgit v1.2.3