Skip to content

Commit

Permalink
Add 'init' command to configure env vars and fop configuration
Browse files Browse the repository at this point in the history
..use "source [toolspath]/init.sh" in bash
..use "call [toolspath]\init.bat" in Windows
..see docs repos for examples
  • Loading branch information
David Priest committed Mar 14, 2013
1 parent 5262d2d commit 9f00264
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 81 deletions.
13 changes: 9 additions & 4 deletions init.bat
@@ -1,6 +1,11 @@
@ECHO OFF
SET DOCTOOLS=%CD%
SET XMLSH=%PWD%/xmlsh
SET PATH=%DOCTOOLS%/xmlsh/unix;%DOCTOOLS%/fop;%DOCTOOLS%/asciidoc;%DOCTOOLS%/xsltproc;$PATH
SET XML_CATALOG_FILES=%DOCTOOLS%/CATALOG.XML
REM Use Strawberry Perl's portable shell launcher to set DOCTOOLS
SET here=%~dp0
SET DOCTOOLS=%here%
IF #%here:~-1%# == #\# SET DOCTOOLS=%here:~0,-1%

SET XMLSH=%DOCTOOLS%\xmlsh
SET PATH=%DOCTOOLS%\asciidoc;%DOCTOOLS%\fop;%DOCTOOLS%\xsltproc;%DOCTOOLS%\xmlsh\win32;%PATH%
SET XML_CATALOG_FILES=%DOCTOOLS%\CATALOG.XML

xsltproc --stringparam DOCTOOLS %DOCTOOLS% %DOCTOOLS%\init.xsl %DOCTOOLS%\mksupport-common\fop.conf.template > %DOCTOOLS%\mksupport-common\fop.win.conf
6 changes: 4 additions & 2 deletions init.sh
@@ -1,5 +1,7 @@
#!/bin/bash
export DOCTOOLS=$PWD
export XMLSH=$PWD/xmlsh
export DOCTOOLS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export XMLSH=$DOCTOOLS/xmlsh
export PATH=$DOCTOOLS/asciidoc:$DOCTOOLS/fop:$DOCTOOLS/xmlsh/unix:$PATH
export XML_CATALOG_FILES=$DOCTOOLS/CATALOG.XML

xsltproc --stringparam DOCTOOLS $DOCTOOLS $DOCTOOLS/init.xsl $DOCTOOLS/mksupport-common/fop.conf.template > $DOCTOOLS/mksupport-common/fop.bash.conf
21 changes: 21 additions & 0 deletions init.xsl
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="DOCTOOLS"/>
<xsl:template match="base">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:value-of select="$DOCTOOLS"/><xsl:text>/mksupport-common/</xsl:text>
</xsl:copy>
</xsl:template>
<xsl:template match="font-base">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:value-of select="$DOCTOOLS"/><xsl:text>/mksupport-common/fonts/</xsl:text>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
56 changes: 0 additions & 56 deletions mksupport-common/fop.bash.conf

This file was deleted.

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<fop version="1.0">
<base>.</base>
<font-base>c:/dev/tools/mksupport-common/fonts/</font-base>
<base>./mksupport-common/</base>
<font-base>./mksupport-common/fonts/</font-base>
<strict-configuration>true</strict-configuration>
<source-resolution>72</source-resolution>
<target-resolution>72</target-resolution>
Expand Down
5 changes: 2 additions & 3 deletions mksupport-common/mk_bash.sh
Expand Up @@ -8,9 +8,8 @@
DOCUMENT=$1
shift
EXTRA=$*
export XML_CATALOG_FILES=$DOCTOOLS/CATALOG.XML
export XML_DEBUG_CATALOG=1
export PATH=$DOCTOOLS/fop:$DOCTOOLS/asciidoc:$PATH

[ -z "$DOCTOOLS" ] && source ../init.sh

mkdir -p output
rm -rf output/*
Expand Down
6 changes: 1 addition & 5 deletions mksupport-common/mk_diff.sh
@@ -1,9 +1,5 @@
#!/bin/bash
export DOCTOOLS=$PWD/../tools
export PATH=$DOCTOOLS/asciidoc:$DOCTOOLS/fop:$PATH
export XML_CATALOG_FILES=$DOCTOOLS/CATALOG.XML


[ -z "$DOCTOOLS" ] && source ../init.sh

java -cp $DOCTOOLS/diffmk/bin/diffmk.jar net.sf.diffmk.DiffMk --ignorewhitespace "$1" "$2" "output/DIFF.xml"

Expand Down
15 changes: 9 additions & 6 deletions mksupport-common/mk_win.bat
Expand Up @@ -5,20 +5,21 @@ REM set DOCTOOLS=%CD%\..\tools
REM The values above are set in the source directory's mk_win.bat stub
REM Configure values above; do not modify below this line

SETLOCAL

set DOCUMENT=%1
set EXTRA=%2 %3 %4 %5 %6 %7 %8 %9
set XML_CATALOG_FILES=%DOCTOOLS%\CATALOG.XML
IF NOT _%TOOLPATHREST%==_1 set PATH=%DOCTOOLS%\fop;%DOCTOOLS%\asciidoc;%DOCTOOLS%\xsltproc;%PATH%
set TOOLPATHREST=1

IF %DOCTOOLS%=="" CALL ..\init.bat

rd /q /s %CD%\output
md %CD%\output

REM a2x commands are similar for all output
set cmdrest=--conf-file=%DOCTOOLS%\mksupport-common\a2x.win.conf --icons-dir=%DOCTOOLS%\mksupport-common\icons --resource=%DOCTOOLS%\mksupport-common\images --no-xmllint --safe %EXTRA% %DOCUMENT%
set cmdrest=--conf-file=%DOCTOOLS%\mksupport-common\a2x.win.conf --icons-dir=%DOCTOOLS%\mksupport-common\icons --resource=%DOCTOOLS%\mksupport-common\images --no-xmllint --safe %EXTRA% %DOCUMENT%

echo Transforming to Draft PDF
a2x.py -k -v -v -f pdf --fop --xsl-file=%CD%\mksupport\xsl\fo.xsl --destination-dir=output %cmdrest%
a2x.py -k -v -v -f pdf --fop --xsl-file=mksupport\xsl\fo.xsl --destination-dir=output %cmdrest%

echo Transforming to EPub
a2x.py -k -f epub --xsl-file=mksupport\xsl\epub.xsl --destination-dir=output %cmdrest%
Expand All @@ -32,4 +33,6 @@ a2x.py -f xhtml --xsl-file=mksupport\xsl\xhtml.xsl --destination-dir=output\html

REM echo Transforming to HTMLHelp/CHM
REM md output\chm
REM a2x.py -f htmlhelp --stylesheet="docbook-xsl.css mksupport/custom.css" --destination-dir=output\chm %cmdrest%
REM a2x.py -f htmlhelp --stylesheet="docbook-xsl.css mksupport/custom.css" --destination-dir=output\chm %cmdrest%

ENDLOCAL
6 changes: 3 additions & 3 deletions mksupport-common/xsl/chunked.xsl
Expand Up @@ -13,9 +13,9 @@
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
<xsl:import href="html/common-html.xsl"/>

<xsl:param name="navig.graphics.path">images/icons/</xsl:param>
<xsl:param name="admon.graphics.path">images/icons/</xsl:param>
<xsl:param name="callout.graphics.path" select="'images/icons/callouts/'"/>
<xsl:param name="navig.graphics.path" select="concat('file://',$DOCTOOLS,'/mksupport-common/icons/')"/>
<xsl:param name="admon.graphics.path" select="concat('file://',$DOCTOOLS,'/mksupport-common/icons/')"/>
<xsl:param name="callout.graphics.path" select="concat('file://',$DOCTOOLS,'/mksupport-common/icons/callouts/')"/>

<xsl:template match="para[@role='review']">
<div class="review">
Expand Down
1 change: 1 addition & 0 deletions mksupport-common/xsl/html/common-html.xsl
Expand Up @@ -8,6 +8,7 @@
<xsl:param name="html.stylesheet" select="'docbook-xsl.css'"/>

<xsl:param name="admon.graphics.path" select="concat('file://',$DOCTOOLS,'/mksupport-common/icons/')"/>
<xsl:param name="callout.graphics.path" select="concat('file://',$DOCTOOLS,'/mksupport-common/icons/callouts/')"/>

<xsl:param name="htmlhelp.chm" select="'htmlhelp.chm'"/>
<xsl:param name="htmlhelp.hhc.section.depth" select="5"/>
Expand Down

0 comments on commit 9f00264

Please sign in to comment.