Thanks Matthew for looking into this so deeply! I will follow the issue on github.


On Friday, January 9, 2015 at 7:02:16 PM UTC-5, Matthew Pickering wrote:
I've done some more investigating...

When building from HEAD your example file actually fails to compile.
(This is because of the parseFromString changes John).

So this is what happens.. the macro parsing is all ok. The problem
comes when \FIG is parsed. \FIG is replaced with the following..

```
{
  \begin{figure}[h!]
    \centering
    \includegraphics[width=0.5\columnwidth,angle=0]{test.jpg}
    \caption{Test caption}
    \label{fig:test.jpg}
  \end{figure}
}
```

The next line now fails

```
parseFromString inlines transformed
```

The next step is into `grouped inline` which matches the first `{`.
Little does this function know, what is inside this block is actually
a block level element.

Next `inline` tries to match `\begin{figure}` but all paths fail so
the parse fails. Pre pandoc 1.13.3 (ie any released version of pandoc)
the `parseFromString` function succeeded even if it didn't consume all
the input (it just silently threw it away). Now in HEAD, it fails if
not all the input is consumed.

I have copied this message over onto the issue tracker[1].

I think the whole LaTeX reader is in need of a bit of an overhaul, the
macro inclusion code is quite difficult to follow and the error
messages uninformative (as well as the result being wrong!)

[1]: https://github.com/jgm/pandoc/issues/1866

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/18984b29-d0e1-4f6c-85a3-3de241601d2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.