#!/bin/sh

scriptDir=`dirname "$0"`
docsrcDir="$scriptDir/../../docsrc/manual"

whc="java -jar $scriptDir/../../lib/whc.jar"

copyRes="cp -r $scriptDir/images \
$scriptDir/toc.xml \
$scriptDir/index.xml \
$scriptDir/schema \
$scriptDir/wh_resources"

rm -rf "$scriptDir/out"/*

### classic ---

outDir="$scriptDir/out/classic"
echo "Generating Web Help in '$outDir'..."

mkdir "$outDir"

$whc -toc "$scriptDir/toc.xml" -index "$scriptDir/index.xml" \
    "$outDir" "$docsrcDir"/*.html

$copyRes "$outDir"

### simple ---

outDir="$scriptDir/out/simple"
echo "Generating Web Help in '$outDir'..."

mkdir "$outDir"

$whc -p layout simple \
    -toc "$scriptDir/toc.xml" \
    "$outDir" "$docsrcDir"/*.html

$copyRes "$outDir"

### corporate ---

outDir="$scriptDir/out/corporate"
echo "Generating Web Help in '$outDir'..."

mkdir "$outDir"

$whc -p layout corporate \
    -toc "$scriptDir/toc.xml" -index "$scriptDir/index.xml" \
    "$outDir" "$docsrcDir"/*.html

$copyRes "$outDir"

### ==========================================================================
### classic_l ---

outDir="$scriptDir/out/classic_l"
echo "Generating Web Help in '$outDir'..."

mkdir "$outDir"

tabLabels="-p --tab-icon-font-weight bold \
-p --tab-icon-size 16px \
-p --tab-icon-text-gap 4px"

$whc $tabLabels \
    -toc "$scriptDir/toc.xml" -index "$scriptDir/index.xml" \
    "$outDir" "$docsrcDir"/*.html

$copyRes "$outDir"

### simple_h ---

outDir="$scriptDir/out/simple_h"
echo "Generating Web Help in '$outDir'..."

mkdir "$outDir"

# Same foreground as in xmlmind.css.
headerFooter="-p --navigation-color #212529 \
-p user-css $scriptDir/wh_resources/xmlmind.css \
-p user-header $scriptDir/wh_resources/header.html \
-p user-footer $scriptDir/wh_resources/footer.html \
-p user-resources $scriptDir/wh_resources/header_footer_files"

$whc -p layout simple \
    $headerFooter \
    -toc "$scriptDir/toc.xml" \
    "$outDir" "$docsrcDir"/*.html

$copyRes "$outDir"

### classic_hc ---

outDir="$scriptDir/out/classic_hc"
echo "Generating Web Help in '$outDir'..."

mkdir "$outDir"

customColors="-p --navigation-background-color #F6FAFD \
-p --field-background-color #F6FAFD \
-p --panel-background-color #E3F5FF \
-p --tab-selected-color #2176BB"

$whc $headerFooter \
    $customColors \
    -toc "$scriptDir/toc.xml" -index "$scriptDir/index.xml" \
    "$outDir" "$docsrcDir"/*.html

$copyRes "$outDir"

### corporate_green ---
# "Palatino, Palatino Linotype, Palatino LT STD, Book Antiqua, Georgia, serif"

outDir="$scriptDir/out/corporate_green"
echo "Generating Web Help in '$outDir'..."

mkdir "$outDir"

corpSettings="-p user-css $scriptDir/wh_resources/xmlmind.css \
-p --corp-font-family Palatino,Georgia,serif \
-p --corp-background-color #edf7ee \
-p --corp-color #202124 \
-p --corp-accent-color #16803b \
-p --corp-font-size 15px \
-p --corp-heading-color #16803b \
-p --corp-tabs-background-color #c4e1c5 \
-p --corp-hover-background-color #a8d3aa \
-p --corp-hover-border-color #70b673 \
-p --corp-border-color #9fb5a0"

$whc -p layout corporate \
    $corpSettings \
    -toc "$scriptDir/toc.xml" -index "$scriptDir/index.xml" \
    "$outDir" "$docsrcDir"/*.html

$copyRes "$outDir"

