Skip to content

Commit 31deb51

Browse files
committed
Use pandoc for PDF, EPUB, single HTML.
1 parent f78421c commit 31deb51

11 files changed

Lines changed: 36 additions & 71 deletions

File tree

Makefile

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SHELL := /bin/bash
1010

1111
all: $(LANGS)
1212

13-
$(LANGS): %: book-% book-%/default.css book-%.html book-%.pdf
13+
$(LANGS): %: book-% book-%/default.css book-%.html book-%.pdf book-%.epub
1414

1515
# The book consists of these text files in the following order:
1616

@@ -57,27 +57,29 @@ $(foreach l,$(LANGS),book-$(l)/default.css): book-%/default.css: book.css
5757
rsync book.css book-$*/default.css
5858

5959
$(foreach l,$(LANGS),book-$(l).html): book-%.html: book-%.xml
60-
xmlto -m custom-nochunks.xsl html-nochunks $^
61-
-tidy -utf8 -imq $@
60+
pandoc -s -f docbook -t html5 -o $@ $^
6261

63-
# Set SP_ENCODING to avoid "non SGML character" errors.
64-
# Can also do SP_ENCODING="UTF-8".
6562
$(foreach l,$(LANGS),book-$(l).pdf): book-%.pdf: book-%.xml
66-
if [ $* = zh_cn -o $* = zh_tw ]; then \
67-
if ! [ -f fop-$*.xsl ]; then wget -q http://bestrecords.net/fop/fop-$*.xsl; fi; \
68-
if ! [ -f fop-$*.xconf ]; then wget -q http://bestrecords.net/fop/fop-$*.xconf; fi; \
69-
xmlto -m fop-$*.xsl --with-fop -p "-c `pwd`/fop-$*.xconf" pdf book-$*.xml ;\
70-
elif [ $* = vi ] ; then \
71-
xsltproc --encoding utf-8 fop-vi.xsl book-$*.xml > book-$*.fo; \
72-
fop -c fop-vi.xconf -fo book-$*.fo -pdf book-$*.pdf; \
73-
else \
74-
SP_ENCODING="XML" docbook2pdf book-$*.xml; \
75-
fi
63+
pandoc -s -f docbook -o $@ --latex-engine xelatex $^
64+
65+
book-ru.pdf: book-ru.xml
66+
pandoc -s -f docbook -o $@ --latex-engine xelatex -V mainfont='DejaVuSansMono' $^
67+
68+
book-uk.pdf: book-uk.xml
69+
pandoc -s -f docbook -o $@ --latex-engine xelatex -V mainfont='DejaVuSansMono' $^
70+
71+
book-ko.pdf: book-ko.xml
72+
pandoc -s -f docbook -o $@ --latex-engine xelatex -V CJKmainfont='WenQuanYi Micro Hei Mono' $^
73+
74+
book-zh_cn.pdf: book-zh_cn.xml
75+
pandoc -s -f docbook -o $@ --latex-engine xelatex -V CJKmainfont='WenQuanYi Micro Hei Mono' $^
76+
77+
book-zh_tw.pdf: book-zh_tw.xml
78+
pandoc -s -f docbook -o $@ --latex-engine xelatex -V CJKmainfont='WenQuanYi Micro Hei Mono' $^
79+
80+
$(foreach l,$(LANGS),book-$(l).epub): book-%.epub: book-%.xml
81+
pandoc -s -f docbook -o $@ $^
7682

7783
clean:
7884
-rm -rf $(foreach l,$(LANGS),book-$(l).pdf book-$(l).xml book-$(l).html book-$(l)) \
7985
*.fo *.log *.out *.aux conf
80-
81-
distclean: clean
82-
-rm -rfv fop fop-zh*
83-

custom-html.xsl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
<xsl:param name="html.stylesheet" select="'default.css'"/>
1616

1717
<xsl:template name="user.footer.navigation">
18-
<script type="text/javascript" src="find_selflink.js"></script>
19-
<script type="text/javascript">
20-
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
21-
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
22-
</script>
23-
<script type="text/javascript">
24-
var pageTracker = _gat._getTracker("UA-1901330-2");
25-
pageTracker._initData();
26-
pageTracker._trackPageview();
18+
<!-- Google Analytics -->
19+
<script>
20+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
21+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
22+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
23+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
24+
ga('create', 'UA-1901330-2', 'auto');
25+
ga('send', 'pageview');
2726
</script>
27+
<!-- End Google Analytics -->
2828
</xsl:template>
2929

3030
</xsl:stylesheet>

custom-nochunks.xsl

Lines changed: 0 additions & 8 deletions
This file was deleted.

en/preface.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Rather than go into details, we provide rough instructions for particular effect
2828

2929
- link:book.html[Single webpage]: barebones HTML, with no CSS.
3030
- link:book.pdf[PDF file]: printer-friendly.
31+
- link:book.epub[EPUB file]: E-reader-friendly.
3132
- 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].
3233
- 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.
3334

@@ -58,8 +59,6 @@ repository, and can be obtained by typing:
5859
or from one of the mirrors:
5960

6061
$ git clone git://github.com/blynn/gitmagic.git
61-
$ git clone git://gitorious.org/gitmagic/mainline.git
62-
$ git clone https://code.google.com/p/gitmagic/
6362
$ git clone git://git.assembla.com/gitmagic.git
6463
$ git clone git@bitbucket.org:blynn/gitmagic.git
6564

es/preface.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ En lugar de ser detallados, proveemos instrucciones generales para efectos parti
1212

1313
.Otras ediciones
1414

15-
- http://docs.google.com/View?id=dfwthj68_675gz3bw8kj[Traducción al chino]: por JunJie, Meng y JiangWei.
15+
- link:/~blynn/gitmagic/intl/zh_cn/[Traducción al chino]: por JunJie, Meng y JiangWei.
1616
- link:book.html[Una única página]: HTML simple, sin CSS.
1717
- link:book.pdf[Archivo PDF]: Listo para imprimir.
1818
- 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].

fop-vi.xconf

Lines changed: 0 additions & 11 deletions
This file was deleted.

fop-vi.xsl

Lines changed: 0 additions & 17 deletions
This file was deleted.

fr/preface.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ recettes pour répondre à vos besoins.
2323

2424
.Traductions
2525

26-
- http://docs.google.com/View?id=dfwthj68_675gz3bw8kj[Chinois
26+
- link:/~blynn/gitmagic/intl/zh_cn/[Chinois
2727
(Simplifié)]&#160;: par JunJie, Meng et JiangWei.
2828

2929
- link:/~blynn/gitmagic/intl/fr/[Française]&#160;: par Alexandre Garel, Paul

makeover

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ gawk '
2929
# For every file except the index...
3030
for FILE in $BOOKDIR/*.html
3131
do
32-
sed '/<title>/a <link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">' -i $FILE
32+
sed '/<title>/a <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">' -i $FILE
3333
if [ $FILE != "$BOOKDIR/index.html" ]
3434
then
3535
# Prepend "Git Magic - " to titles of all pages.

ru/preface.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ http://git.or.cz/[Git] это швейцарский нож управления
2020

2121
.Переводы
2222

23-
- http://docs.google.com/View?id=dfwthj68_675gz3bw8kj[ Китайский (упрощенный)]: JunJie, Meng и JiangWei.
23+
- link:/~blynn/gitmagic/intl/zh_cn/[Китайский (упрощенный)]: JunJie, Meng и JiangWei.
2424
- link:/~blynn/gitmagic/intl/es/[Испанский]: Rodrigo Toledo.
2525
- link:/~blynn/gitmagic/intl/de/[Немецкий]: Benjamin Bellee и Armin Stebich. Armin также разместил http://gitmagic.lordofbikes.de/[немецкий перевод на его сайте].
2626
- link:/~blynn/gitmagic/intl/ru/[Русский]: Тихон Тарнавский, Михаил Дымсков и другие.

0 commit comments

Comments
 (0)