Hi all,

I am currently useing the recursive file transclusion with `include-files.lua` filter https://github.com/pandoc/lua-filters/tree/master/include-files
in full capacity (with `—citeproc` and `pandoc-crossref` afterwards!). It works great.

However: When converting to Latex we mostly end up with a monolithic huge file which is really hard to look at for further processing...

I wanted to know what options we would have to end up with an output folder with the same structure but all includes are replaced by e.g. /input{…} in the resulting .tex file:

```{.include no-inline}
chapter/A.md
chapter/B.md
```
would transform when the format is `latex` to something like (note: no-inline does not exist)

\input{<output-dir>/chapter/A.tex}
\input{<output-dir>/chapter/B.tex}

Solution 1 (External):

1. Convert with pandoc and all filters including `include-files.lua` to a monolithic `main.tex` file 
2. Split the main.tex by any means (python) into their parts by parsing start/end comment tags introduced by `include-files.lua`. I think a feature to start/end annotate each included path would be a handy thing. @albert.krewinkel: What do you think?

This is a nice solution as it completely decouples from pandoc processing

Solution 2 (Filter)

1 Adapt filter include-files.lua such that it parses (walk_block) the file and directly produces the output (how?) and then stores the output in
<new-path> := <output-dir>/<path>  where <path> is the same path but wit replace extension. (.tex). (attribute: 'no-inline')
2. Inserts RawInline(tex, "\inputt{<new-path>}”  … to replace the include code block.

Maybe another handy attribute: 'no-parse' which skips step 1. and uses the path directly as <new-path>. 
Two questions:
1. Can we produce output in the lua filter? Is there such functionality or do we need to call pandoc executable from Lua again which is possible trouble some as we need which flags, filters and other stuff needs to be set to produce correct output…?
2. Does such a solution (if possible) work with citeproc/crossref, doesnt it need the whole file?

Is there any other solution and what are the caveats which one needs to deal with when splitting up files as in Solution 2.

Thanks a lot for any input on that matter. Hopefully it will find a way to incorporate and give back the knowledge to the community in the project: https://github.com/gabyx/TechnicalMarkdown

BR Gabriel



--
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/786591B8-17BD-4B09-90A2-4EC1446F54C9%40gmail.com.