]> pere.pagekite.me Git - text-free-culture-lessig.git/blobdiff - Makefile
Translate two more.
[text-free-culture-lessig.git] / Makefile
index f708976d232d384e3f1c39045c6755256485a153..3f5413622206f2e9ccfaef184bc2e630cfe2aaae 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,23 +8,37 @@ url = http://www.sslug.dk/~chlor/lessig/freeculture.sgml.2004-04-01.gz
 # Valid book options are a4paper, a5paper, b5paper, letterpaper,
 # legalpaper, landscape, 11pt, 12pt, oneside, twocolumn, notitlepage,
 # titlepage, openany, draft, fleqn, leqno
+#  -P latex.class.options=a5paper
 DBLATEX = dblatex \
-       -P latex.class.options=a5paper \
-       -T db2latex \
-       --backend=xetex \
+       -T simple \
        --param lingua=nb \
        --xsl-user=data/user_param.xsl \
        --xsl-user=data/xetex_param.xsl \
        -p data/pdf.xsl
 
+
 DBTOEPUB = dbtoepub
 
 IMAGES = images/cc.png
 
-XSLTS = \
-  data/user_param.xsl \
-  data/xetex_param.xsl \
-  data/pdf.xsl
+XSLT = \
+  data/user_param.xsl
+
+DB_XSLT = \
+  data/xetex_param.xsl
+
+HTML_XSLT = \
+  $(XSLT) \
+  data/html.xsl \
+  data/stylesheet-html.xsl
+
+PDF_XSLT = \
+  $(XSLT) \
+  data/lulu.xsl \
+  data/licentia.xsl \
+  data/pdf.xsl \
+  data/stylesheet-fo.xsl
+
 
 all: lint lint.nb html epub pdf
 
@@ -38,51 +52,62 @@ pdf: freeculture.nb.pdf freeculture.pdf
 epub: freeculture.nb.epub 
 html: freeculture.html freeculture.nb.html 
 
-%.pdf: %.xml $(IMAGES) $(XSLTS)
-#      $(DBLATEX) $<
-
-# Alternative processing path to dblatex is to use xmlto using fop to
-# create PDF like this.  The PDF output (visual design) is better, but
-# the footnote handling is worse and images are missing.
-#      xmlto --noautosize \
-#        --stringparam fop1.extensions=1 \
-#        --stringparam insert.xref.page.number=1 \
-#        --stringparam page.width=6in \
-#        --stringparam page.height=9in \
-#        --stringparam page.margin.inner=1.0in \
-#        --stringparam page.margin.outer=0.8in \
-#        --stringparam body.start.indent=0pt \
-#        --stringparam body.font.family=Times \
-#        --stringparam title.font.family=Times \
-#        --stringparam dingbat.font.family=Times \
-#        --stringparam generate.toc='book toc title' \
-#        --stringparam hyphenate=false \
-         --with-fop pdf $<
-
-# Third alternative is to use xsltproc and fop directly, as
-# recommended by <URL: http://www.sagehill.net/docbookxsl/index.html > .
-# This include images, but the index refs and footnote handling is
-# broken.
-       xsltproc  \
-         --output myfile.fo    \
-         --stringparam fop1.extensions 1 \
-         --stringparam insert.xref.page.number 1 \
-         --stringparam page.width 6in \
-         --stringparam page.height 9in \
-         --stringparam page.margin.inner 1.0in \
-         --stringparam page.margin.outer 0.8in \
-         --stringparam body.start.indent 0pt \
-         --stringparam body.font.family  Times \
-         --stringparam title.font.family Times \
-         --stringparam dingbat.font.family Times \
-         --stringparam generate.toc 'book toc title' \
-         --stringparam hyphenate false \
+%.pdf: %.xml $(IMAGES) $(PDF_XSLT) Makefile
+# Possible pipelines:
+#
+# dblatex:
+#   This converts the docbook content to latex and leave it to latex
+#   to format it.
+#
+# xmlto:
+#   Alternative processing path to dblatex is to use xmlto using fop
+#   to create PDF like this.  The PDF output (visual design) is
+#   better, but the footnote handling is worse and images are missing.
+#
+# docbook-xsl:
+#   Third alternative is to use xsltproc and fop directly, as
+#   recommended by <URL: http://www.sagehill.net/docbookxsl/index.html >.
+#   This include images, but the index refs and footnote handling
+#   is broken.
+
+       pipeline=dblatex; \
+       echo "Using $$pipeline pipeline" ; \
+       case "$$pipeline" in  \
+       dblatex) \
+         $(DBLATEX) $< ; \
+         ;; \
+       xmlto) \
+         xmlto --noautosize \
+           -x data/stylesheet-fo.xsl \
+           --with-fop pdf $< ; \
+         ;; \
+       docbook-xsl) \
+         xsltproc  \
+           --output $(subst .pdf,.fo,$@) \
+           data/stylesheet-fo.xsl \
+           $< ; \
+         fop -c data/fop-params.xconf -fo $(subst .pdf,.fo,$@) -pdf $@ ; \
+         ;; \
+       esac
+
+pdf-compare: freeculture.xml $(IMAGES)
+       dblatex -o freeculture-dblatex.pdf freeculture.xml
+       dblatex -T db2latex \-o freeculture-dblatex-db2latex.pdf freeculture.xml
+
+       # plain xmlto fail
+       #xmlto pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto.pdf
+       xmlto --with-fop pdf freeculture.xml && mv freeculture.pdf freeculture-xmlto-fop.pdf
+
+       xsltproc --output freeculture-docbook-xsl.fo \
          /usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl \
-         $<
-       fop -c data/fop-params.xconf -fo myfile.fo -pdf $@
+         freeculture.xml
+       fop -fo freeculture-docbook-xsl.fo -pdf freeculture-docbook-xsl.pdf
 
-%.html: %.xml $(IMAGES)
-       xmlto html-nochunks $<
+%.html: %.xml $(IMAGES) $(HTML_XSLT)
+       xmlto \
+         -x data/stylesheet-html.xsl \
+         html-nochunks \
+         $<
 
 %.txt: %.xml $(IMAGES)
        xmlto txt $<
@@ -93,8 +118,11 @@ html: freeculture.html freeculture.nb.html
 freeculture.xml:
        GET $(url) | gunzip > freeculture.xml
 
+# <beginpage> workaround can be removed when BTS #684137 is fixed in
+# po4a.
 freeculture.pot: freeculture.xml
-       po4a-gettextize -f docbook -m $^  > $@.new && mv $@.new $@
+       po4a-gettextize -o nodefault='<beginpage>' -o inline='<beginpage>' \
+         -f docbook -m $^  > $@.new && mv $@.new $@
 
 stats: update-stats progress.png
 update-stats: freeculture.nb.po