Follow

makefile, pandoc 

After @RaoOfPhysics did it, I thought that I would share my too:
cryptpad.fr/code/#/2/code/view

Comments and suggestions welcome.

· · Web · 2 · 1 · 4

makefile, pandoc 

@twsh Very nice! Way more elaborate than mine. I’ll need to spend some time looking through this and see what ideas I can learn from it. Thanks for sharing it!

makefile, pandoc 

@RaoOfPhysics I moved some of the complexity from the headers of the documents into the makefile.

One thing I do differently is that I only make one type of output at a time. PDF, by default, because that's the most common.

makefile, pandoc 

@twsh @RaoOfPhysics looks very clean! here's the monstrosity I made for doing various things for my thesis: gist.github.com/fmoralesc/a60e (yes, i run `make wc` to get an estimate word count).

makefile, pandoc 

@okf @RaoOfPhysics I have a bash script for the word count.

I realised that I could use a pattern rule so that I don't have so many '$(input)'s. But I don't understand pattern rules, so I think it's safer not to.

makefile, pandoc 

@twsh @RaoOfPhysics yeah, better to understand what is going on that having something that 'looks nice' but is magic.

(btw, this is the update-tex-from-md script that my Makefile calls: gist.github.com/fmoralesc/4c44 It recompiles tex files depending on whether the source md files are modified. I also have it set up in a git hook so it runs after every commit. i should make the whole thing available once I finish the thesis revisions...)

makefile, pandoc 

@RaoOfPhysics @okf Not easily, as far as I can see. But I replaced rules like:

```
$(input:.md=.docx): $(input) $(bibliography) $(csl)
pandoc --lua-filter=date.lua --bibliography=$(bibliography) --csl=$(csl) --metadata=lang:$(lang) --output=$@ $(input)
```

with:

```
%.docx: %.md $(bibliography) $(csl)
pandoc --lua-filter=date.lua --bibliography=$(bibliography) --csl=$(csl) --metadata=lang:$(lang) --output=$@ $<
```

So, it's a general rule for making .docx from .md.

makefile, pandoc 

@twsh nice stuff!

@RaoOfPhysics it is also what I do in my Makefile for compiling standalone versions of chapters:

```
chapters/%:
make pandoc f=$(@:chapters%/=%); \
cd ./$(chaptersdir) ; \
BIBINPUTS=.. latexmk --pdf $(@:chapters/%=%).tex

```

Sign in to participate in the conversation
Scholar Social

Scholar Social is a microblogging platform for researchers, grad students, librarians, archivists, undergrads, academically inclined high schoolers, educators of all levels, journal editors, research assistants, professors, administrators—anyone involved in academia who is willing to engage with others respectfully.