[tor-commits] [user-manual/master] Add half-working PDF build using mal2latex

lunar at torproject.org lunar at torproject.org
Thu May 15 21:47:28 UTC 2014


commit bd0410a31c6e6a57643c5f088a737d6228164257
Author: Lunar <lunar at torproject.org>
Date:   Thu May 15 23:47:12 2014 +0200

    Add half-working PDF build using mal2latex
---
 .gitignore  |    2 ++
 Makefile.am |   39 ++++++++++++++++++++++++++++++++-------
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
index 385f555..ba2dcf1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 #*
 
 /html
+/pdf
 /tor-browser-version.txt
 
 /tor-browser-user-manual.pot
@@ -12,6 +13,7 @@
 /[a-z][a-z]_[A-Z][A-Z]/*.mo
 /[a-z][a-z]_[A-Z][A-Z]/*.stamp
 /[a-z][a-z]_[A-Z][A-Z]/*.page
+/media-symlinks.stamp
 
 /Makefile
 /Makefile.in
diff --git a/Makefile.am b/Makefile.am
index 5f02d4e..6980dba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
 @YELP_HELP_RULES@
 
+# XXX: turn into ./configure option
+MAL2LATEX = ../mal2latex
 HELP_ID = tor-browser-user-manual
 HELP_FILES = $(shell cd C && git ls-files '*.page')
 HELP_MEDIA = $(shell cd C && git ls-files 'media')
@@ -7,22 +9,44 @@ HELP_PLATFORMS = windows macosx linux
 HELP_LINGUAS = ar de es fa fr it ko nl pl pt_PT ru tr vi zh_CN
 
 .PHONY: html
-html: all
+html: all media-symlinks.stamp
 	set -e && \
 		for lc in C $(HELP_LINGUAS); do \
-			for media in $(HELP_MEDIA); do \
-				if ! [ -f $$lc/$$media ]; then \
-					mkdir -p $$(dirname $$lc/$$media); \
-					ln -nsf ../../C/$$media $$lc/$$media; \
-				fi; \
-			done; \
 			for platform in $(HELP_PLATFORMS); do \
 				mkdir -p html/$$platform/$$lc; \
 				yelp-build html -x platform-$$platform.xslt \
 						-o html/$$platform/$$lc $$lc; \
 			done; \
+		done
+
+.PHONY: pdf
+pdf: all media-symlinks.stamp
+	set -e && \
+		for lc in C $(HELP_LINGUAS); do \
+			for platform in $(HELP_PLATFORMS); do \
+				PDF_DIR=pdf/$$platform/$$lc; \
+				LATEX_FILE=$(HELP_ID)-$$lc.latex; \
+				mkdir -p $$PDF_DIR; \
+				yelp-build cache -o $$PDF_DIR/index.cache $$lc; \
+				xsltproc --xinclude \
+					$(MAL2LATEX)/mal2latex.xsl $$PDF_DIR/index.cache \
+					> $$PDF_DIR/$$LATEX_FILE; \
+				(cd $$PDF_DIR && lualatex $$LATEX_FILE); \
+			done; \
 		done;
 
+media-symlinks.stamp: all
+	set -e && \
+		for lc in C $(HELP_LINGUAS); do \
+			for media in $(HELP_MEDIA); do \
+				if ! [ -f $$lc/$$media ]; then \
+					mkdir -p $$(dirname $$lc/$$media); \
+					ln -nsf ../../C/$$media $$lc/$$media; \
+				fi; \
+			done; \
+		done
+	touch media-symlinks.stamp
+
 clean:
 	set -e && \
 		for lc in C $(HELP_LINGUAS); do \
@@ -36,3 +60,4 @@ clean:
 
 distclean-local:
 	rm -rf html
+	rm -rf pdf



More information about the tor-commits mailing list