setlocal
@echo off

rem
rem Please edit the 3 following variables to reflect where:
rem
rem * The DocBook XSL stylesheets v1.79.1 for DocBook v5+ (i.e. with namespace)
rem   https://sourceforge.net/projects/docbook/
rem
rem * Saxon 6.5.5
rem   http://saxon.sourceforge.net/saxon6.5.5/index.html
rem
rem * Apache FOP 1.1, 2.0 or 2.1
rem   https://xmlgraphics.apache.org/fop/download.html
rem
rem have been installed.
rem

set DOCBOOK_XSL=C:\opt\docbook-xsl-ns-1.79.1

set SAXON=java -cp C:\opt\saxon6-5-5\saxon.jar com.icl.saxon.StyleSheet

set FOP=C:\opt\fop-2.1\fop.bat

rem ---

del /Q ..\..\doc\manual\*.*

rd /s /q ..\..\doc\manual\images

mkdir ..\..\doc\manual\images

copy images\*.* ..\..\doc\manual\images

rem ---

echo Generating HTML...
echo ------------------

call ..\..\bin\assembly -check -v -format web manual.xml out\manual_realized_web.xml

%SAXON% -o ..\..\doc\manual\index.html out\manual_realized_web.xml "%DOCBOOK_XSL%\html\chunk.xsl" base.dir=../../doc/manual/ chunk.section.depth=0 section.autolabel=1 section.label.includes.component.label=1 use.id.as.filename=1 html.stylesheet=html.css callout.graphics=0

copy html.css ..\..\doc\manual\html.css

rem ---

echo Generating PDF...
echo -----------------

call ..\..\bin\assembly -check -v manual.xml out\manual_realized.xml

%SAXON% -o out\manual_realized.fo out\manual_realized.xml "%DOCBOOK_XSL%\fo\docbook.xsl" paper.type=A4 section.autolabel=1 section.label.includes.component.label=1 variablelist.as.blocks=1 ulink.show=0 callout.graphics=0 shade.verbatim=1

call "%FOP%" -fo out\manual_realized.fo -pdf ..\..\doc\manual\manual.pdf
