diff options
author | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2005-10-19 18:13:41 +0000 |
---|---|---|
committer | Manuel Canales Esparcia <manuel@linuxfromscratch.org> | 2005-10-19 18:13:41 +0000 |
commit | effd9c6f93d19046d6cd81c290a1a99443da012f (patch) | |
tree | dc858a7d1cb1ba9568684e5ec62cb62f191e641e | |
parent | e13f18852c15a8e0f5c02418442dc02c4ba88921 (diff) |
Updated Makefile and related files.
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/6.1.1/BOOK@7053 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r-- | INSTALL | 28 | ||||
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | README | 18 | ||||
-rw-r--r-- | obfuscate.sh | 35 | ||||
-rw-r--r-- | stylesheets/dump-commands.xsl | 83 |
5 files changed, 156 insertions, 19 deletions
@@ -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 - - http://www.linuxfromscratch.org/blfs/view/svn/pst/fop.html +* 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 @@ -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 @@ -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 <archaic AT linuxfromscratch D0T org> +# Original Perl expression by Anderson Lizardo <lizardo AT linuxfromscratch D0T org> +# 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 @@ +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:exsl="http://exslt.org/common" + extension-element-prefixes="exsl" + version="1.0"> + +<!-- XSLT stylesheet to extract commands from [B,H]LFS books. --> + + <xsl:template match="/"> + <xsl:apply-templates select="//sect1"/> + </xsl:template> + + <xsl:template match="sect1"> + <!-- The dirs names --> + <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/> + <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/> + <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/> + <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/> + <!-- The file names --> + <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/> + <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/> + <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/> + <!-- The build order --> + <xsl:variable name="position" select="position()"/> + <xsl:variable name="order"> + <xsl:choose> + <xsl:when test="string-length($position) = 1"> + <xsl:text>00</xsl:text> + <xsl:value-of select="$position"/> + </xsl:when> + <xsl:when test="string-length($position) = 2"> + <xsl:text>0</xsl:text> + <xsl:value-of select="$position"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$position"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <!-- Creating dirs and files --> + <exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> + <xsl:apply-templates select=".//screen"/> + </exsl:document> + </xsl:template> + + <xsl:template match="screen"> + <xsl:if test="child::* = userinput"> + <xsl:choose> + <xsl:when test="@role = 'root'"> + <xsl:text>
</xsl:text> + <xsl:text># Run this as root</xsl:text> + <xsl:apply-templates select="userinput"/> + <xsl:text># End root commands</xsl:text> + <xsl:text>
</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="userinput"/> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + + <xsl:template match="userinput"> + <xsl:text>
</xsl:text> + <xsl:if test=".//replaceable"> + <xsl:text># This block must be edited to suit your needs.</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + <xsl:apply-templates/> + <xsl:text>
</xsl:text> + <xsl:if test=".//replaceable"> + <xsl:text># End of editable block.</xsl:text> + </xsl:if> + <xsl:text>
</xsl:text> + </xsl:template> + + <xsl:template match="replaceable"> + <xsl:text>**EDITME</xsl:text> + <xsl:apply-templates/> + <xsl:text>EDITME**</xsl:text> + </xsl:template> + +</xsl:stylesheet> |