Author: manuel
Date: 2005-08-29 13:36:12 -0600 (Mon, 29 Aug 2005)
New Revision: 543
Added:
trunk/BOOK/obfuscate.sh
trunk/BOOK/stylesheets/dump-commands.xsl
Modified:
trunk/BOOK/Makefile
trunk/BOOK/prologue/typography.xml
Log:
Added obfuscate.sh and stylesheets/dump-commands.xsl.
Modified: trunk/BOOK/Makefile
===================================================================
--- trunk/BOOK/Makefile 2005-08-04 23:30:37 UTC (rev 542)
+++ trunk/BOOK/Makefile 2005-08-29 19:36:12 UTC (rev 543)
@@ -1,4 +1,5 @@
BASEDIR=~/hlfs-book
+DUMPDIR=~/hlfs-$(LIBC)-commands
CHUNK_QUIET=0
PDF_OUTPUT=HLFS-BOOK-$(LIBC).pdf
NOCHUNKS_OUTPUT=HLFS-BOOK-$(LIBC).html
@@ -57,9 +58,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;
@@ -79,9 +78,20 @@
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 --stringparam profile.condition
html,$(LIBC) \
+ --output $(DUMPDIR)/hlfs-$(LIBC).xml
stylesheets/lfs-profile.xsl index.xml
+
+ xsltproc --xinclude --nonet --output $(DUMPDIR)/ \
+ stylesheets/dump-commands.xsl $(DUMPDIR)/hlfs-$(LIBC).xml
+
+ rm $(DUMPDIR)/hlfs-$(LIBC).xml
+
validate:
xmllint --noout --nonet --xinclude --postvalid index.xml
Added: trunk/BOOK/obfuscate.sh
===================================================================
--- trunk/BOOK/obfuscate.sh 2005-08-04 23:30:37 UTC (rev 542)
+++ trunk/BOOK/obfuscate.sh 2005-08-29 19:36:12 UTC (rev 543)
@@ -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: trunk/BOOK/obfuscate.sh
___________________________________________________________________
Name: svn:keywords
+ "Author Date Revision Id"
Modified: trunk/BOOK/prologue/typography.xml
===================================================================
--- trunk/BOOK/prologue/typography.xml 2005-08-04 23:30:37 UTC (rev 542)
+++ trunk/BOOK/prologue/typography.xml 2005-08-29 19:36:12 UTC (rev 543)
@@ -10,40 +10,40 @@
<para>To make things easier to follow, there are a few typographical
conventions used throughout the book. Following are some examples:</para>
-<screen><userinput>./configure --prefix=/usr</userinput></screen>
+<screen role="nodump"><userinput>./configure --prefix=/usr</userinput></screen>
-<blockquote><para>This form of text is designed to be typed exactly
-as seen unless otherwise noted in the surrounding text. It is also used
-in the explanation sections to identify which of the commands is being
+<blockquote><para>This form of text is designed to be typed exactly
+as seen unless otherwise noted in the surrounding text. It is also used
+in the explanation sections to identify which of the commands is being
referenced.</para></blockquote>
<screen><computeroutput>install-info: unknown option
`--dir-file=/usr/info/dir'</computeroutput></screen>
-<blockquote><para>This form of text (fixed width text) is showing screen
-output, probably as the result of commands issued, and is also used to
+<blockquote><para>This form of text (fixed width text) is showing screen
+output, probably as the result of commands issued, and is also used to
show filenames, such as
<filename>/etc/ld.so.conf</filename>.</para></blockquote>
<para><emphasis>Emphasis</emphasis></para>
-<blockquote><para>This form of text is used for several purposes in the
+<blockquote><para>This form of text is used for several purposes in the
book, mainly to emphasize important points or items.</para></blockquote>
<para><ulink url="&lfs-root;"/></para>
-<blockquote><para>This form of text is used for hyperlinks, both within the
+<blockquote><para>This form of text is used for hyperlinks, both within the
book and to external pages such as HOWTOs, download locations and
websites.</para></blockquote>
-<screen><userinput>cat > $HLFS/etc/group << "EOF"
+<screen role="nodump"><userinput>cat > $HLFS/etc/group << "EOF"
root:x:0:
bin:x:1:
......
EOF</userinput></screen>
-<blockquote><para>This type of section is used mainly when creating
-configuration files. The first command tells the system to create
-the file <filename>$HLFS/etc/group</filename> from whatever is typed on the
following lines until
-the sequence EOF is encountered. Therefore, this whole section is generally
+<blockquote><para>This type of section is used mainly when creating
+configuration files. The first command tells the system to create
+the file <filename>$HLFS/etc/group</filename> from whatever is typed on the
following lines until
+the sequence EOF is encountered. Therefore, this whole section is generally
typed as seen.</para></blockquote>
<para><replaceable>[REPLACED TEXT]</replaceable></para>
Added: trunk/BOOK/stylesheets/dump-commands.xsl
===================================================================
--- trunk/BOOK/stylesheets/dump-commands.xsl 2005-08-04 23:30:37 UTC (rev
542)
+++ trunk/BOOK/stylesheets/dump-commands.xsl 2005-08-29 19:36:12 UTC (rev
543)
@@ -0,0 +1,84 @@
+<?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 = 'nodump'"/>
+ <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>
Property changes on: trunk/BOOK/stylesheets/dump-commands.xsl
___________________________________________________________________
Name: svn:keywords
+ "Author Date Revision Id"
--
http://linuxfromscratch.org/mailman/listinfo/hlfs-book
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page