diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2017-06-27 14:28:44 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@edx.srv.br> | 2017-07-02 17:52:33 +0200 |
commit | 9eb3382fc24e5d2a4a2a1024f0b4f61f9ed4c035 (patch) | |
tree | eaefac72a13a22bc8a6243a68ed000e6be29d4a2 /help3xsl/xhp2html.sh | |
parent | bfe42f086848d11c59a40f9a4dd0523df6996b42 (diff) |
Help-in-browser (vi): more improvements
Improvement:
* image search & screeshots
* inserted TechArticle schema elements from http://schema.org
* new script for usage of helpex in a build
* results in https://helponline.libreoffice.org
Change-Id: I62d1c46f260c8bd5e287df382e8db086112c4d2a
Reviewed-on: https://gerrit.libreoffice.org/39452
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-x | help3xsl/xhp2html.sh | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/help3xsl/xhp2html.sh b/help3xsl/xhp2html.sh new file mode 100755 index 0000000000..5806746514 --- /dev/null +++ b/help3xsl/xhp2html.sh @@ -0,0 +1,111 @@ +#/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/. +# +# 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 +# 4) copy service files (css, js, media) to right place. +# +# Note: change root variable to your local git build +# + +productversion='6.0' +root=/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' + +here=`pwd` +rm -rf $here/l10n +rm -rf $here/html + +helpfiles=$root/helpcontent2/source/text + +pofiles=/tmp/pofiles.txt +xhpfiles=/tmp/xhpfiles.txt +mkdir -p $here/ html + +# Create the bookmark2file map +stub1='var map={' +stub2='};' +ffile='html/bookmark2file.js' +ffile2=/tmp/tmpbkm.txt +rm -f $ffile2 $ffile +find $helpfiles -type f -name "*.xhp" -exec xsltproc get_url.xsl {} + > $ffile2 +echo $stub1 >> $ffile +awk 'NF' $ffile2 >> $ffile +echo $stub2 >> $ffile + +ALL_LANGS="pt-BR fr en-US" +for lang in $ALL_LANGS +do + +echo 'lang = '$lang + +mkdir -p $here'/l10n/'$productversion'/'$lang +outDirLang=$here'/l10n/'$productversion'/'$lang + +mkdir -p $here'/html/'$productversion'/'$lang +outDirHTML=$here'/html/'$productversion'/'$lang + +xsltparm='--stringparam Language '$lang' --stringparam productversion '$productversion' --stringparam root '$outDirLang'/' + +if [ "$lang" == en-US ]; +then +cp -rap $helpfiles $outDirLang +else +# Create first all translations of xhp +translations=$root/translations/source/$lang/helpcontent2/source/text/ + +rm -f $pofiles +touch $pofiles +rm -f $xhpfiles +touch $xhpfiles + +find $translations -type f >$pofiles + +for ff in `cat $pofiles` +do + echo 'Processing po file: '$ff + potemp=`mktemp` + echo $ff>$potemp + name=${ff:0:-3} + stub=${name##*text/} + hlpFileDir=$helpfiles'/'$stub + outDir=$outDirLang'/text/'$stub + mkdir -p $outDir + ls $hlpFileDir/*.xhp >$xhpfiles + $root/bin/run 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 + +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 |