]> pere.pagekite.me Git - text-madewithcc.git/blobdiff - Makefile
Translated using Weblate (Norwegian Bokmål)
[text-madewithcc.git] / Makefile
index 7a1c7a1263dbca21af1d48a701d98f33a6264a87..b0a37a408758b14f6b12d7ab6dd7c575f33071da 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -64,19 +64,20 @@ po/mwcc.pot: $(SOURCE).md
        rm $$TEMP
 
 po/*/mwcc.po: po/mwcc.pot
-       msgmerge $@ po/mwcc.pot -U
+       msgmerge --previous $@ po/mwcc.pot -U
        touch $@
 
 $(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 0
+       po4a-translate -f text -m $(SOURCE).md -p po/es/mwcc.po -l $@ -l $@ -L utf-8 -M utf-8 -k 0
 
 $(SOURCE).nb.md: $(SOURCE).md po/nb/mwcc.po
-       po4a-translate -f text -m $(SOURCE).md -p po/nb/mwcc.po -l $@ -l $@ -L utf8 -M utf8 -k 0
+       po4a-translate -f text -m $(SOURCE).md -p po/nb/mwcc.po -l $@ -l $@ -L utf-8 -M utf-8 -k 0
 
 %.xml: %.md
-       pandoc -s -o $@ $(PANDOC_OPTS) $^
-       perl -p -i -e 's/!DOCTYPE article/!DOCTYPE book/ ; \
-               s!<(/?)article(info|)?>!<$$1book$$2>!' $@
+       TEMP=`tempfile -p mwcc` && \
+         pandoc -s -o $$TEMP $(PANDOC_OPTS) $^ && \
+         ruby fixup-docbook.rb $$TEMP $@ && \
+         rm $$TEMP
 
 pdf: $(SOURCE).pdf
 %.pdf: %.tex
@@ -87,9 +88,12 @@ epub: $(SOURCE).epub
 %.epub: %.xml
        dbtoepub $^
 
+# Replace Unicode Hair Space (U+200A) with space, as &hairsp; is not
+# handled by LaTeX/dblatex, see <URL: https://bugs.debian.org/889603 >.
 %.tex: %.xml
        dblatex -t tex -b xetex $^
        perl -p -i -e 's/\[latin1\]\{inputenc\}/[utf8]{inputenc}\n\\usepackage[$(TEXLANG)]{babel}/; \
+               s/ / /g; \
                s/\\setcounter\{tocdepth\}.*/\\setcounter{tocdepth}{1}/; \
                s/\\setcounter\{secnumdepth\}.*/\\setcounter{secnumdepth}{-1}/; \
                s/\\caption\\end/\\caption{} \\end/; \
@@ -114,10 +118,16 @@ lint-es: $(SOURCE).nb.xml
 lint-nb: $(SOURCE).nb.xml
        xmllint $(XMLLINTOPTS) $^
 
+check-urls:
+       retval=0; for u in $$(perl -n -e'/<ulink url="(.+)"\/>/ && print "$$1\n"' MadewithCreativeCommonsmostup-to-dateversion.xml | sort -u); do \
+         HEAD -H "User-Agent: Docbook XML URL checker" "$$u" > /dev/null || echo "error fetching $$u"; retval=1; \
+       done; exit $$retval
+
 # Experimental build rule to test Docbook XSL + FOP processor 
 xsl-fo-%.pdf: %.xml
-       xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl $^ > $@.fo
-       fop $@.fo $@
+       xsltproc --output $(subst .pdf,.fo,$@) \
+         extra/stylesheet-fo.xsl $^; \
+       fop -fo $(subst .pdf,.fo,$@) -pdf $@
 
 status:
        for LANG in $(LANGS); do \