summaryrefslogtreecommitdiff
path: root/help3xsl/get_bookmark.sh
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2017-10-31 11:14:57 -0200
committerOlivier Hallot <olivier.hallot@libreoffice.org>2017-11-01 17:19:02 +0100
commit788f70916eaa53d89775c5998a4d19235ed19f4a (patch)
tree740dc836b87e8a7a3139f91abb93d71387ae215b /help3xsl/get_bookmark.sh
parent305f83a24245f6e8889a33bab2f8d4657b8b2767 (diff)
Refactor new help builder script into smaller pieces
Add 4 smaller bash scripts for building new help, for better management Scripts use the following parameters workDir: $(WORKDIR) lang: $(LANG) productVersion: 6.0 and put results in $(WORKDIR)/HelpTargetHTML ./get_hid2file.sh $productVersion $workDir Creates hid2file.js that maps HID into HTML page uses get_url.xsl transform ./get_bookmark.sh $lang $productVersion $workDir Creates the index file 'bookmarks.js' based on <bookmark_values> tag in all localized XHP files. Visible in Index tab of the HTML page Uses get_bookmark.xsl transform. ./get_html.sh $lang $productVersion $workDir $local $fileTree Creates the HTML pages from localized XHP files local: is local or website (yes/no) If local="yes", the filetree should be $(installDir) else (i.e. website), root file tree should be '/' fileTree: is root file tree for $local=yes If local = yes, then language selector, PIWIK probe and global search services are removed. Uses: online_transform.xsl transform ./get_tree.sh $lang $productVersion $workDir Creates the contents.js from localized TREE files Visible in Contents tab of the HTML page Uses get_tree.xsl transform ./get_media.sh $lang $productVersion $workDir Copy several auxiliary files for navigation Copy HC2 media files Copy galaxy icon theme for HTML pages * minor change in file name hid2file.js Added 2 more small scripts to show how to build local and online ./makelocal.sh ./makeonline.sh Languages depends on the languages available in $(WORKDIR)/HelpTranslatePartTarget/, and includes qtz. will handle special case of en-US later Change-Id: I0b7fdf5e1460070413eb2303f8d69b2b85a40c3e Reviewed-on: https://gerrit.libreoffice.org/44114 Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org> Tested-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/get_bookmark.sh')
-rwxr-xr-xhelp3xsl/get_bookmark.sh75
1 files changed, 47 insertions, 28 deletions
diff --git a/help3xsl/get_bookmark.sh b/help3xsl/get_bookmark.sh
index e4d3fee100..652cef1bb6 100755
--- a/help3xsl/get_bookmark.sh
+++ b/help3xsl/get_bookmark.sh
@@ -5,56 +5,75 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
+#
+###########################################
+#
+# Create the file bookmarks.js containing the links between the
+# keywords found in <bookmark_value> and the html help page.
+# The file is used in the Index tab of the html help page
+#
+###########################################
+#
# $1 is Language
# $2 is productversion
+# $3 is location of $(WORKDIR)
-outdir=`pwd`'/html/'$2'/'$1
+lang=$1
+productversion=$2
+workDir=$(realpath $3)
+
+outDir=$(realpath $workDir/HelpTargetHTML/$productversion/$lang)
+sourceDir=$(realpath $workDir/HelpTranslatePartTarget/$lang/helpcontent2/source)
+
+bookmarkFile=$outDir/bookmarks.js
+mkdir -p $outDir
+
+rm -f $bookmarkFile
+touch $bookmarkFile
-# mkdir -p $outdir
-sourcedir=`pwd`'/l10n/'$2'/'$1
-ffile=$outdir'/bookmarks.js'
-rm -f $ffile
-ffile2=/tmp/temp.html
stub2=\'
+
xslfile=get_bookmark.xsl
-param1=' --stringparam Language '$1' --stringparam productversion '$2
+param1=' --stringparam Language '$lang' --stringparam productversion '$productversion
# bookmarks for modules
for i in CALC CHART WRITER DRAW IMPRESS MATH BASIC
do
stub1='document.getElementById("bookmark'$i'").innerHTML='\'\\
-sfind=$sourcedir'/'`echo 'text/s'$i | tr '[:upper:]' '[:lower:]'`
+sfind=$sourceDir'/'$(echo 'text/s'$i | tr '[:upper:]' '[:lower:]')
param=$param1' --stringparam app '$i
-rm -f $ffile2
-find $sfind -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $ffile2
-echo $stub1 >> $ffile
-sort -k3b -t\> -s -o $ffile2 $ffile2
-awk 'NF' $ffile2 >> $ffile
-echo $stub2 >> $ffile
+tempFile=$(mktemp)
+find $sfind -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $tempFile
+echo $stub1 >> $bookmarkFile
+sort -k3b -t\> -s -o $tempFile $tempFile
+awk 'NF' $tempFile >> $bookmarkFile
+echo $stub2 >> $bookmarkFile
+rm -f $tempFile
done
# Case of SHARED
stub1='document.getElementById("bookmarkSHARED").innerHTML='\'\\
-rm -f $ffile2
+tempFile=$(mktemp)
param=$param1' --stringparam app SHARED'
-find $sourcedir'/text/shared' -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $ffile2
-echo $stub1 >> $ffile
-sort -k3b -t\> -s -o $ffile2 $ffile2
-awk 'NF' $ffile2 >> $ffile
-echo $stub2 >> $ffile
+find $sourceDir'/text/shared' -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $tempFile
+echo $stub1 >> $bookmarkFile
+sort -k3b -t\> -s -o $tempFile $tempFile
+awk 'NF' $tempFile >> $bookmarkFile
+echo $stub2 >> $bookmarkFile
+rm -f $tempFile
# Case of Explorer (BASE)
stub1='document.getElementById("bookmarkBASE").innerHTML='\'\\
-rm -f $ffile2
+tempFile=$(mktemp)
param=$param1' --stringparam app BASE'
-find $sourcedir'/text/shared/explorer/database' -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $ffile2
-echo $stub1 >> $ffile
-sort -k3b -t\> -s -o $ffile2 $ffile2
-awk 'NF' $ffile2 >> $ffile
-echo $stub2 >> $ffile
-rm -f $ffile2
+find $sourceDir'/text/shared/explorer/database' -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $tempFile
+echo $stub1 >> $bookmarkFile
+sort -k3b -t\> -s -o $tempFile $tempFile
+awk 'NF' $tempFile >> $bookmarkFile
+echo $stub2 >> $bookmarkFile
+rm -f $tempFile
+exit