Author: manuel
Date: 2007-07-07 04:30:37 -0600 (Sat, 07 Jul 2007)
New Revision: 6842
Modified:
trunk/BOOK/Makefile
trunk/BOOK/introduction/welcome/changelog.xml
trunk/BOOK/obfuscate.sh
Log:
Updated book rendering framework to use the new LFS-XSL Stylesheets.
Modified: trunk/BOOK/Makefile
===================================================================
--- trunk/BOOK/Makefile 2007-07-07 10:27:20 UTC (rev 6841)
+++ trunk/BOOK/Makefile 2007-07-07 10:30:37 UTC (rev 6842)
@@ -3,129 +3,137 @@
# 2004-01-31
# $LastChangedBy$
# $Date$
+
# Adjust these to suit your installation
-OUTPUTDIR = $(HOME)/public_html/blfs-book
+BASEDIR= $(HOME)/public_html/blfs-book-xsl
DUMPDIR= $(HOME)/blfs-commands
-INSTALL = install
-JADE = openjade
-DOCBOOK = /usr/share/sgml/docbook/dsssl-stylesheets-1.78
-BASEDIR= $(HOME)/public_html/blfs-book-xsl
-TEXBASEDIR= $(HOME)/public_html/blfs-book-tex
+CHUNK_QUIET=1
+ROOT_ID=""
+PDF_OUTPUT=BLFS-BOOK.pdf
NOCHUNKS_OUTPUT=BLFS-BOOK.html
-SRCDIR = $(PWD)
-all: blfs
+ifdef V
+ Q =
+else
+ Q = @
+endif
-blfs:
- @if [ -z $(BASEDIR) ]; then \
- echo "Envar BASEDIR is not set!" ; \
- exit 1 ; \
- fi
- @echo "Generating XHTML Version of BLFS Book with xsltproc..."
- @echo " BASEDIR = $(BASEDIR)"
- @$(INSTALL) -d $(BASEDIR)
- xsltproc --xinclude --nonet -stringparam base.dir $(BASEDIR)/ \
- stylesheets/blfs-chunked.xsl index.xml
- if [ ! -e $(BASEDIR)/stylesheets ]; then \
+blfs: validxml profile-html
+ @echo "Generating chunked XHTML files..."
+ $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
+ -stringparam rootid $(ROOT_ID) -stringparam base.dir $(BASEDIR)/ \
+ stylesheets/blfs-chunked.xsl /tmp/blfs-html.xml
+
+ @echo "Copying CSS code and images..."
+ $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
mkdir -p $(BASEDIR)/stylesheets; \
fi;
- cp stylesheets/*.css $(BASEDIR)/stylesheets
- if [ ! -e $(BASEDIR)/images ]; then \
+ $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
+ $(Q)if [ ! -e $(BASEDIR)/images ]; then \
mkdir -p $(BASEDIR)/images; \
fi;
- cp images/*.png $(BASEDIR)/images
- cd $(BASEDIR); sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]@g" *.html
- cd $(BASEDIR); sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]@g" *.html
+ $(Q)cp images/*.png $(BASEDIR)/images
+ $(Q)cd $(BASEDIR)/; sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]@g"
*.html
+ $(Q)cd $(BASEDIR)/; sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]@g"
*.html
- for filename in `find $(BASEDIR) -name "*.html"`; do \
+ @echo "Running Tidy and obfuscate.sh..."
+ $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
tidy -config tidy.conf $$filename; \
true; \
sh obfuscate.sh $$filename; \
sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]"
$$filename; \
done;
+pdf: validxml
+ @echo "Generating profiled XML for PDF..."
+ $(Q)xsltproc --nonet --stringparam profile.condition pdf \
+ --output /tmp/blfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
+ /tmp/blfs-full.xml
-nochunks:
- @echo "Generating nochunks version of BLFS..."
- xsltproc --xinclude --nonet -stringparam profile.condition html \
- --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
- stylesheets/blfs-nochunks.xsl index.xml
+ @echo "Generating FO file..."
+ $(Q)xsltproc --nonet -stringparam rootid $(ROOT_ID) \
+ --output /tmp//blfs-pdf.fo stylesheets/blfs-pdf.xsl /tmp/blfs-pdf.xml
+ $(Q)sed -i -e 's/span="inherit"/span="all"/' /tmp/blfs-pdf.fo
- tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
+ @echo "Generating PDF file..."
+ $(Q)if [ ! -e $(BASEDIR) ]; then \
+ mkdir -p $(BASEDIR); \
+ fi;
+ $(Q)fop /tmp/blfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
- sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
+nochunks: validxml profile-html
+ @echo "Generating non chunked XHTML file..."
+ $(Q)xsltproc --nonet -stringparam profile.condition html \
+ -stringparam rootid $(ROOT_ID) --output $(BASEDIR)/$(NOCHUNKS_OUTPUT)
\
+ stylesheets/blfs-nochunks.xsl /tmp/blfs-html.xml
- sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]" \
- $(BASEDIR)/$(NOCHUNKS_OUTPUT)
+ @echo "Running Tidy..."
+ $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
+ @echo "Running obfuscate.sh..."
+ $(Q)sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
+ $(Q)sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]" \
+ $(BASEDIR)/$(NOCHUNKS_OUTPUT)
-pdf:
- xsltproc --xinclude --nonet --stringparam profile.condition pdf \
- --output blfs-pdf.xml stylesheets/blfs-profile.xsl index.xml
- xsltproc --xinclude --nonet --output blfs.fo \
- stylesheets/blfs-pdf.xsl blfs-pdf.xml
- sed -i -e "s/inherit/all/" blfs.fo
- fop.sh blfs.fo blfs.pdf
- $(INSTALL) -d $(BASEDIR)/pdf
- rm blfs.fo
- mv blfs.pdf $(BASEDIR)/pdf
+validxml:
+ @echo "Validating the book..."
+ $(Q)xmllint --nonet --noent --xinclude --postvalid \
+ -o /tmp/blfs-full.xml index.xml
-tex:
- @if [ -z $(TEXBASEDIR) ]; then \
- echo "Envar TEXBASEDIR is not set!" ; \
- exit 1 ; \
- fi
- @echo "Generating TeX Version of BLFS Book with xsltproc..."
- @echo " TEXBASEDIR = $(TEXBASEDIR)"
- @$(INSTALL) -d $(TEXBASEDIR)
-# Using profiles in book source to exclude parts of the book from TeX
-# i.e., Changelog
- xsltproc --nonet --output $(TEXBASEDIR)/index.xml \
- --stringparam "profile.role" "book" \
-
http://docbook.sourceforge.net/release/xsl/current/profiling/profile.xsl \
- index.xml
- @cd $(TEXBASEDIR) && xsltproc --nonet -o blfs-book.tex \
- $(SRCDIR)/stylesheets/blfs-tex.xsl index.xml
+profile-html: validxml
+ @echo "Generating profiled XML for XHTML..."
+ $(Q)xsltproc --nonet --stringparam profile.condition html \
+ --output /tmp/blfs-html.xml stylesheets/lfs-xsl/profile.xsl \
+ /tmp/blfs-full.xml
-dump-commands:
- xsltproc --xinclude --nonet --output $(DUMPDIR)/ \
- stylesheets/dump-commands.xsl index.xml
+blfs-patch-list: validxml
+ @echo "Generating blfs-patch-list..."
+ $(Q)xsltproc --nonet --output /tmp/blfs-patch-list \
+ stylesheets/patcheslist.xsl /tmp/blfs-full.xml
+ $(Q)sed -e "s|^.*/||" /tmp/blfs-patch-list > /tmp/blfs-patches
+ $(Q)sort /tmp/blfs-patches > blfs-patch-list
-validate:
- xmllint --noout --nonet --xinclude --postvalid index.xml
+wget-list: validxml
+ @echo "Generating wget list..."
+ $(Q)mkdir -p $(BASEDIR)
+ $(Q)xsltproc --nonet --output $(BASEDIR)/wget-list \
+ stylesheets/wget-list.xsl /tmp/lfs-full.xml
-validate-pdf:
- xsltproc --xinclude --nonet --stringparam profile.condition pdf \
- --output blfs-pdf.xml stylesheets/blfs-profile.xsl index.xml
- xmllint --noout --nonet --postvalid blfs-pdf.xml
+test-links: validxml
+ @echo "Generating test-links file..."
+ $(Q)mkdir -p $(BASEDIR)
+ $(Q)xsltproc --nonet --stringparam list_mode full \
+ --output $(BASEDIR)/test-links stylesheets/wget-list.xsl \
+ /tmp/lfs-full.xml
-blfs-patch-list:
- @echo "Generating blfs-patch-list..."
- xsltproc --xinclude --nonet \
- --output blfs-patch-list stylesheets/patcheslist.xsl index.xml
- sed -e "s|^.*/||" blfs-patch-list > blfs-patches
- sort blfs-patches > blfs-patch-list
- rm blfs-patches
-
-wget-list:
- mkdir -p $(BASEDIR)
- xsltproc --xinclude --nonet stylesheets/wget-list.xsl index.xml >
$(BASEDIR)/wget-list
-
-test-links:
- mkdir -p $(BASEDIR)
- xsltproc --xinclude --nonet --stringparam list_mode full \
- stylesheets/wget-list.xsl index.xml > $(BASEDIR)/test-links
- rm -f $(BASEDIR)/{good,bad,true_bad}_urls
- for URL in `cat $(BASEDIR)/test-links`; do \
+ @echo "Cheking URLs, first pass..."
+ $(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
+ $(Q)for URL in `cat $(BASEDIR)/test-links`; do \
wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
if test $$? -ne 0 ; then echo $$URL >> $(BASEDIR)/bad_urls ; \
else echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
fi; \
done
- for URL2 in `cat $(BASEDIR)/bad_urls`; do \
+
+ @echo "Cheking URLs, second pass..."
+ $(Q)for URL2 in `cat $(BASEDIR)/bad_urls`; do \
wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
if test $$? -ne 0 ; then echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
else echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
fi; \
done
-.PHONY : blfs-patch-list wget-list test-links
+dump-commands: validxml
+ @echo "Dumping book commands..."
+ $(Q)xsltproc --output $(DUMPDIR)/ \
+ stylesheets/dump-commands.xsl /tmp/lfs-full.xml
+
+validate:
+ @echo "Validating the book..."
+ $(Q)xmllint --noout --nonet --xinclude --postvalid index.xml
+
+all: blfs nochunks pdf
+
+world: all blfs-patch-list dump-commands wget-list test-links
+
+.PHONY : all blfs blfs-patch-list dump-commands nochunks pdf profile-html \
+ test-links validate validxml wget-list world
Modified: trunk/BOOK/introduction/welcome/changelog.xml
===================================================================
--- trunk/BOOK/introduction/welcome/changelog.xml 2007-07-07 10:27:20 UTC
(rev 6841)
+++ trunk/BOOK/introduction/welcome/changelog.xml 2007-07-07 10:30:37 UTC
(rev 6842)
@@ -42,6 +42,16 @@
-->
<listitem>
+ <para>July 7th, 2007</para>
+ <itemizedlist>
+ <listitem>
+ <para>[manuel] - Updated book rendering framework to use the new
+ LFS-XSL Stylesheets.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
<para>July 6th, 2007</para>
<itemizedlist>
<listitem>
Modified: trunk/BOOK/obfuscate.sh
===================================================================
--- trunk/BOOK/obfuscate.sh 2007-07-07 10:27:20 UTC (rev 6841)
+++ trunk/BOOK/obfuscate.sh 2007-07-07 10:30:37 UTC (rev 6842)
@@ -6,6 +6,8 @@
# obfuscate.sh
# obfuscate email addresses in XML/HTML
# Script written (and slight perl modification) by Archaic <archaic AT
linuxfromscratch D0T org>
+# Modified from "sed -i" to old style "sed -e" by Manuel Canales <manuel AT
linuxfromscratch D0T org>
+# to prevent hangs on very long files, like nonckunked books.
# Original Perl expression by Anderson Lizardo <lizardo AT linuxfromscratch
D0T org>
# Released under the GNU General Public License
#
@@ -28,11 +30,13 @@
# Nothing like a backup plan!
#cp "$1" "$1".bak
-for i in `grep -o '"mailto:[EMAIL PROTECTED]"' "$1" |cut -d\" -f2|sed -e
's|^mailto:||' -e 's|"$||'`; do
+for i in `grep -o '"mailto:[EMAIL PROTECTED]"' ${1} |cut -d\" -f2|sed -e
's|^"mailto:||' -e 's|"$||'`; do
link=`echo $i | perl -pe 's/[^\n]/"\\\&#".ord($&)."\;"/ge'`
plaintext=`echo $i | sed -e 's|@| AT |' -e 's|\.| D0T |g'`
- sed -i "s|mailto:$i|mailto:$link|" "$1"
- sed -i "s|$i|$plaintext|" "$1"
+ cp ${1}{,.tmp}
+ sed -e "s|mailto:$i|mailto:$link|" \
+ -e "s|$i|$plaintext|" ${1}.tmp > ${1}
+ rm ${1}.tmp
done
-
+#rm $FILE.tmp
#exit 0
--
http://linuxfromscratch.org/mailman/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page