From: Petter Reinholdtsen Date: Sun, 6 Sep 2020 09:40:06 +0000 (+0200) Subject: Improve book layout and set up for translation. X-Git-Tag: nb-printed-2021-01-24~484 X-Git-Url: https://pere.pagekite.me/gitweb/text-destroy-surveillance.git/commitdiff_plain/5903f7bb763268be9dcd780c98cdfff8cb0a146a?hp=18e645d3ce76516b350315083d2e7e300208df50 Improve book layout and set up for translation. --- diff --git a/Makefile b/Makefile index c0d4741..a84406a 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ DBLATEX_OPTS = \ -P double.sided=1 \ -P doc.collab.show=0 \ -P latex.output.revhistory=0 \ - -P draft.mode=yes -Pdraft.watermark=1 + -P draft.mode=yes -Pdraft.watermark=1 \ + -p pdf.xsl all: $(GENERATED) @@ -32,9 +33,24 @@ $(SOURCE).pdf: complete-book.xml Makefile $(SOURCE).xml: $(SOURCE).rst Makefile pandoc -s -o $@ $(PANDOC_OPTS) $(SOURCE).rst +po/$(SOURCE).pot: complete-book.xml + po4a-gettextize -f docbook -m complete-book.xml \ + -M UTF-8 -L UTF-8 \ + --package-name "How to Destroy Surveillance Capitalism" \ + --copyright-holder "Cory Doctorow" \ + --package-version "n/a" \ + | sed 's/CHARSET/UTF-8/' > $@.new && mv $@.new $@ +po/$(SOURCE).%.po: po/$(SOURCE).pot + po4a --no-translations --msgmerge-opt --no-location po4a.cfg + +$(SOURCE).nb.xml: po/$(SOURCE).nb.po complete-book.xml + po4a --translate-only $(SOURCE).nb.xml po4a.cfg +$(SOURCE).nb.pdf: $(SOURCE).nb.xml Makefile + dblatex $(DBLATEX_OPTS) $(SOURCE).nb.xml -o $@ + XMLLINTOPTS = --nonet --noout --xinclude --postvalid lint: book.xml xmllint $(XMLLINTOPTS) $^ clean: - $(RM) $(GENERATED) complete-book.xml + $(RM) *~ $(GENERATED) complete-book.xml diff --git a/pdf.xsl b/pdf.xsl new file mode 100644 index 0000000..86fc238 --- /dev/null +++ b/pdf.xsl @@ -0,0 +1,30 @@ + + + book + a4paper,openright,twoside + + + + % start of latex.begindocument + +% Trick to avoid many words sticking out of the right margin of the text. +\sloppy + +% The microtype package provides the ability to micromanage your +% typography. When invoked without any options it does some nice things +% like protruding punctuation over the edge of the right margin to make +% the margin appear smoother. Basically it makes your book look more +% professional with very little effort. It also has a ton of options if +% you want to micromanage even more. +\usepackage{microtype} + +% Make URLs in footnotes smaller to fit the long URLs +\usepackage{relsize} +\usepackage{hyperref} +\renewcommand*{\UrlFont}{\ttfamily\relsize{-2}} + +\begin{document} +% end of latex.begindocument + + + diff --git a/po4a.cfg b/po4a.cfg new file mode 100644 index 0000000..35d28b7 --- /dev/null +++ b/po4a.cfg @@ -0,0 +1,4 @@ +[po_directory] po + +[type: docbook] complete-book.xml $lang:$lang.xml \ + opt:"-M UTF-8 -k 0" opt_nb:"-L UTF-8"