summaryrefslogtreecommitdiff
path: root/help3xsl/xhp2html.sh
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2017-07-11 10:25:45 -0300
committerOlivier Hallot <olivier.hallot@edx.srv.br>2017-07-11 15:29:48 +0200
commit551a5fdaba7c7b86b41daafd4574e7b1649c11d5 (patch)
treeb2bbb062522dd2c953a7f66218a2c9fd1fa688e3 /help3xsl/xhp2html.sh
parentadc9f8c1cd429d2b3aea19efc8f5e7010a951240 (diff)
Help-in-browser (vii) more improvements
see it in http://helponline.libreoffice.org Added mos keywords from schema.org New, responsive page design Change-Id: I9df963c1a962c0fbb5c2926d8066b31cd20d485b Reviewed-on: https://gerrit.libreoffice.org/39822 Reviewed-by: Olivier Hallot <olivier.hallot@edx.srv.br> Tested-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Diffstat (limited to 'help3xsl/xhp2html.sh')
-rwxr-xr-xhelp3xsl/xhp2html.sh98
1 files changed, 72 insertions, 26 deletions
diff --git a/help3xsl/xhp2html.sh b/help3xsl/xhp2html.sh
index 5806746514..09651adb17 100755
--- a/help3xsl/xhp2html.sh
+++ b/help3xsl/xhp2html.sh
@@ -9,20 +9,39 @@
# This script builds translated XHP file with helpex excutable
# and thes transform it to html pages
# 1) generates redirection from LibreOffice Help URL to right html page
-# in index.html with bookmark2file.js
-# 2) generates bookmark_<APP>.js for indes search
-# 3) generates HTML pahes with online_transform.xs
+# in index.html with bookmark2file.js
+# 2) generates bookmark_<APP>.js for index search
+# 3) generates HTML pages with online_transform.xs
# 4) copy service files (css, js, media) to right place.
#
-# Note: change root variable to your local git build
+# Note: change rootHelpex variable to your local git build
#
+function convert2HTML() {
+#outDirLang =1
+#outDirHTML =2
+
+xsltparm='--stringparam Language '$lang' --stringparam productversion '$productversion' --stringparam root '$outDirLang'/'
+echo 'Converting to HTMLi started'
+for filep in `find $1/text -name "*.xhp"`
+do
+DIR=${filep##*text/}
+name=${DIR:0:-3}
+outFile=$2'/text/'$name'html'
+xsltproc $xsltparm -o $outFile online_transform.xsl $filep
+done
+echo 'Conversion to HTML finished'
+}
+
productversion='6.0'
-root=/home/tdf/git/core
+rootHelpex=/home/tdf/git/core
-ALL_LANGS='en-US af am ar as ast be bg bn bn-IN bo br brx bs ca ca-valencia cs cy da de dgo dz el en-GB en-ZA eo es et eu fa fi fr ga gd gl gu gug he hsb hi hr hu id is it ja ka kk km kmr-Latn kn ko kok ks lb lo lt lv mai mk ml mn mni mr my nb ne nl nn nr nso oc om or pa-IN pl pt pt-BR ro ru rw sa-IN sat sd sr-Latn si sid sk sl sq sr ss st sv sw-TZ ta te tg th tn tr ts tt ug uk uz ve vec vi xh zh-CN zh-TW zu'
+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/../..")
+
+
rm -rf $here/l10n
rm -rf $here/html
@@ -30,7 +49,40 @@ helpfiles=$root/helpcontent2/source/text
pofiles=/tmp/pofiles.txt
xhpfiles=/tmp/xhpfiles.txt
-mkdir -p $here/ html
+# mkdir -p $here/html
+mkdir -p $here'/html/'$productversion
+
+echo 'copy global service files'
+cp index.html $here'/html/'
+cp help.js $here'/html/'$productversion'/'
+cp jquery-3.1.1.min.js $here'/html/'$productversion'/'
+cp tabs.js $here'/html/'$productversion'/'
+cp default.css $here'/html/'$productversion'/'
+
+cp -rap ../source/media $here'/html/'$productversion'/'
+mkdir -p $here'/html/'$productversion'/media/icon-themes'
+cp -rap ../../icon-themes/galaxy/* $here'/html/'$productversion'/media/icon-themes/'
+ln -s $productversion html/latest
+
+# Set helpex utilty and environment
+
+while test ! -d "${rootHelpex}/instdir/program" ; do
+if test "${dir}" = "/"; then
+echo "error: cannot find \"program\" dir from \"$(pwd)\""
+exit 1
+fi
+rootHelpex=$(readlink -f "${rootHelpex}/..")
+done
+
+exedir="${rootHelpex}"/workdir/LinkTarget/Executable
+echo $exedir
+
+export URE_BOOTSTRAP=file://"${rootHelpex}"/instdir/program/fundamentalrc123
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"${rootHelpex}"/instdir/program
+
+echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
+echo "setting search path to: ${LD_LIBRARY_PATH}"
+echo "execing: ${exedir}/helpex"
# Create the bookmark2file map
stub1='var map={'
@@ -43,12 +95,14 @@ echo $stub1 >> $ffile
awk 'NF' $ffile2 >> $ffile
echo $stub2 >> $ffile
-ALL_LANGS="pt-BR fr en-US"
+# ALL_LANGS="en-US fr"
for lang in $ALL_LANGS
do
echo 'lang = '$lang
+echo 'LIB -> '${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}
+
mkdir -p $here'/l10n/'$productversion'/'$lang
outDirLang=$here'/l10n/'$productversion'/'$lang
@@ -82,30 +136,22 @@ do
outDir=$outDirLang'/text/'$stub
mkdir -p $outDir
ls $hlpFileDir/*.xhp >$xhpfiles
- $root/bin/run helpex -l $lang -mi $xhpfiles -m $potemp -o $outDir
+ ${LO_TRACE} "${exedir}/helpex" -l $lang -mi $xhpfiles -m $potemp -o $outDir
+ "${exedir}/helpex" -l $lang -mi $xhpfiles -m $potemp -o $outDir
rm $potemp
done
fi
+
#extracting bookmarks
echo 'Extracting bookmarks'
./get_bookmark.sh $lang $productversion
-echo 'Converting to HTML'
-for filep in `find $outDirLang/text -name "*.xhp"`
- do
- DIR=${filep##*text/}
- name=${DIR:0:-3}
- outFile=$outDirHTML'/text/'$name'html'
- xsltproc $xsltparm -o $outFile online_transform.xsl $filep
- done
-echo 'copy some service files'
-cp default.css tabs.css tree.css $outDirHTML
+convert2HTML $outDirLang $outDirHTML &
done
-echo 'copy global service files'
-cp index.html html/
-cp help.js jquery-3.1.1.min.js $here'/html/'$productversion'/'
-cp -rap ../source/media $here'/html/'$productversion'/'
-mkdir -p $here'/html/'$productversion'/media/icon-themes'
-cp -rap ../../icon-themes/galaxy/* $here'/html/'$productversion'/media/icon-themes/'
-ln -s $productversion html/latest
+exit
+
+
+
+
+