From 9f002646e39e17b942cb161a8ada91c42c0d2aea Mon Sep 17 00:00:00 2001 From: David Priest Date: Thu, 14 Mar 2013 13:08:41 -0700 Subject: [PATCH] Add 'init' command to configure env vars and fop configuration ..use "source [toolspath]/init.sh" in bash ..use "call [toolspath]\init.bat" in Windows ..see docs repos for examples --- init.bat | 13 +++-- init.sh | 6 +- init.xsl | 21 +++++++ mksupport-common/fop.bash.conf | 56 ------------------- .../{fop.win.conf => fop.conf.template} | 4 +- mksupport-common/mk_bash.sh | 5 +- mksupport-common/mk_diff.sh | 6 +- mksupport-common/mk_win.bat | 15 +++-- mksupport-common/xsl/chunked.xsl | 6 +- mksupport-common/xsl/html/common-html.xsl | 1 + 10 files changed, 52 insertions(+), 81 deletions(-) create mode 100644 init.xsl delete mode 100644 mksupport-common/fop.bash.conf rename mksupport-common/{fop.win.conf => fop.conf.template} (96%) diff --git a/init.bat b/init.bat index 027ae7a..00fe03f 100644 --- a/init.bat +++ b/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 diff --git a/init.sh b/init.sh index f9ce920..4f424ce 100755 --- a/init.sh +++ b/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 diff --git a/init.xsl b/init.xsl new file mode 100644 index 0000000..944088f --- /dev/null +++ b/init.xsl @@ -0,0 +1,21 @@ + + + + + + + /mksupport-common/ + + + + + + /mksupport-common/fonts/ + + + + + + + + diff --git a/mksupport-common/fop.bash.conf b/mksupport-common/fop.bash.conf deleted file mode 100644 index 23be580..0000000 --- a/mksupport-common/fop.bash.conf +++ /dev/null @@ -1,56 +0,0 @@ - - - ./ - /Users/mandiant/dev/tools/mksupport-common/fonts/ - true - 72 - 72 - - - true - - - - flate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mksupport-common/fop.win.conf b/mksupport-common/fop.conf.template similarity index 96% rename from mksupport-common/fop.win.conf rename to mksupport-common/fop.conf.template index 6c39610..67231e1 100644 --- a/mksupport-common/fop.win.conf +++ b/mksupport-common/fop.conf.template @@ -1,7 +1,7 @@ - . - c:/dev/tools/mksupport-common/fonts/ + ./mksupport-common/ + ./mksupport-common/fonts/ true 72 72 diff --git a/mksupport-common/mk_bash.sh b/mksupport-common/mk_bash.sh index 31c3fa9..e2474af 100755 --- a/mksupport-common/mk_bash.sh +++ b/mksupport-common/mk_bash.sh @@ -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/* diff --git a/mksupport-common/mk_diff.sh b/mksupport-common/mk_diff.sh index 78c39f1..d633ee1 100644 --- a/mksupport-common/mk_diff.sh +++ b/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" diff --git a/mksupport-common/mk_win.bat b/mksupport-common/mk_win.bat index d5c3471..1e17e4c 100644 --- a/mksupport-common/mk_win.bat +++ b/mksupport-common/mk_win.bat @@ -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% @@ -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% \ No newline at end of file +REM a2x.py -f htmlhelp --stylesheet="docbook-xsl.css mksupport/custom.css" --destination-dir=output\chm %cmdrest% + +ENDLOCAL \ No newline at end of file diff --git a/mksupport-common/xsl/chunked.xsl b/mksupport-common/xsl/chunked.xsl index 5c04d67..557fd49 100644 --- a/mksupport-common/xsl/chunked.xsl +++ b/mksupport-common/xsl/chunked.xsl @@ -13,9 +13,9 @@ - images/icons/ - images/icons/ - + + +
diff --git a/mksupport-common/xsl/html/common-html.xsl b/mksupport-common/xsl/html/common-html.xsl index 66f90c6..4e189f5 100644 --- a/mksupport-common/xsl/html/common-html.xsl +++ b/mksupport-common/xsl/html/common-html.xsl @@ -8,6 +8,7 @@ +