]> pere.pagekite.me Git - text-madewithcc.git/blobdiff - Makefile
Reflow XMl with xmllint after generating it, to make sure it get predictable indentation.
[text-madewithcc.git] / Makefile
index 7cea8fd92a97f857b787e00cb6e2e1ced01da3ee..286d9349fec92beb2128d31a6b36657488aed16a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,10 +24,10 @@ all: pdf epub
 
 distclean: clean
        rm -f $(SOURCE).md
+clean:
        for LANG in $(LANGS); do \
            rm -f $(SOURCE).$$LANG.md ;\
        done
-clean:
        for EXT in aux cb cb2 glo idx lof log tex toc xml pdf epub; do \
            rm -f $(SOURCE).$$EXT ;\
            for LANG in $(LANGS); do \
@@ -80,13 +80,20 @@ $(SOURCE).xml: $(SOURCE).md fixup-docbook.rb
          pandoc -s -o $$TEMP $(PANDOC_OPTS) $(SOURCE).md && \
          ruby fixup-docbook.rb $$TEMP $@ && \
          rm $$TEMP
+       xmllint --format $@ > $@.new && mv $@.new $@
 
 pdf: $(SOURCE).pdf
+       for LANG in $(LANGS); do \
+           $(MAKE) $(SOURCE).$$LANG.pdf ; \
+       done
 %.pdf: %.tex
        pdflatex $^
        pdflatex $^
 
 epub: $(SOURCE).epub
+       for LANG in $(LANGS); do \
+           $(MAKE) $(SOURCE).$$LANG.epub ; \
+       done
 %.epub: %.xml
        dbtoepub $^
 
@@ -95,12 +102,7 @@ DBLATEX_OPTS = -T simple -t tex -b xetex -p extra/pdf.xsl
 # handled by LaTeX/dblatex, see <URL: https://bugs.debian.org/889603 >.
 %.tex: %.xml
        dblatex $(DBLATEX_OPTS) $^
-       perl -p -i -e 's/\\caption\\end/\\caption{} \\end/; \
-               s/ / /g; \
-               s/\\chapter\{(Colophon|Dedication)\}/\\chapter*{}/; \
-               s/\\chapter\{(Foreword|Prefacio|Forord|Introduction|Introducción|Introduksjon)\}/\\chapter*{$$1} \\addcontentsline{toc}{chapter}{$$1}/; \
-               s/\\section\{(Notes|Notas)\}/\\section*{$$1}/; \
-               s/(Web links?|Vínculos Web)/\\section*{$$1}/;' $@
+       perl -p -i -e 's/ / /g' $@
 
 XMLLINTOPTS = --nonet --noout  --xinclude --postvalid
 lint: $(SOURCE).xml