Author: manuel
Date: 2005-10-19 12:13:41 -0600 (Wed, 19 Oct 2005)
New Revision: 7053

Added:
   branches/6.1.1/BOOK/obfuscate.sh
   branches/6.1.1/BOOK/stylesheets/dump-commands.xsl
Modified:
   branches/6.1.1/BOOK/INSTALL
   branches/6.1.1/BOOK/Makefile
   branches/6.1.1/BOOK/README
Log:
Updated Makefile and related files.

Modified: branches/6.1.1/BOOK/INSTALL
===================================================================
--- branches/6.1.1/BOOK/INSTALL 2005-10-19 18:10:50 UTC (rev 7052)
+++ branches/6.1.1/BOOK/INSTALL 2005-10-19 18:13:41 UTC (rev 7053)
@@ -2,15 +2,16 @@
 
 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 @@
   - 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
-

Modified: branches/6.1.1/BOOK/Makefile
===================================================================
--- branches/6.1.1/BOOK/Makefile        2005-10-19 18:10:50 UTC (rev 7052)
+++ branches/6.1.1/BOOK/Makefile        2005-10-19 18:13:41 UTC (rev 7053)
@@ -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 @@
        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 "[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]" 
$$filename; \
        done;
 
@@ -50,9 +49,15 @@
 
        tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
 
+       sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
+
        sed -i -e "[EMAIL PROTECTED]/[EMAIL PROTECTED]/[EMAIL PROTECTED]"  \
          $(BASEDIR)/$(NOCHUNKS_OUTPUT)
 
+dump-commands:
+       xsltproc --xinclude --nonet --output $(DUMPDIR)/ \
+          stylesheets/dump-commands.xsl index.xml
+
 validate:
        xmllint --noout --nonet --xinclude --postvalid index.xml
 

Modified: branches/6.1.1/BOOK/README
===================================================================
--- branches/6.1.1/BOOK/README  2005-10-19 18:10:50 UTC (rev 7052)
+++ branches/6.1.1/BOOK/README  2005-10-19 18:13:41 UTC (rev 7053)
@@ -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 @@
 
 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

Added: branches/6.1.1/BOOK/obfuscate.sh
===================================================================
--- branches/6.1.1/BOOK/obfuscate.sh    2005-10-19 18:10:50 UTC (rev 7052)
+++ branches/6.1.1/BOOK/obfuscate.sh    2005-10-19 18:13:41 UTC (rev 7053)
@@ -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:[EMAIL PROTECTED]"' "$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


Property changes on: branches/6.1.1/BOOK/obfuscate.sh
___________________________________________________________________
Name: svn:keywords
   + "Author Date Revision Id"

Added: branches/6.1.1/BOOK/stylesheets/dump-commands.xsl
===================================================================
--- branches/6.1.1/BOOK/stylesheets/dump-commands.xsl   2005-10-19 18:10:50 UTC 
(rev 7052)
+++ branches/6.1.1/BOOK/stylesheets/dump-commands.xsl   2005-10-19 18:13:41 UTC 
(rev 7053)
@@ -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>&#xA;</xsl:text>
+          <xsl:text># Run this as root</xsl:text>
+          <xsl:apply-templates select="userinput"/>
+          <xsl:text># End root commands</xsl:text>
+          <xsl:text>&#xA;</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>&#xA;</xsl:text>
+    <xsl:if test=".//replaceable">
+      <xsl:text># This block must be edited to suit your needs.</xsl:text>
+    </xsl:if>
+    <xsl:text>&#xA;</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:text>&#xA;</xsl:text>
+    <xsl:if test=".//replaceable">
+      <xsl:text># End of editable block.</xsl:text>
+    </xsl:if>
+    <xsl:text>&#xA;</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>


Property changes on: branches/6.1.1/BOOK/stylesheets/dump-commands.xsl
___________________________________________________________________
Name: svn:keywords
   + "Author Date Revision Id"

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to