]> pere.pagekite.me Git - text-madewithcc.git/blobdiff - Makefile
Translated using Weblate (Norwegian Bokmål)
[text-madewithcc.git] / Makefile
index 293596adf63025eac973fce1b3e30cfd8cdcec44..85b7c7a7ce35d678ce4ecc6e4342814c9aad9fa6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,8 @@
+#
+# As of October 2017, I'm doing some Spanish-specific adjustments to
+# this Makefile; they should be generalized... But I'm taking a step at a time :)
+# -GW
+#
 SOURCE=MadewithCreativeCommonsmostup-to-dateversion
 
 # Versioning: I'm using the date on which I got the source document
@@ -5,9 +10,19 @@ SOURCE=MadewithCreativeCommonsmostup-to-dateversion
 # increase every time the generated Markdown is modified.
 VERSION=20170609-2
 
+PANDOC_OPTS = --top-level-division=part -t docbook -f markdown+inline_notes --variable 'author:Paul Stacey' --variable 'author:Sarah Hinchliff Pearson'  --variable 'title:Hecho con Creative Commons'
 # --top-level-diversion is not available in pandoc in Jessie
-PANDOCOPTS = --top-level-division=part -t docbook -f markdown+inline_notes
-PANDOCOPTS = -t docbook -f markdown+inline_notes
+# PANDOC_OPTS = -t docbook -f markdown+inline_notes
+
+LANGS = es nl nb
+
+all: pdf
+
+clean:
+       rm -f $(SOURCE).pdf $(SOURCE).xml $(SOURCE).md
+       for LANG in $(LANGS); do \
+           rm -f $(SOURCE).$$LANG.pdf $(SOURCE).$$LANG.xml $(SOURCE).$$LANG.md ;\
+        done
 
 $(SOURCE).md: $(SOURCE).odt fixup.rb
        TEMP=`tempfile -p mwcc` && \
@@ -34,11 +49,29 @@ $(SOURCE).es.md: $(SOURCE).md po/es/mwcc.po
        po4a-translate -f text -m $(SOURCE).md -p po/es/mwcc.po -l $@ -l $@ -L utf8 -M utf8 -k 20
 
 %.xml: %.md
-       pandoc -s -o $@ $(PANDOCOPTS) $^
+       pandoc -s -o $@ $(PANDOC_OPTS) $^
+       perl -p -i -e 's/!DOCTYPE article/!DOCTYPE book/ ; \
+               s!<(/?)article(info|)?>!<$$1book$$2>!' $@
 
 pdf: $(SOURCE).pdf
-%.pdf: %.xml
-       dblatex -b xetex $^
+%.pdf: %.tex
+       pdflatex $^
+       pdflatex $^
+
+%.tex: %.xml
+       dblatex -t tex -b xetex $^
+       perl -p -i -e 's/\[latin1\]\{inputenc\}/[utf8]{inputenc}\n\\usepackage[spanish]{babel}/; \
+               s/\\caption\\end/\\caption{} \\end/; \
+               s/\\author\{and\}/\\author{Paul Stacey \\and Sarah Hinchliff Pearson}/; \
+               s/\\DBKinditem\{\\writtenby\}\{and\}/\\DBKinditem{\writtenby}{Paul Stacey and Sarah Hinchliff Pearson}/; \
+               s/\\part\{(Prefacio|Introducción)\}/\\chapter*{$$1} \\addcontentsline{toc}{chapter}{$$1}/; \
+               s/\\section\{Notas\}/\\section*{Notas}/; \
+               s/(Vínculos Web)/\\section*{$$1}/; \
+               s/^\s*(Modelo de ingresos|Fecha de la entrevista|Entrevistad(?:o|a|os|as))/\\textbf{$$1}/;' $@
+       perl -p -i -e '$$work=1 if /chapter.Arduino/; $$work=0 if /chapter.Bibliografía/; \
+               next unless $$work; \
+               s/(\\label\{[-\.\wáéíóúñ]+\}\\hyperlabel\{[-\.\wáéíóúñ]+\}%)/$$1\n\\begin{quote}/i; \
+               s/(Perfil escrito por.+)/$$1\n\\end{quote}/' $@
 
 XMLLINTOPTS = --nonet --noout  --xinclude --postvalid
 lint: $(SOURCE).xml