summaryrefslogtreecommitdiff
path: root/help3xsl/get_tree.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_tree.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_tree.sh')
-rwxr-xr-xhelp3xsl/get_tree.sh128
1 files changed, 128 insertions, 0 deletions
diff --git a/help3xsl/get_tree.sh b/help3xsl/get_tree.sh
new file mode 100755
index 0000000000..58b3f48f82
--- /dev/null
+++ b/help3xsl/get_tree.sh
@@ -0,0 +1,128 @@
+#/bin/bash
+
+# This file is part of the LibreOffice project.
+#
+# 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 tree file named contents.js
+#
+# will be located in $WORKDIR/HelpTargetHTML/$productversion/$lang
+#
+#
+###########################################
+
+# $1 is Language
+# $2 is productversion
+# $3 is location of $(WORKDIR)
+
+lang=$1
+productversion=$2
+workDir=$(realpath $3)
+
+outDir=$(realpath $workDir/HelpTargetHTML/$productversion/$lang)
+sourceDir=$(realpath $workDir/HelpTreeTarget)
+
+treeFileHTML=$outDir/contents.js
+rm -f $treeFileHTML
+touch $treeFileHTML
+
+echo 'document.getElementById("Contents").innerHTML='$'\047''\'>$treeFileHTML
+
+xsltparm='--stringparam lang '$lang' --stringparam productversion '$productversion
+
+for module in sbasic scalc schart shared simpress smath swriter
+do
+
+treeSourceFile=$sourceDir'/'$module'/'$lang'.tree'
+
+treeTemp2=$(mktemp)
+
+xsltproc $xsltparm -o $treeTemp2 get_tree.xsl $treeSourceFile
+
+awk 'NF' $treeTemp2>>$treeFileHTML
+
+rm -f $treeTemp2
+done
+
+echo $'\047'';'>>$treeFileHTML
+exit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ALL_LANGS='en-US am ar ast bg bn bn-IN bo bs ca ca-valencia cs da de dz el en-GB en-ZA eo es et eu fi fr gl gu he hi hr hu id is it ja ka km ko lo lt lv mk nb ne nl nn om pl pt-BR pt ro ru sid si sk sl sq sv ta tg tr ug uk vi zh-CN zh-TW'
+
+here=$(pwd)
+root=$(realpath "$here/../..")
+
+rootTreex=$root
+exedir="${rootTreex}"/workdir/LinkTarget/Executable
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"${rootTreex}"/instdir/program
+
+
+# rm -rf $here/l10n
+rm -rf $here/html
+
+
+#
+
+
+ALL_LANGS='fr pt-BR'
+ALL_TREE='sbasic.tree scalc.tree schart.tree shared.tree simpress.tree smath.tree swriter.tree'
+for lang in $ALL_LANGS
+do
+treePOFile=`mktemp`
+echo $root/translations/source/$lang/helpcontent2/source/auxiliary.po > $treePOFile
+outDirLang=$here/html/$productversion/$lang
+mkdir -p $outDirLang
+
+for tree in $ALL_TREE
+do
+treeSourceFile=$root'/helpcontent2/source/auxiliary/'$tree
+
+outDirLang=$here/html/$productversion/$lang/$tree
+
+"${exedir}/treex" -l $lang -i $treeSourceFile -m $treePOFile -o $outDirLang
+done
+# rm -f $treePOFile
+done
+exit
+rm -f $treeSourceFiles
+
+exit
+pofiles=/tmp/pofiles.txt
+xhpfiles=/tmp/xhpfiles.txt
+# mkdir -p $here/html
+# mkdir -p $here'/html/'$productversion