git.iko.soy/typeable/pandoc
on master help sign in
Org reader: disallow tables on list marker lines

Fixes: #3499

commitc91f168fc93f22b8c281fb2933052ff6da63d47b authorAlbert Krewinkel <albert@zeitkraut.de> dateWed 8 Mar 2017, 15:36 (10 years ago) parent5487190
2 files changed+14−4
src/Text/Pandoc/Readers/Org/Blocks.hs+4−3 test/command/3499.md+10−1
src/Text/Pandoc/Readers/Org/Blocks.hs+4−3
@@ -721,10 +721,11 @@ data OrgTable = OrgTable
721721
722722table :: PandocMonad m => OrgParser m (F Blocks)
723723table = try $ do
724− -- don't allow a table inside a list item; org requires that
724+ -- don't allow a table on the first line of a list item; org requires that
725725 -- tables start at first non-space character on the line
726− ctx <- orgStateParserContext <$> getState
727− guard (ctx == NullState)
726+ let isFirstInListItem st = (orgStateParserContext st == ListItemState) &&
727+ (orgStateLastPreCharPos st == Nothing)
728+ guard =<< not . isFirstInListItem <$> getState
728729 blockAttrs <- blockAttributes
729730 lookAhead tableStart
730731 do
test/command/3499.md+10−1
@@ -1,9 +1,18 @@
1−Org-mode tables can't go in lists:
1+Org-mode tables can't be on the same line as list markers:
22```
33% pandoc -f org
44- |something|
5+-
6+ |else|
57^D
68<ul>
79<li>|something|</li>
10+<li><table>
11+<tbody>
12+<tr class="odd">
13+<td>else</td>
14+</tr>
15+</tbody>
16+</table></li>
817</ul>
918```