I am trying to convert an entire directory from html into markdown. The directory tree is quite tall, so there are files nested two and three levels down.
In answering this question, John MacFarlane suggested using the following Makefile
:
TXTDIR=sources
HTMLS=$(wildcard *.html)
MDS=$(patsubst %.html,$(TXTDIR)/%.markdown, $(HTMLS))
.PHONY : all
all : $(MDS)
$(TXTDIR) :
mkdir $(TXTDIR)
$(TXTDIR)/%.markdown : %.html $(TXTDIR)
pandoc -f html -t markdown -s $< -o $@
Now, this doesn't seem to go inside subdirectories. Is there any easy way to modify this so that it will process the entire tree?
I don't need this to be in make
. All I'm looking for is a way of getting a mirror of the initial directory where each html
file is replaced by the output of running pandoc
on that file.
(I suspect something along these lines should help, but I'm far from confident that I won't break things if I try to go at it on my own. I'm illiterate when it comes to GNU make
).)
make
, maybe you just try to write your own script in your favourite language, e.g. Python or Ruby? (sorry to not be of more help right now) – Cryptoclastic