mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-05 07:07:41 +00:00
Fixes #4558. This makes a number of fixes to get the context help working correctly in Keyman 14: 1. Adds support for `redirect:` header in help .md files so that we can do redirects for the context content in Keyman for Windows help in the lua filters. 2. Renames Keyman for Windows help files to .htm, because that's what the .chm format is expecting, and what Delphi assumes for its .chm integration, and thus splits the html and htm lua filters. 3. Renames and makes more consistent the various context help pages. 4. Adds redirects for all pages that have sufficient content on other pages. 5. Fixes the instantiation of help in various Keyman for Windows forms. 6. Defaults to opening help from the Keyman source repo if the calling app is running in the source repo (this is just a development-side tweak that simplifies my life).
108 lines
2.1 KiB
Bash
108 lines
2.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Set sensible script defaults:
|
|
# set -e: Terminate script if a command returns an error
|
|
set -e
|
|
# set -u: Terminate script if an unset variable is used
|
|
set -u
|
|
|
|
## START STANDARD BUILD SCRIPT INCLUDE
|
|
# adjust relative paths as necessary
|
|
THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
|
|
. "$(dirname "$THIS_SCRIPT")/../resources/build/build-utils.sh"
|
|
## END STANDARD BUILD SCRIPT INCLUDE
|
|
|
|
QUIET=0
|
|
|
|
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"
|
|
|
|
THIS_DIR="$(dirname "$THIS_SCRIPT")"
|
|
|
|
display_usage() {
|
|
echo "build.sh [--no-clean] target [...target]"
|
|
echo "Builds help documentation for Keyman for Android"
|
|
echo "Targets:"
|
|
echo " * htm or html: convert documentation to html using pandoc"
|
|
echo
|
|
echo " --no-clean: don't clean target folder before building"
|
|
}
|
|
|
|
DO_HTM=false
|
|
DO_CLEAN=true
|
|
|
|
# Debug flags
|
|
DO_HTM_CONVERSION=true
|
|
|
|
#
|
|
# Parse args
|
|
#
|
|
|
|
shopt -s nocasematch
|
|
|
|
while [[ $# -gt 0 ]] ; do
|
|
key="$1"
|
|
case $key in
|
|
htm | html)
|
|
DO_HTM=true
|
|
;;
|
|
--no-clean)
|
|
DO_CLEAN=false
|
|
;;
|
|
*)
|
|
display_usage
|
|
exit 1
|
|
esac
|
|
shift # past argument
|
|
done
|
|
|
|
if ! $DO_HTM ; then
|
|
display_usage
|
|
exit 1
|
|
fi
|
|
|
|
displayInfo "" \
|
|
"DO_HTM: $DO_HTM" \
|
|
"DO_CLEAN: $DO_CLEAN" \
|
|
""
|
|
|
|
#
|
|
# Compile all .md to .html
|
|
#
|
|
|
|
cd $KEYMAN_ROOT/android/help
|
|
|
|
MDLUA="$KEYMAN_ROOT/resources/build/html-link.lua"
|
|
MD=`find -name "*.md"`
|
|
DESTHTM="$THIS_DIR/KMAPro/kMAPro/src/main/assets/info"
|
|
|
|
if $DO_HTM; then
|
|
#
|
|
# Clean existing folder
|
|
#
|
|
|
|
if $DO_CLEAN; then
|
|
rm -rf "$DESTHTM" || true # We don't want to die when we clean an empty folder
|
|
fi
|
|
mkdir -p "$DESTHTM"
|
|
|
|
#
|
|
# Generate HTML files from Markdown
|
|
#
|
|
|
|
if $DO_HTM_CONVERSION; then
|
|
for INFILE in $MD; do
|
|
OUTFILE="$DESTHTM/${INFILE%.md}.html"
|
|
echo "Processing $INFILE to $(basename "$OUTFILE")"
|
|
mkdir -p "$(dirname "$OUTFILE")"
|
|
pandoc -s --lua-filter="$MDLUA" -t html -o "$OUTFILE" $INFILE
|
|
done
|
|
fi
|
|
|
|
#
|
|
# Copy Images
|
|
#
|
|
cd $KEYMAN_ROOT/android/help/
|
|
mkdir -p "$DESTHTM/android_images"
|
|
cp android_images/* "$DESTHTM/android_images/"
|
|
|
|
fi
|