[Libreoffice-commits] help.git: help3xsl/xhp2html.sh

Olivier Hallot olivier.hallot at libreoffice.org
Mon Nov 13 17:56:04 UTC 2017


 help3xsl/xhp2html.sh |   69 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 67 insertions(+), 2 deletions(-)

New commits:
commit ac105fe860f05e66f574e135fa6fcb738db9347f
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
Date:   Sat Nov 11 13:30:17 2017 -0200

    Fix script for online version of new help
    
    Change-Id: I9a395dbc88b6c2606b2a7fca1d829b10922e4674
    Reviewed-on: https://gerrit.libreoffice.org/44630
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3xsl/xhp2html.sh b/help3xsl/xhp2html.sh
index 9e90a0aa2..98622376b 100755
--- a/help3xsl/xhp2html.sh
+++ b/help3xsl/xhp2html.sh
@@ -18,6 +18,70 @@
 #
 # convert2HTML $outDirLang $outDirHTML $lang $productversion $online $fileTree &
 
+function get_bookmark(){
+lang=$1
+productversion=$2
+#workDir=$(realpath $3)
+workDir=$(pwd)
+
+outDir=$(realpath $workDir/html/$productversion/$lang)
+#sourceDir=$(realpath $workDir/l10n/$lang/helpcontent2/source)
+sourceDir=$(realpath $workDir/l10n/$productversion/$lang)
+
+bookmarkFile=$outDir/bookmarks.js
+mkdir -p $outDir
+
+rm -f $bookmarkFile
+touch $bookmarkFile
+
+stub2=\'
+
+xslfile=get_bookmark.xsl
+
+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:]')
+param=$param1' --stringparam app '$i
+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='\'\\
+tempFile=$(mktemp)
+param=$param1' --stringparam app SHARED'
+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='\'\\
+tempFile=$(mktemp)
+param=$param1' --stringparam app BASE'
+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
+}
+
+
 function convert2HTML() {
 #outDirLang =1
 #outDirHTML =2
@@ -92,11 +156,12 @@ echo 'Conversion to HTML finished for '$3
 # Change root of git core
 productversion='6.0'
 local='no'
-fileTree='/home/tdf/git/core/helpcontent2/help3xsl/html/'
+fileTree='/'
 
 rootHelpex=/home/tdf/git/core
 
 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/../..")
 
@@ -209,7 +274,7 @@ fi
 
 #extracting bookmarks
 echo 'Extracting bookmarks'
-./get_bookmark.sh $lang $productversion &
+get_bookmark $lang $productversion $(pwd)/html &
 
 # converting to HTML
 convert2HTML $outDirLang $outDirHTML $lang $productversion $local $fileTree &


More information about the Libreoffice-commits mailing list