git.iko.soy/typeable/pandoc
on master help sign in
Org reader: disallow tables on list marker lines
c91f168Albert Krewinkel
src/Text/Pandoc/Readers/Org/Blocks.hs+4−3
@@ -721,10 +721,11 @@ data OrgTable = OrgTable
721
721
722table :: PandocMonad m => OrgParser m (F Blocks)
722table :: PandocMonad m => OrgParser m (F Blocks)
723table = try $ do
723table = 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
725 -- tables start at first non-space character on the line
725 -- tables start at first non-space character on the line
726− ctx <- orgStateParserContext <$> getState
726+ let isFirstInListItem st = (orgStateParserContext st == ListItemState) &&
727− guard (ctx == NullState)
727+ (orgStateLastPreCharPos st == Nothing)
728+ guard =<< not . isFirstInListItem <$> getState
728 blockAttrs <- blockAttributes
729 blockAttrs <- blockAttributes
729 lookAhead tableStart
730 lookAhead tableStart
730 do
731 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:
2```
2```
3% pandoc -f org
3% pandoc -f org
4- |something|
4- |something|
5+-
6+ |else|
5^D
7^D
6<ul>
8<ul>
7<li>|something|</li>
9<li>|something|</li>
10+<li><table>
11+<tbody>
12+<tr class="odd">
13+<td>else</td>
14+</tr>
15+</tbody>
16+</table></li>
8</ul>
17</ul>
9```
18```