mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-07-08 13:29:57 +01:00
Updated Makefile and related files.
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/6.1.1/BOOK@7053 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
e13f18852c
commit
effd9c6f93
28
INSTALL
28
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
|
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
|
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-
|
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
|
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
|
document. Instead, you need to read the LFS Editor's Manual. See the LFS
|
||||||
website at http://www.linuxfromscratch.org for more information.
|
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
|
* libxml2
|
||||||
- http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html
|
- 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
|
- 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
|
If you want to convert the XML to TXT, install the above items, and then install
|
||||||
- http://www.linuxfromscratch.org/blfs/view/svn/general/j2sdk.html
|
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
|
- http://www.linuxfromscratch.org/blfs/view/svn/pst/fop.html
|
||||||
|
|
||||||
|
11
Makefile
11
Makefile
@ -1,4 +1,5 @@
|
|||||||
BASEDIR=~/lfs-book
|
BASEDIR=~/lfs-book
|
||||||
|
DUMPDIR=~/lfs-commands
|
||||||
CHUNK_QUIET=0
|
CHUNK_QUIET=0
|
||||||
PDF_OUTPUT=LFS-BOOK.pdf
|
PDF_OUTPUT=LFS-BOOK.pdf
|
||||||
NOCHUNKS_OUTPUT=LFS-BOOK.html
|
NOCHUNKS_OUTPUT=LFS-BOOK.html
|
||||||
@ -27,9 +28,7 @@ lfs:
|
|||||||
for filename in `find $(BASEDIR) -name "*.html"`; do \
|
for filename in `find $(BASEDIR) -name "*.html"`; do \
|
||||||
tidy -config tidy.conf $$filename; \
|
tidy -config tidy.conf $$filename; \
|
||||||
true; \
|
true; \
|
||||||
done;
|
sh obfuscate.sh $$filename; \
|
||||||
|
|
||||||
for filename in `find $(BASEDIR) -name "*.html"`; do \
|
|
||||||
sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
||||||
done;
|
done;
|
||||||
|
|
||||||
@ -50,9 +49,15 @@ nochunks:
|
|||||||
|
|
||||||
tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
||||||
|
|
||||||
|
sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
||||||
|
|
||||||
sed -i -e "s@text/html@application/xhtml+xml@g" \
|
sed -i -e "s@text/html@application/xhtml+xml@g" \
|
||||||
$(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
$(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
||||||
|
|
||||||
|
dump-commands:
|
||||||
|
xsltproc --xinclude --nonet --output $(DUMPDIR)/ \
|
||||||
|
stylesheets/dump-commands.xsl index.xml
|
||||||
|
|
||||||
validate:
|
validate:
|
||||||
xmllint --noout --nonet --xinclude --postvalid index.xml
|
xmllint --noout --nonet --xinclude --postvalid index.xml
|
||||||
|
|
||||||
|
18
README
18
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
|
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
|
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:
|
XML to XHTML:
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
make BASEDIR=/path/to/output/location
|
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:
|
XML to PDF:
|
||||||
-----------
|
-----------
|
||||||
|
make BASEDIR=/path/to/output/location pdf
|
||||||
make pdf &&
|
|
||||||
cp lfs.pdf /path/to/output/location
|
|
||||||
|
35
obfuscate.sh
Normal file
35
obfuscate.sh
Normal file
@ -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
|
83
stylesheets/dump-commands.xsl
Normal file
83
stylesheets/dump-commands.xsl
Normal file
@ -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>
|
Loading…
Reference in New Issue
Block a user