From 31deb515cf2523a623bc2ec29f609dfef82cdd18 Mon Sep 17 00:00:00 2001 From: Ben Lynn Date: Mon, 9 Apr 2018 23:38:19 -0700 Subject: [PATCH] Use pandoc for PDF, EPUB, single HTML. --- Makefile | 40 +++++++++++++++++++++------------------- custom-html.xsl | 18 +++++++++--------- custom-nochunks.xsl | 8 -------- en/preface.txt | 3 +-- es/preface.txt | 2 +- fop-vi.xconf | 11 ----------- fop-vi.xsl | 17 ----------------- fr/preface.txt | 2 +- makeover | 2 +- ru/preface.txt | 2 +- uk/preface.txt | 2 +- 11 files changed, 36 insertions(+), 71 deletions(-) delete mode 100644 custom-nochunks.xsl delete mode 100644 fop-vi.xconf delete mode 100644 fop-vi.xsl diff --git a/Makefile b/Makefile index 66e22fb..fe25ef2 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ SHELL := /bin/bash all: $(LANGS) -$(LANGS): %: book-% book-%/default.css book-%.html book-%.pdf +$(LANGS): %: book-% book-%/default.css book-%.html book-%.pdf book-%.epub # The book consists of these text files in the following order: @@ -57,27 +57,29 @@ $(foreach l,$(LANGS),book-$(l)/default.css): book-%/default.css: book.css rsync book.css book-$*/default.css $(foreach l,$(LANGS),book-$(l).html): book-%.html: book-%.xml - xmlto -m custom-nochunks.xsl html-nochunks $^ - -tidy -utf8 -imq $@ + pandoc -s -f docbook -t html5 -o $@ $^ -# Set SP_ENCODING to avoid "non SGML character" errors. -# Can also do SP_ENCODING="UTF-8". $(foreach l,$(LANGS),book-$(l).pdf): book-%.pdf: book-%.xml - if [ $* = zh_cn -o $* = zh_tw ]; then \ - if ! [ -f fop-$*.xsl ]; then wget -q http://bestrecords.net/fop/fop-$*.xsl; fi; \ - if ! [ -f fop-$*.xconf ]; then wget -q http://bestrecords.net/fop/fop-$*.xconf; fi; \ - xmlto -m fop-$*.xsl --with-fop -p "-c `pwd`/fop-$*.xconf" pdf book-$*.xml ;\ - elif [ $* = vi ] ; then \ - xsltproc --encoding utf-8 fop-vi.xsl book-$*.xml > book-$*.fo; \ - fop -c fop-vi.xconf -fo book-$*.fo -pdf book-$*.pdf; \ - else \ - SP_ENCODING="XML" docbook2pdf book-$*.xml; \ - fi + pandoc -s -f docbook -o $@ --latex-engine xelatex $^ + +book-ru.pdf: book-ru.xml + pandoc -s -f docbook -o $@ --latex-engine xelatex -V mainfont='DejaVuSansMono' $^ + +book-uk.pdf: book-uk.xml + pandoc -s -f docbook -o $@ --latex-engine xelatex -V mainfont='DejaVuSansMono' $^ + +book-ko.pdf: book-ko.xml + pandoc -s -f docbook -o $@ --latex-engine xelatex -V CJKmainfont='WenQuanYi Micro Hei Mono' $^ + +book-zh_cn.pdf: book-zh_cn.xml + pandoc -s -f docbook -o $@ --latex-engine xelatex -V CJKmainfont='WenQuanYi Micro Hei Mono' $^ + +book-zh_tw.pdf: book-zh_tw.xml + pandoc -s -f docbook -o $@ --latex-engine xelatex -V CJKmainfont='WenQuanYi Micro Hei Mono' $^ + +$(foreach l,$(LANGS),book-$(l).epub): book-%.epub: book-%.xml + pandoc -s -f docbook -o $@ $^ clean: -rm -rf $(foreach l,$(LANGS),book-$(l).pdf book-$(l).xml book-$(l).html book-$(l)) \ *.fo *.log *.out *.aux conf - -distclean: clean - -rm -rfv fop fop-zh* - diff --git a/custom-html.xsl b/custom-html.xsl index 8ca6969..0753e78 100644 --- a/custom-html.xsl +++ b/custom-html.xsl @@ -15,16 +15,16 @@ - - - + diff --git a/custom-nochunks.xsl b/custom-nochunks.xsl deleted file mode 100644 index 8871c4b..0000000 --- a/custom-nochunks.xsl +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/en/preface.txt b/en/preface.txt index 42bd2df..0691b9a 100644 --- a/en/preface.txt +++ b/en/preface.txt @@ -28,6 +28,7 @@ Rather than go into details, we provide rough instructions for particular effect - link:book.html[Single webpage]: barebones HTML, with no CSS. - link:book.pdf[PDF file]: printer-friendly. + - link:book.epub[EPUB file]: E-reader-friendly. - http://packages.debian.org/gitmagic[Debian package], http://packages.ubuntu.com/gitmagic[Ubuntu package]: get a fast and local copy of this site. Handy http://csdcf.stanford.edu/status/[when this server is offline]. - http://www.amazon.com/Git-Magic-Ben-Lynn/dp/1451523343/[Physical book [Amazon.com]]: 64 pages, 15.24cm x 22.86cm, black and white. Handy when there is no electricity. @@ -58,8 +59,6 @@ repository, and can be obtained by typing: or from one of the mirrors: $ git clone git://github.com/blynn/gitmagic.git - $ git clone git://gitorious.org/gitmagic/mainline.git - $ git clone https://code.google.com/p/gitmagic/ $ git clone git://git.assembla.com/gitmagic.git $ git clone git@bitbucket.org:blynn/gitmagic.git diff --git a/es/preface.txt b/es/preface.txt index ca175be..1ad9064 100644 --- a/es/preface.txt +++ b/es/preface.txt @@ -12,7 +12,7 @@ En lugar de ser detallados, proveemos instrucciones generales para efectos parti .Otras ediciones - - http://docs.google.com/View?id=dfwthj68_675gz3bw8kj[Traducción al chino]: por JunJie, Meng y JiangWei. + - link:/~blynn/gitmagic/intl/zh_cn/[Traducción al chino]: por JunJie, Meng y JiangWei. - link:book.html[Una única página]: HTML simple, sin CSS. - link:book.pdf[Archivo PDF]: Listo para imprimir. - http://packages.debian.org/search?searchon=names&keywords=gitmagic[Paquete gitmagic para Debian]: Consigue una copia rápida y local de este sitio. http://packages.ubuntu.com/jaunty/gitmagic[Paquete para Ubuntu (Jaunty Jackalope)] también disponible. Útil http://csdcf.stanford.edu/status/[cuando este servidor está offline para mantenimiento]. diff --git a/fop-vi.xconf b/fop-vi.xconf deleted file mode 100644 index 97972ff..0000000 --- a/fop-vi.xconf +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - /usr/share/fonts/truetype/ttf-dejavu/ - - - - - diff --git a/fop-vi.xsl b/fop-vi.xsl deleted file mode 100644 index 7558fd3..0000000 --- a/fop-vi.xsl +++ /dev/null @@ -1,17 +0,0 @@ - - - - - -DejaVu Serif -DejaVu Sans ExtraLight -DejaVu Serif Bold - - - diff --git a/fr/preface.txt b/fr/preface.txt index 17ced1f..d94d525 100644 --- a/fr/preface.txt +++ b/fr/preface.txt @@ -23,7 +23,7 @@ recettes pour répondre à vos besoins. .Traductions - - http://docs.google.com/View?id=dfwthj68_675gz3bw8kj[Chinois + - link:/~blynn/gitmagic/intl/zh_cn/[Chinois (Simplifié)] : par JunJie, Meng et JiangWei. - link:/~blynn/gitmagic/intl/fr/[Française] : par Alexandre Garel, Paul diff --git a/makeover b/makeover index c3572de..f945986 100755 --- a/makeover +++ b/makeover @@ -29,7 +29,7 @@ gawk ' # For every file except the index... for FILE in $BOOKDIR/*.html do - sed '//a <link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">' -i $FILE + sed '/<title>/a <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">' -i $FILE if [ $FILE != "$BOOKDIR/index.html" ] then # Prepend "Git Magic - " to titles of all pages. diff --git a/ru/preface.txt b/ru/preface.txt index 3feae48..de5d6f1 100644 --- a/ru/preface.txt +++ b/ru/preface.txt @@ -20,7 +20,7 @@ http://git.or.cz/[Git] это швейцарский нож управления .Переводы - - http://docs.google.com/View?id=dfwthj68_675gz3bw8kj[ Китайский (упрощенный)]: JunJie, Meng и JiangWei. + - link:/~blynn/gitmagic/intl/zh_cn/[Китайский (упрощенный)]: JunJie, Meng и JiangWei. - link:/~blynn/gitmagic/intl/es/[Испанский]: Rodrigo Toledo. - link:/~blynn/gitmagic/intl/de/[Немецкий]: Benjamin Bellee и Armin Stebich. Armin также разместил http://gitmagic.lordofbikes.de/[немецкий перевод на его сайте]. - link:/~blynn/gitmagic/intl/ru/[Русский]: Тихон Тарнавский, Михаил Дымсков и другие. diff --git a/uk/preface.txt b/uk/preface.txt index 8b14f9d..99748d6 100644 --- a/uk/preface.txt +++ b/uk/preface.txt @@ -14,7 +14,7 @@ http://git.or.cz/[Git] — це швейцарський ніж керуванн - link:/~blynn/gitmagic/intl/vi/[В'єтнамська]: Trần Ngọc Quân; також http://vnwildman.users.sourceforge.net/gitmagic/[розміщено на його вебсайті]. - link:/~blynn/gitmagic/intl/es/[Іспанська]: Rodrigo Toledo та Ariset Llerena Tapia. - - http://docs.google.com/View?id=dfwthj68_675gz3bw8kj[Китайська (спрощена)]: JunJie, Meng та JiangWei. Конвертовано у link:/~blynn/gitmagic/intl/zh_tw/[Традиційна китайська] via +cconv -f UTF8-CN -t UTF8-TW+. + - link:/\~blynn/gitmagic/intl/zh_cn/[Китайська (спрощена)]: JunJie, Meng та JiangWei. Конвертовано у link:/~blynn/gitmagic/intl/zh_tw/[Традиційна китайська] via +cconv -f UTF8-CN -t UTF8-TW+. - link:/~blynn/gitmagic/intl/de/[Німецька]: Benjamin Bellee і Armin Stebich. Armin також розмістив http://gitmagic.lordofbikes.de/[німецький переклад на своєму сайті]. - http://www.slideshare.net/slide_user/magia-git[Португальська]: Leonardo Siqueira Rodrigues [http://www.slideshare.net/slide_user/magia-git-verso-odt[в форматі ODT]]. - link:/~blynn/gitmagic/intl/ru/[Російська]: Тихон Тарнавский, Михаил Дымсков і інші. -- 2.11.4.GIT