diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-03-08 15:36:48 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-03-08 15:45:00 +0100 |
commit | c91f168fc93f22b8c281fb2933052ff6da63d47b (patch) | |
tree | d4311e950934ba26728ec60def6d236c8e4511da | |
parent | 5487190d6981c442a27b3129523d6d48e3633c20 (diff) | |
download | pandoc-c91f168fc93f22b8c281fb2933052ff6da63d47b.tar.gz |
Org reader: disallow tables on list marker lines
Fixes: #3499
-rw-r--r-- | src/Text/Pandoc/Readers/Org/Blocks.hs | 7 | ||||
-rw-r--r-- | test/command/3499.md | 11 |
2 files changed, 14 insertions, 4 deletions
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 diff --git a/test/command/3499.md b/test/command/3499.md index e1c9093c4..ba9f03589 100644 --- a/test/command/3499.md +++ b/test/command/3499.md @@ -1,9 +1,18 @@ -Org-mode tables can't go in lists: +Org-mode tables can't be on the same line as list markers: ``` % pandoc -f org - |something| +- + |else| ^D <ul> <li>|something|</li> +<li><table> +<tbody> +<tr class="odd"> +<td>else</td> +</tr> +</tbody> +</table></li> </ul> ``` |