diff --git a/INSTALL b/INSTALL index 0dc22640d..4e744b671 100644 --- a/INSTALL +++ b/INSTALL @@ -2,14 +2,15 @@ LFS Book Conversion Tools Installation Instructions After downloading the SVN source, there are some things that need to be set up on your computer if you want to convert the XML source into something easier to -read (e.g. HTML, TXT, PS or PDF). If you are interested in this, then keep +read (e.g. HTML, TXT, or PDF). If you are interested in this, then keep reading. If you are only interested in editing the XML source for re- submission to the lfs-book or lfs-dev mailing lists, then you do not need this document. Instead, you need to read the LFS Editor's Manual. See the LFS website at http://www.linuxfromscratch.org for more information. ------------------------------------------------------------------------------- -If all you want to do is convert XML to HTML perform the following: + +If you want to convert the XML to HTML, install the following: * libxml2 - http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html @@ -27,15 +28,20 @@ If all you want to do is convert XML to HTML perform the following: - http://www.linuxfromscratch.org/blfs/view/svn/general/tidy.html ------------------------------------------------------------------------------- -If you want to be able to convert the book into PDF as well, then you will need -the FOP package. This takes an XSL-FO file (created with libxslt which you -already installed) and converts it to PDF. FOP is dependant on the Java -Advanced Imaging (JAI) API to render SVG graphics. Instructions to install the -JAI are included in the FOP instructions. Perform the following: -* J2SDK - - http://www.linuxfromscratch.org/blfs/view/svn/general/j2sdk.html +If you want to convert the XML to TXT, install the above items, and then install +the following: -* FOP +* lynx + - http://www.linuxfromscratch.org/blfs/view/svn/basicnet/lynx.html + +------------------------------------------------------------------------------- + +If you want to convert the XML to PDF, install the items listed above (except +lynx) and then install the following: + +* JDK + - http://www.linuxfromscratch.org/blfs/view/svn/general/jdk.html + +* FOP and JAI - http://www.linuxfromscratch.org/blfs/view/svn/pst/fop.html - diff --git a/Makefile b/Makefile index f971c4a42..724c454d3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ BASEDIR=~/lfs-book +DUMPDIR=~/lfs-commands CHUNK_QUIET=0 PDF_OUTPUT=LFS-BOOK.pdf NOCHUNKS_OUTPUT=LFS-BOOK.html @@ -27,9 +28,7 @@ lfs: for filename in `find $(BASEDIR) -name "*.html"`; do \ tidy -config tidy.conf $$filename; \ true; \ - done; - - for filename in `find $(BASEDIR) -name "*.html"`; do \ + sh obfuscate.sh $$filename; \ sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \ done; @@ -50,9 +49,15 @@ nochunks: tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true + sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT) + sed -i -e "s@text/html@application/xhtml+xml@g" \ $(BASEDIR)/$(NOCHUNKS_OUTPUT) +dump-commands: + xsltproc --xinclude --nonet --output $(DUMPDIR)/ \ + stylesheets/dump-commands.xsl index.xml + validate: xmllint --noout --nonet --xinclude --postvalid index.xml diff --git a/README b/README index 61f7721a2..bcdb34182 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -LFS Book Readme +LFS Book README This document is meant to instruct the user on how to convert the book's XML source to other formats (e.g. HTML, PDF, PS and TXT). First, if you have not @@ -9,12 +9,20 @@ various other formats. XML to XHTML: ------------- - make BASEDIR=/path/to/output/location +XML to single file XHTML (nochunks): +------------------------------------ +make BASEDIR=/path/to/output/location nochunks + + +XML to TXT +---------- +Follow the instructions for nochunks and then run: +lynx -dump /path/to/nochunks >/path/to/output + + XML to PDF: ----------- - -make pdf && -cp lfs.pdf /path/to/output/location +make BASEDIR=/path/to/output/location pdf diff --git a/obfuscate.sh b/obfuscate.sh new file mode 100644 index 000000000..0e9f8f8fe --- /dev/null +++ b/obfuscate.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# obfuscate.sh +# obfuscate email addresses in XML/HTML +# Script written (and slight perl modification) by Archaic +# Original Perl expression by Anderson Lizardo +# Released under the GNU General Public License +# +# This script currently only seeks out mailto: addresses. If those same +# addresses also appear in plaintext, we need to obfuscate those as well. +# +# This script was made for a very specific purpose so I was a bit lazy in +# writing the regex's. +# +# Please send comments, enhancements, etc. to the above address + +#set -e # Bail on all errors + +# First, ensure that we are given a file to process +# if [ $# -lt 1 ]; then +# echo -e "\nYou must provide an input file." +# exit 1 +# fi + +# Nothing like a backup plan! +#cp "$1" "$1".bak + +for i in `grep -o '"mailto:.*@.*"' "$1" |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" +done + +#exit 0 diff --git a/stylesheets/dump-commands.xsl b/stylesheets/dump-commands.xsl new file mode 100644 index 000000000..e3cac13b7 --- /dev/null +++ b/stylesheets/dump-commands.xsl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 00 + + + + 0 + + + + + + + + + + + + + + + + + + + # Run this as root + + # End root commands + + + + + + + + + + + + + # This block must be edited to suit your needs. + + + + + + # End of editable block. + + + + + + **EDITME + + EDITME** + + +