DCsunset / pandoc-include

A pandoc filter to allow file and header inclusion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reST directives are not executed in the included files

massoncl opened this issue · comments

Hi,

I have two reST files, let's call them A and B:

A.rst :

Heading
---------- 

.. figure:: imageA.png

$include B.rst

B.rst :

.. figure:: image.png

The ..figure line is inserted vertbatim in the output document, instead of being replaced by an image.

I'm new to pandoc, and I assume this issue arises because the filters run after the reST directives have been processed. Is there any workaround for this ?

Thanks !

Hello, can you show your command to compile this file? It could help me to reproduce this problem.

With the two files above, this command shows the problem (I added a figure directive to A.rst to show the difference):
pandoc A.rst -f rst -t latex --filter=pandoc-include

The resulting output I get is this:

\hypertarget{heading}{%
\section{Heading}\label{heading}}

\begin{figure}
\centering
\includegraphics{imageA.rst}
\caption{}
\end{figure}

.. figure:: imageB.png

The file B.rst has been included, but the figure directive remains, instead of being converted to a LaTeX figure as the first image.

This happens because this filter didn't properly handle other formats. The latest update adds automatic format deduction from the file's name. It also supports setting the format manually.

The next version of this package may not be published immediately since there are still some pending issues. If you need this feature now, you may try installing the development version.

Feel free to comment here if there's any problem. :)

I just tried the development version and I can confirm that it works on my test case. Thanks for the quick update !