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 :)
6 SOURCE=MadewithCreativeCommonsmostup-to-dateversion
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.
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
22 rm -f $(SOURCE).pdf $(SOURCE).xml $(SOURCE).md
23 for LANG in $(LANGS); do \
24 rm -f $(SOURCE).$$LANG.pdf $(SOURCE).$$LANG.xml $(SOURCE).$$LANG.md ;\
27 $(SOURCE).md: $(SOURCE).odt fixup.rb
28 TEMP=`tempfile -p mwcc` && \
29 pandoc -f odt $(SOURCE).odt -t markdown > $$TEMP && \
30 ruby fixup.rb $$TEMP $(SOURCE).md && \
33 pot: po/mwcc.pot po/*/mwcc.po
34 po/mwcc.pot: $(SOURCE).md
35 TEMP=`tempfile -p mwcc` && \
36 po4a-gettextize -f text -m $(SOURCE).md -p $$TEMP -M utf-8 --package-name 'Made with Creative Commons' --package-version $(VERSION) && \
37 echo '# MADE WITH CREATIVE COMMONS' > $@ && \
38 echo '# Copyright (C) 2017 by Creative Commons.' >> $@ && \
39 echo '# This file is published under a Creative Commons Attribution-ShareAlike license (CC BY-SA), version 4.0' >> $@ && \
40 echo '# Authors: Paul Stacey and Sarah Hinchliff Pearson' >> $@ && \
41 tail --lines=+5 $$TEMP >> $@ && \
43 set -e; for LANG in po/*/mwcc.po; do \
45 msgmerge $$LANG po/mwcc.pot -U ; \
48 $(SOURCE).es.md: $(SOURCE).md po/es/mwcc.po
49 po4a-translate -f text -m $(SOURCE).md -p po/es/mwcc.po -l $@ -l $@ -L utf8 -M utf8 -k 20
52 pandoc -s -o $@ $(PANDOC_OPTS) $^
53 perl -p -i -e 's/!DOCTYPE article/!DOCTYPE book/' $@
54 perl -p -i -e 's!<(/?)article(info|)?>!<$$1book$$2>!' $@
62 dblatex -t tex -b xetex $^
63 perl -p -i -e 's/\[latin1\]\{inputenc\}/[utf8]{inputenc}\n\\usepackage[spanish]{babel}/' $@
64 perl -p -i -e 's/\\caption\\end/\\caption{} \\end/' $@
65 perl -p -i -e 's/\\author\{and\}/\\author{Paul Stacey \\and Sarah Hinchliff Pearson}/' $@
66 perl -p -i -e 's/\\DBKinditem\{\\writtenby\}\{and\}/\\DBKinditem{\writtenby}{Paul Stacey and Sarah Hinchliff Pearson}/' $@
68 XMLLINTOPTS = --nonet --noout --xinclude --postvalid
70 xmllint $(XMLLINTOPTS) $^