Mallow
Mallow

Reputation: 864

Is it possible to import a pandoc document into another one?

I've been trying to figure out if there is a simple way to do this, and if not if there is a pandoc way to do this outside of using cat to combine files.

What I want to do is say I have the following set of files:

I would essential like to be able to write a pandoc document that can import the files above into itself and compile them as if they were in the document as well, without having to concatenate them in the shell first or without resorting to HTML links.

Something like:

% Gramps Research Document
% Mallow
% 2020.01.07

# Gramps Notes

This is a combination of all my notes into a single document

# Initial Gramps Installation and Backups

<import GRAMPS: How to Install>
<Import Gramps: How to Backup Tree.pandoc>

# Basic Information before entering data

<import Gramps: Geneology Basics about entering people.pandoc>


# Entering People

<import Gramps: How to Enter a person.pandoc>

# Entering Families

....

Typing the example above out reveals to me that maybe I would also need a mechanism that would deal with auto adjusting headers as well, but that could be a different story.

First I should know, is there a way to do a simulacrum of the example above where there is some sort of markup I can give a pandoc document so that the pandoc parser can directly import said files into the document based on what is in the document that combines these files?

If not I suppose that means it must be done with a custom script or filter, is there one out there that does what I'm hoping to do here?

Upvotes: 3

Views: 1159

Answers (1)

tarleb
tarleb

Reputation: 22659

The include-files Lua filter should do what you need. You'll need to download the include-files.lua file and pass it to pandoc via --lua-filter include-files.lua.

The syntax is

``` {.include}
GRAMPS: How to Install.md
```

Upvotes: 4

Related Questions