]> pere.pagekite.me Git - text-madewithcc.git/blob - Makefile
Translated using Weblate (Norwegian Bokmål)
[text-madewithcc.git] / Makefile
1 #
2 # As of October 2017, I'm doing some Spanish-specific adjustments to
3 # this Makefile; they should be generalized... But I'm taking a step at a time :)
4 # -GW
5 #
6 SOURCE=MadewithCreativeCommonsmostup-to-dateversion
7
8 # Versioning: I'm using the date on which I got the source document
9 # (2017-06-09), plus an incrementing local part, that *should*
10 # increase every time the generated Markdown is modified.
11 VERSION=20170609-2
12
13 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'
14 # --top-level-diversion is not available in pandoc in Jessie
15 # PANDOC_OPTS = -t docbook -f markdown+inline_notes
16
17 LANGS = es nl nb
18
19 all: pdf
20
21 distclean: clean
22 rm -f $(SOURCE).md
23 clean:
24 rm -f $(SOURCE).pdf $(SOURCE).xml
25 for LANG in $(LANGS); do \
26 rm -f $(SOURCE).$$LANG.pdf $(SOURCE).$$LANG.xml $(SOURCE).$$LANG.md ;\
27 done
28
29 $(SOURCE).md: $(SOURCE).odt fixup.rb
30 TEMP=`tempfile -p mwcc` && \
31 pandoc -f odt $(SOURCE).odt -t markdown > $$TEMP && \
32 ruby fixup.rb $$TEMP $(SOURCE).md && \
33 rm $$TEMP
34
35 pot: po/mwcc.pot po/*/mwcc.po
36 po/mwcc.pot: $(SOURCE).md
37 TEMP=`tempfile -p mwcc` && \
38 po4a-gettextize -f text -m $(SOURCE).md -p $$TEMP -M utf-8 --package-name 'Made with Creative Commons' --package-version $(VERSION) && \
39 echo '# MADE WITH CREATIVE COMMONS' > $@ && \
40 echo '# Copyright (C) 2017 by Creative Commons.' >> $@ && \
41 echo '# This file is published under a Creative Commons Attribution-ShareAlike license (CC BY-SA), version 4.0' >> $@ && \
42 echo '# Authors: Paul Stacey and Sarah Hinchliff Pearson' >> $@ && \
43 tail --lines=+5 $$TEMP >> $@ && \
44 rm $$TEMP
45 set -e; for LANG in po/*/mwcc.po; do \
46 echo -n $$LANG\ ; \
47 msgmerge $$LANG po/mwcc.pot -U ; \
48 done
49
50 $(SOURCE).es.md: $(SOURCE).md po/es/mwcc.po
51 po4a-translate -f text -m $(SOURCE).md -p po/es/mwcc.po -l $@ -l $@ -L utf8 -M utf8 -k 0
52
53 $(SOURCE).nb.md: $(SOURCE).md po/nb/mwcc.po
54 po4a-translate -f text -m $(SOURCE).md -p po/nb/mwcc.po -l $@ -l $@ -L utf8 -M utf8 -k 0
55
56 %.xml: %.md
57 pandoc -s -o $@ $(PANDOC_OPTS) $^
58 perl -p -i -e 's/!DOCTYPE article/!DOCTYPE book/ ; \
59 s!<(/?)article(info|)?>!<$$1book$$2>!' $@
60
61 pdf: $(SOURCE).pdf
62 %.pdf: %.tex
63 pdflatex $^
64 pdflatex $^
65
66 %.tex: %.xml
67 dblatex -t tex -b xetex $^
68 perl -p -i -e 's/\[latin1\]\{inputenc\}/[utf8]{inputenc}\n\\usepackage[spanish]{babel}/; \
69 s/\\setcounter\{tocdepth\}.*/\\setcounter{tocdepth}{1}/; \
70 s/\\setcounter\{secnumdepth\}.*/\\setcounter{secnumdepth}{-1}/; \
71 s/\\caption\\end/\\caption{} \\end/; \
72 s!\\maketitle!\\input{extra/es/cover.tex}!; \
73 s/\\author\{and\}/\\author{Paul Stacey \\and Sarah Hinchliff Pearson}/; \
74 s/\\DBKinditem\{\\writtenby\}\{and\}/\\DBKinditem{\writtenby}{Paul Stacey and Sarah Hinchliff Pearson}/; \
75 s/\\listoffigures//; \
76 s/\\part\{(Foreword|Prefacio|Introduction|Introducción)\}/\\chapter*{$$1} \\addcontentsline{toc}{chapter}{$$1}/; \
77 s/\\section\{(Notes|Notas)\}/\\section*{$$1}/; \
78 s/(Web links?|Vínculos Web)/\\section*{$$1}/; \
79 s/^\s*(Revenue model|Interview date|Interviewees?|(Modelo de ingresos|Fecha de la entrevista|Entrevistad(?:o|a|os|as)))/\\textbf{$$1}/;' $@
80 perl -p -i -e '$$work=1 if /chapter.Arduino/; $$work=0 if /chapter.(Bibliography|Bibliografía)/; \
81 next unless $$work; \
82 s/(\\label\{[-\.\wáéíóúñ]+\}\\hyperlabel\{[-\.\wáéíóúñ]+\}%)/$$1\n\\begin{quote}/i; \
83 s/(Profile written by.+|Perfil escrito por.+)/$$1\n\\end{quote}/' $@
84
85 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
86 lint: $(SOURCE).xml
87 xmllint $(XMLLINTOPTS) $^
88
89 .SUFFIXES: .xml .md