[Kernel-handbook-general] [PATCH 3/4] Makefile, debian/control: Use xmlto to build from DocBook
Ben Hutchings
ben at decadent.org.uk
Thu Nov 5 22:50:48 UTC 2015
Use 'xmlto html' to generate HTML. Add a stylesheet that sets
parameters to match DebianDoc behaviour more closely.
Since XML is case-sensitive, change the entity definitions to begin
with <!ENTITY not <!entity.
Also change po4a command lines to cover all chapters, as it doesn't
find them automatically through XLink references in DocBook.
---
.gitignore | 2 +-
Makefile | 26 ++++++++++++++++++--------
debian/changelog | 1 +
debian/control | 2 +-
stylesheet.xsl | 16 ++++++++++++++++
version.ent | 4 ++--
6 files changed, 39 insertions(+), 12 deletions(-)
create mode 100644 stylesheet.xsl
diff --git a/.gitignore b/.gitignore
index 97706e3..5d28a94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
*~
.#*
/*.html/
-/kernel-handbook.*.sgml
+/kernel-handbook.*.dbk/
/pub/
diff --git a/Makefile b/Makefile
index 485116c..57aada1 100644
--- a/Makefile
+++ b/Makefile
@@ -5,29 +5,39 @@ LANG_PO := ja
LANG_EN := en
LANGS := $(LANG_EN) $(LANG_PO)
+SOURCES := kernel-handbook.dbk $(wildcard chapter-*.dbk)
+
+# Ensure xmlto uses UTF-8 and not numbered entities
+unexport LC_ALL
+export LC_CTYPE=C.UTF-8
+
all: version.ent $(LANGS)
en:
- debiandoc2html kernel-handbook.sgml
+ xmlto -o kernel-handbook.html -m stylesheet.xsl html kernel-handbook.dbk
ja:
- po4a-translate -L EUC-JP -f sgml -m kernel-handbook.sgml -p po4a/kernel-handbook.ja.po -l kernel-handbook.ja.sgml
- debiandoc2html -lja_JP.eucJP kernel-handbook.ja.sgml
+ mkdir -p kernel-handbook.ja.dbk
+ ln -sf ../version.ent kernel-handbook.ja.dbk/
+ for src in $(SOURCES); do \
+ po4a-translate -f docbook -m "$$src" -p po4a/kernel-handbook.ja.po -l kernel-handbook.ja.dbk/"$$src" || exit; \
+ done
+ xmlto -o kernel-handbook.ja.html -m stylesheet.xsl html kernel-handbook.ja.dbk/kernel-handbook.dbk
clean:
rm -rf kernel-handbook.html
$(foreach lng,$(LANGS), \
rm -rf kernel-handbook.$(lng).html; \
- rm -rf kernel-handbook.$(lng).sgml; \
+ rm -rf kernel-handbook.$(lng).dbk; \
)
rm -rf pub
version.ent: FORCE
if [ "$(date)" != \
- "$$(sed 's/<!entity date *"\(.*\)">/\1/; t; d' $@)" ]; then \
+ "$$(sed 's/<!ENTITY date *"\(.*\)">/\1/; t; d' $@)" ]; then \
rm -f $@ && \
- echo "<!entity version \"$(version)\">" >> $@ && \
- echo "<!entity date \"$(date)\">" >> $@; \
+ echo "<!ENTITY version \"$(version)\">" >> $@ && \
+ echo "<!ENTITY date \"$(date)\">" >> $@; \
fi
sync:
@@ -46,7 +56,7 @@ sync:
po-update:
$(foreach lng,$(LANG_PO), \
- po4a-updatepo -f sgml -m kernel-handbook.sgml -p po4a/kernel-handbook.$(lng).po; \
+ po4a-updatepo -f docbook $(patsubst %,-m %,$(SOURCES)) -p po4a/kernel-handbook.$(lng).po; \
)
.PHONY: all sync FORCE
diff --git a/debian/changelog b/debian/changelog
index fce14eb..6776bb7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ kernel-handbook (1.0.17) UNRELEASED; urgency=medium
and is incorrect since it now needs Python 3
* Use changelog date as document date
* Convert all source files to DocBook format
+ - Makefile,debian/control: Use xmlto to build from DocBook
-- Ben Hutchings <ben at decadent.org.uk> Sun, 30 Aug 2015 13:21:25 +0100
diff --git a/debian/control b/debian/control
index 66993f5..aea621f 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: doc
Priority: extra
Maintainer: Debian kernel team <debian-kernel at lists.debian.org>
Uploaders: Ben Hutchings <ben at decadent.org.uk>, maximilian attems <maks at debian.org>
-Build-Depends: debhelper (>= 7.0.50~), debiandoc-sgml, po4a
+Build-Depends: debhelper (>= 7.0.50~), xmlto, po4a
Standards-Version: 3.9.1
Vcs-Browser: https://anonscm.debian.org/cgit/kernel-handbook/kernel-handbook.git
Vcs-Git: https://anonscm.debian.org/git/kernel-handbook/kernel-handbook.git
diff --git a/stylesheet.xsl b/stylesheet.xsl
new file mode 100644
index 0000000..9155e0b
--- /dev/null
+++ b/stylesheet.xsl
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<param name="chunk.quietly">1</param>
+<!-- One file per chapter, not per section -->
+<param name="chunk.section.depth">0</param>
+<!-- Label chapters and sections like DebianDoc -->
+<param name="chapter.autolabel">1</param>
+<param name="section.autolabel">1</param>
+<param name="section.label.includes.component.label">1</param>
+<!-- Where auto-generated IDs are needed, generate them consistently,
+ for reproducible builds -->
+<param name="generate.consistent.ids">1</param>
+<!-- Put each <term> on a separate line, with no other separator -->
+<param name="variablelist.term.break.after">1</param>
+<param name="variablelist.term.separator"/>
+</stylesheet>
diff --git a/version.ent b/version.ent
index 22938ea..0f5d5aa 100644
--- a/version.ent
+++ b/version.ent
@@ -1,2 +1,2 @@
-<!entity version "1.0.17">
-<!entity date "Sun 30 Aug 13:21:25 BST 2015">
+<!ENTITY version "1.0.17">
+<!ENTITY date "Sun 30 Aug 13:21:25 BST 2015">
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/kernel-handbook-general/attachments/20151105/da62b01d/attachment.sig>
More information about the Kernel-handbook-general
mailing list