From 0d80918aec7ce426ecb4da841fc4e82ff35a655b Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 27 Jan 2024 15:34:34 +0100 Subject: [PATCH 1/7] Makefile: change ~ to $(HOME) This is more readable. Also remove obsolete variables at start. Part of a patch by Boian Berberov --- Makefile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1f1de8d23..8c80eb9aa 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,4 @@ # vim:ts=3 -#BASEDIR = ~/lfs-book -#SYSDDIR = ~/lfs-systemd -#DUMPDIR = ~/lfs-commands RENDERTMP = $(HOME)/tmp CHUNK_QUIET = 1 ROOT_ID = @@ -24,15 +21,15 @@ ifneq ($(REV), sysv) endif ifeq ($(REV), sysv) - BASEDIR ?= ~/public_html/lfs-book + BASEDIR ?= $(HOME)/public_html/lfs-book PDF_OUTPUT ?= LFS-BOOK.pdf NOCHUNKS_OUTPUT ?= LFS-BOOK.html - DUMPDIR ?= ~/lfs-commands + DUMPDIR ?= $(HOME)/lfs-commands else - BASEDIR ?= ~/public_html/lfs-systemd + BASEDIR ?= $(HOME)/public_html/lfs-systemd PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html - DUMPDIR ?= ~/lfs-sysd-commands + DUMPDIR ?= $(HOME)/lfs-sysd-commands endif book: validate profile-html From 4ac089b5b201eb34874be25d5d64fb789eaa348c Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 27 Jan 2024 16:56:22 +0100 Subject: [PATCH 2/7] Unify the writing of sed's in Makefile also remove a commented out line Part of a patch by Boian Berberov --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8c80eb9aa..9ec33696a 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,8 @@ book: validate profile-html @echo "Copying CSS code and images..." $(Q)mkdir -p $(BASEDIR)/stylesheets $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets - $(Q)sed -i 's|../stylesheet|stylesheet|' $(BASEDIR)/index.html + $(Q)sed -e 's|../stylesheet|stylesheet|' \ + -i $(BASEDIR)/index.html $(Q)mkdir -p $(BASEDIR)/images $(Q)cp images/*.png $(BASEDIR)/images @@ -54,9 +55,9 @@ book: validate profile-html tidy -config tidy.conf $$filename; \ true; \ /bin/bash obfuscate.sh $$filename; \ - sed -e "s@text/html@application/xhtml+xml@g" \ + sed -e "s|text/html|application/xhtml+xml|g" \ -i $$filename; \ - done; + done $(Q)$(MAKE) --no-print-directory wget-list md5sums @@ -95,16 +96,16 @@ nochunks: validate profile-html --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \ stylesheets/lfs-nochunks.xsl \ $(RENDERTMP)/lfs-html.xml -# $(RENDERTMP)/lfs-html2.xml @echo "Running Tidy..." $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true @echo "Running obfuscate.sh..." - $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT) - $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT) - $(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT) - $(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT) + $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT) + $(Q)sed -e "s|text/html|application/xhtml+xml|g" \ + -e "s|../wget-list|wget-list|" \ + -e "s|../md5sums|md5sums|" \ + -i $(BASEDIR)/$(NOCHUNKS_OUTPUT) @echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)" From 16d01822df0dff12762a77658210784c2583e99a Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 27 Jan 2024 16:58:34 +0100 Subject: [PATCH 3/7] Makefile: remove "true" after tidy If in a series of commands, and not the last, true has no effect If in the last command, it is better to exit if there is a real error in tidy, so use "|| test $$? -le 1", but only when tidy is the last in a series of commands Part of a patch by Boian Berberov --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9ec33696a..dadbb3783 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,6 @@ book: validate profile-html @echo "Running Tidy and obfuscate.sh..." $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \ tidy -config tidy.conf $$filename; \ - true; \ /bin/bash obfuscate.sh $$filename; \ sed -e "s|text/html|application/xhtml+xml|g" \ -i $$filename; \ @@ -98,7 +97,7 @@ nochunks: validate profile-html $(RENDERTMP)/lfs-html.xml @echo "Running Tidy..." - $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true + $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || test $$? -le 1 @echo "Running obfuscate.sh..." $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT) From b6dd23c76bf4a819c291395d49da566cb391b9e4 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 27 Jan 2024 17:03:47 +0100 Subject: [PATCH 4/7] Makefile: improvements in xsltproc commands - remove some useless --xinclude - write only one option per line - use --encode UTF-8 instead of --noent (which is useless after profiling anyway - try to be consistent in option order - use --output instead of -o --- Makefile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index dadbb3783..6247b294d 100644 --- a/Makefile +++ b/Makefile @@ -123,16 +123,16 @@ validate: tmpdir version @echo "Adjusting for revision $(REV)..." $(Q)xsltproc --nonet \ --xinclude \ - --output $(RENDERTMP)/lfs-html2.xml \ --stringparam profile.revision $(REV) \ + --output $(RENDERTMP)/lfs-html2.xml \ stylesheets/lfs-xsl/profile.xsl \ index.xml @echo "Validating the book..." - $(Q)xmllint --nonet \ - --noent \ - --postvalid \ - -o $(RENDERTMP)/lfs-full.xml \ + $(Q)xmllint --nonet \ + --encode UTF-8 \ + --postvalid \ + --output $(RENDERTMP)/lfs-full.xml \ $(RENDERTMP)/lfs-html2.xml $(Q)rm -f appendices/*.script @@ -154,18 +154,21 @@ wget-list: $(BASEDIR)/wget-list $(BASEDIR)/wget-list-$(REV) $(BASEDIR)/wget-list: stylesheets/wget-list.xsl $(DOWNLOADS_DEP) @echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..." $(Q)mkdir -p $(BASEDIR) - $(Q)xsltproc --xinclude --nonet \ + $(Q)xsltproc --nonet \ + --xinclude \ --output $(BASEDIR)/wget-list \ stylesheets/wget-list.xsl \ chapter03/chapter03.xml $(BASEDIR)/wget-list-$(REV): stylesheets/wget-list.xsl $(DOWNLOADS_DEP) - $(Q)xsltproc --nonet --xinclude \ + $(Q)xsltproc --nonet \ + --xinclude \ --stringparam profile.revision $(REV) \ --output $(RENDERTMP)/wget-list.xml \ stylesheets/lfs-xsl/profile.xsl \ chapter03/chapter03.xml - $(Q)xsltproc --xinclude --nonet \ + + $(Q)xsltproc --nonet \ --output $(BASEDIR)/wget-list-$(REV) \ stylesheets/wget-list.xsl \ $(RENDERTMP)/wget-list.xml @@ -175,13 +178,14 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl $(DOWNLOADS_DEP) @echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..." $(Q)mkdir -p $(BASEDIR) - $(Q)xsltproc --nonet --xinclude \ + $(Q)xsltproc --nonet \ + --xinclude \ --stringparam profile.revision $(REV) \ --output $(RENDERTMP)/md5sum.xml \ stylesheets/lfs-xsl/profile.xsl \ chapter03/chapter03.xml - $(Q)xsltproc --xinclude --nonet \ + $(Q)xsltproc --nonet \ --output $(BASEDIR)/md5sums \ stylesheets/md5sum.xsl \ $(RENDERTMP)/md5sum.xml From b8d33a557b77b91dfbf18e983462b1a28bfe91e7 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 27 Jan 2024 17:28:43 +0100 Subject: [PATCH 5/7] rendering: some utf-8 fixes Reinstate some character entities Have some stylesheets output UTF-8 Part of a patch by Boian Berberov --- stylesheets/dump-commands.xsl | 5 ++--- stylesheets/lfs-xsl/pdf.xsl | 4 ++-- stylesheets/lfs-xsl/profile.xsl | 1 + stylesheets/md5sum.xsl | 3 +-- stylesheets/wget-list.xsl | 3 +-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/stylesheets/dump-commands.xsl b/stylesheets/dump-commands.xsl index 48af34c20..526a33102 100644 --- a/stylesheets/dump-commands.xsl +++ b/stylesheets/dump-commands.xsl @@ -1,4 +1,4 @@ - + - - + diff --git a/stylesheets/lfs-xsl/pdf.xsl b/stylesheets/lfs-xsl/pdf.xsl index 679f73b84..ea247f5db 100644 --- a/stylesheets/lfs-xsl/pdf.xsl +++ b/stylesheets/lfs-xsl/pdf.xsl @@ -53,8 +53,8 @@ We have expanded the support to several inline tags. See pdf/lfs-mixed.xsl. Note: the argument in select= is a zero-width space - (unicode 200b, encoded in utf-8)--> - + (unicode 200b)--> + diff --git a/stylesheets/md5sum.xsl b/stylesheets/md5sum.xsl index bb7268276..121e0a274 100644 --- a/stylesheets/md5sum.xsl +++ b/stylesheets/md5sum.xsl @@ -31,8 +31,7 @@ - - + diff --git a/stylesheets/wget-list.xsl b/stylesheets/wget-list.xsl index aa8d263c4..f55c37346 100644 --- a/stylesheets/wget-list.xsl +++ b/stylesheets/wget-list.xsl @@ -28,8 +28,7 @@ - - + From 5d064fb3c30ea9c83df96774f7a348833d4f7628 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 27 Jan 2024 17:30:51 +0100 Subject: [PATCH 6/7] Align attributes in xsl:stylesheet elements Part of a patch by Boian Berberov --- stylesheets/dump-commands.xsl | 6 +++--- stylesheets/md5sum.xsl | 2 +- stylesheets/wget-list.xsl | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stylesheets/dump-commands.xsl b/stylesheets/dump-commands.xsl index 526a33102..83e24dfc6 100644 --- a/stylesheets/dump-commands.xsl +++ b/stylesheets/dump-commands.xsl @@ -1,8 +1,8 @@ + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + version="1.0"> diff --git a/stylesheets/md5sum.xsl b/stylesheets/md5sum.xsl index 121e0a274..57723df97 100644 --- a/stylesheets/md5sum.xsl +++ b/stylesheets/md5sum.xsl @@ -3,7 +3,7 @@ + version="1.0"> diff --git a/stylesheets/wget-list.xsl b/stylesheets/wget-list.xsl index f55c37346..eca53a4c9 100644 --- a/stylesheets/wget-list.xsl +++ b/stylesheets/wget-list.xsl @@ -4,7 +4,7 @@ with wget. --> + version="1.0"> From a4eaba6d553e4545e9ed3ae576e28a49b968b496 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sat, 27 Jan 2024 17:31:56 +0100 Subject: [PATCH 7/7] Tidy doctype and xml declarations in .html output Part of a patch by Boian Berberov --- stylesheets/lfs-xsl/chunk-slave.xsl | 11 ++++++++--- stylesheets/lfs-xsl/nochunks.xsl | 7 +++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/stylesheets/lfs-xsl/chunk-slave.xsl b/stylesheets/lfs-xsl/chunk-slave.xsl index f5bc8a956..45d33e04a 100644 --- a/stylesheets/lfs-xsl/chunk-slave.xsl +++ b/stylesheets/lfs-xsl/chunk-slave.xsl @@ -10,6 +10,14 @@ + + + + + + + + @@ -31,9 +39,6 @@ - - - book toc,title diff --git a/stylesheets/lfs-xsl/nochunks.xsl b/stylesheets/lfs-xsl/nochunks.xsl index 5a5ad36f5..896449d7c 100644 --- a/stylesheets/lfs-xsl/nochunks.xsl +++ b/stylesheets/lfs-xsl/nochunks.xsl @@ -10,6 +10,13 @@ +