jgm/pandoc — Issue #321: LaTeX abstract treated as content of role directive in ReST output
Author: ianhinder
Created: 2011-10-25 19:48:32+00:00
State: open

If I have an input file example.tex containing both an abstract and some mathematics:

> \documentclass{article}
> \begin{document}
> \begin{abstract}
> This is some abstract text
> \end{abstract}
> \begin{eqnarray}
> x^2+2x+1&=&0
> \end{eqnarray}
> \end{document}

and I convert this to ReST with pandoc,

> pandoc -s -w rst --toc example.tex -o example.rst

The output is

> .. role:: math(raw)
> :format: html latex

> This is some abstract text

> :math:`$$x^2+2x+1=0
> $$`

This fails to parse with rst2html:

> example.rst:1: (ERROR/3) Error in "role" directive:
> no content permitted.
>
> .. role:: math(raw)
> :format: html latex
>
> This is some abstract text
>
> example.rst:6: (ERROR/3) Unknown interpreted text role "math".

The problem is that the indented abstract is treated as the content of the role directive. The ReST specification says that empty comments can be used to explicitly terminate any previous directive before a block quote: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#block-quotes

If I add an explicit .. before the block quote (abstract), rst2html runs fine. Either the math role command should have an empty comment after it to allow indentation of subsequent elements, or the block quote should have one before it.