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 | |
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')
-rwxr-xr-x | help3xsl/get_bookmark.sh | 36 | ||||
-rw-r--r-- | help3xsl/get_bookmark.xsl | 130 | ||||
-rw-r--r-- | help3xsl/get_url.xsl | 18 | ||||
-rwxr-xr-x | help3xsl/help-to-html.sh | 2 | ||||
-rw-r--r-- | help3xsl/online_transform.xsl | 401 | ||||
-rwxr-xr-x | help3xsl/xhp2html.sh | 111 |
6 files changed, 412 insertions, 286 deletions
diff --git a/help3xsl/get_bookmark.sh b/help3xsl/get_bookmark.sh index d926787da4..e4d3fee100 100755 --- a/help3xsl/get_bookmark.sh +++ b/help3xsl/get_bookmark.sh @@ -6,28 +6,28 @@ # 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/. -# $1 is html/productversion/ -# $2 is Language -# $3 is productversion +# $1 is Language +# $2 is productversion -outdir=$1$2 -mkdir -p $outdir -sourcedir=`pwd`/ +outdir=`pwd`'/html/'$2'/'$1 + +# mkdir -p $outdir +sourcedir=`pwd`'/l10n/'$2'/'$1 ffile=$outdir'/bookmarks.js' rm -f $ffile -ffile2=temp.html +ffile2=/tmp/temp.html stub2=\' -xslfile=$outdir/../../../get_bookmark.xsl +xslfile=get_bookmark.xsl + +param1=' --stringparam Language '$1' --stringparam productversion '$2 # 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='--stringparam app '$i -param=$param' --stringparam Language '$2 -param=$param' --stringparam productversion '$3 +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 @@ -40,10 +40,8 @@ done stub1='document.getElementById("bookmarkSHARED").innerHTML='\'\\ rm -f $ffile2 -param='--stringparam app SHARED' -param=$param' --stringparam Language '$2 -param=$param' --stringparam productversion '$3 -find $sourcedir'text/shared' -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $ffile2 +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 @@ -53,10 +51,8 @@ echo $stub2 >> $ffile stub1='document.getElementById("bookmarkBASE").innerHTML='\'\\ rm -f $ffile2 -param='--stringparam app BASE' -param=$param' --stringparam Language '$2 -param=$param' --stringparam productversion '$3 -find $sourcedir'text/shared/explorer/database' -type f -name "*.xhp" -exec xsltproc $param $xslfile {} + >> $ffile2 +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 diff --git a/help3xsl/get_bookmark.xsl b/help3xsl/get_bookmark.xsl index 724fcc73ce..80dfa2c025 100644 --- a/help3xsl/get_bookmark.xsl +++ b/help3xsl/get_bookmark.xsl @@ -51,25 +51,25 @@ xsltproc get_bookmark.xsl <file.xhp> <!-- Extract the bookmarks--> <xsl:template match="/"> - <xsl:for-each select="//bookmark[@branch='index']"> - <xsl:variable name="hrefhtml" select="substring-before($filename,'xhp')"/> - <xsl:variable name="href" select="concat($productversion,'/',$Language,'/',$hrefhtml,'html?DbPAR=',$app,'#',@id)"/> - <xsl:for-each select="bookmark_value"> - <xsl:variable name="here1"> - <xsl:text disable-output-escaping="yes"><![CDATA[<li><a target="_top" href="]]></xsl:text> - <xsl:value-of select="$href"/> - <xsl:text disable-output-escaping="yes"><![CDATA["</a>]]></xsl:text> - <xsl:call-template name="apostrophe"><xsl:with-param name="string"> - <xsl:value-of select="."/> - </xsl:with-param></xsl:call-template> - </xsl:variable> - - <xsl:call-template name="brand"><xsl:with-param name="string"> - <xsl:value-of select="$here1"/> - </xsl:with-param></xsl:call-template> - <xsl:text disable-output-escaping="yes"><![CDATA[</li>\]]>
</xsl:text> - </xsl:for-each> - </xsl:for-each> + <xsl:for-each select="//bookmark[@branch='index']"> + <xsl:variable name="hrefhtml" select="substring-before($filename,'xhp')"/> + <xsl:variable name="href" select="concat($productversion,'/',$Language,'/',$hrefhtml,'html?DbPAR=',$app,'#',@id)"/> + <xsl:for-each select="bookmark_value"> + <xsl:variable name="here1"> + <xsl:text disable-output-escaping="yes"><![CDATA[<li><a target="_top" href="]]></xsl:text> + <xsl:value-of select="$href"/> + <xsl:text disable-output-escaping="yes"><![CDATA["</a>]]></xsl:text> + <xsl:call-template name="apostrophe"><xsl:with-param name="string"> + <xsl:value-of select="."/> + </xsl:with-param></xsl:call-template> + </xsl:variable> + + <xsl:call-template name="brand"><xsl:with-param name="string"> + <xsl:value-of select="$here1"/> + </xsl:with-param></xsl:call-template> + <xsl:text disable-output-escaping="yes"><![CDATA[</li>\]]>
</xsl:text> + </xsl:for-each> + </xsl:for-each> </xsl:template> <!-- weird characters inside bookmarks, replace by HTML entities--> @@ -77,86 +77,86 @@ xsltproc get_bookmark.xsl <file.xhp> <xsl:param name="string"/> <xsl:variable name="apost">'</xsl:variable><!-- apostrophe --> <xsl:choose> - <xsl:when test="contains($string,$apost)"> - <xsl:variable name="newstr"> + <xsl:when test="contains($string,$apost)"> + <xsl:variable name="newstr"> <xsl:value-of select="substring-before($string,$apost)"/> - <xsl:text disable-output-escaping="yes"><![CDATA[&]]>#39;</xsl:text> + <xsl:text disable-output-escaping="yes"><![CDATA[&]]>#39;</xsl:text> <xsl:value-of select="substring-after($string,$apost)"/> - </xsl:variable> - <xsl:call-template name="apostrophe"> + </xsl:variable> + <xsl:call-template name="apostrophe"> <xsl:with-param name="string" select="$newstr"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$string"/> - </xsl:otherwise> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> </xsl:choose> </xsl:template> <!-- Branding --> <xsl:template match="text()"> - <xsl:call-template name="brand"> - <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> - </xsl:call-template> - <xsl:call-template name="apostrophe"> - <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> - </xsl:call-template> + <xsl:call-template name="brand"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> + <xsl:call-template name="apostrophe"> + <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param> + </xsl:call-template> </xsl:template> <xsl:template name="brand" > - <xsl:param name="string"/> + <xsl:param name="string"/> <xsl:choose> <xsl:when test="contains($string,$brand1)"> - <xsl:variable name="newstr"> + <xsl:variable name="newstr"> <xsl:value-of select="substring-before($string,$brand1)"/> <xsl:value-of select="$productname"/> <xsl:value-of select="substring-after($string,$brand1)"/> - </xsl:variable> - <xsl:call-template name="brand"> - <xsl:with-param name="string" select="$newstr"/> - </xsl:call-template> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> </xsl:when> - <xsl:when test="contains($string,$brand2)"> - <xsl:variable name="newstr"> + <xsl:when test="contains($string,$brand2)"> + <xsl:variable name="newstr"> <xsl:value-of select="substring-before($string,$brand2)"/> <xsl:value-of select="$pversion"/> <xsl:value-of select="substring-after($string,$brand2)"/> - </xsl:variable> - <xsl:call-template name="brand"> - <xsl:with-param name="string" select="$newstr"/> - </xsl:call-template> - </xsl:when> - - <xsl:when test="contains($string,$brand3)"> - <xsl:variable name="newstr"> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($string,$brand3)"> + <xsl:variable name="newstr"> <xsl:value-of select="substring-before($string,$brand3)"/> <xsl:value-of select="$productname"/> <xsl:value-of select="substring-after($string,$brand3)"/> - </xsl:variable> - <xsl:call-template name="brand"> - <xsl:with-param name="string" select="$newstr"/> - </xsl:call-template> - </xsl:when> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> <xsl:when test="contains($string,$brand4)"> - <xsl:variable name="newstr"> + <xsl:variable name="newstr"> <xsl:value-of select="substring-before($string,$brand4)"/> <xsl:value-of select="$pversion"/> <xsl:value-of select="substring-after($string,$brand4)"/> - </xsl:variable> - <xsl:call-template name="brand"> - <xsl:with-param name="string" select="$newstr"/> - </xsl:call-template> - </xsl:when> + </xsl:variable> + <xsl:call-template name="brand"> + <xsl:with-param name="string" select="$newstr"/> + </xsl:call-template> + </xsl:when> <xsl:otherwise> - <xsl:value-of select="$string"/> - </xsl:otherwise> - </xsl:choose> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> </xsl:template> diff --git a/help3xsl/get_url.xsl b/help3xsl/get_url.xsl index a6beff66f5..1cff5f954e 100644 --- a/help3xsl/get_url.xsl +++ b/help3xsl/get_url.xsl @@ -46,15 +46,15 @@ xsltproc get_bookmark.xsl <file.xhp> <!-- Extract the bookmarks branches x filename--> <xsl:template match="/"> - <xsl:variable name="href" select="concat(substring-before($filename,'xhp'),'html')"/> - <xsl:for-each select="//bookmark[@branch!='index']"> - <xsl:if test="not(contains(@branch,'/.uno'))"> - <xsl:text>'</xsl:text> - <xsl:value-of select="substring-after(@branch,'hid/')"/> - <xsl:text>':'</xsl:text> - <xsl:value-of select="$href" /><xsl:text>',
</xsl:text> - </xsl:if> - </xsl:for-each> + <xsl:variable name="href" select="concat(substring-before($filename,'xhp'),'html')"/> + <xsl:for-each select="//bookmark[@branch!='index']"> + <xsl:if test="not(contains(@branch,'/.uno'))"> + <xsl:text>'</xsl:text> + <xsl:value-of select="substring-after(@branch,'hid/')"/> + <xsl:text>':'</xsl:text> + <xsl:value-of select="$href" /><xsl:text>',
</xsl:text> + </xsl:if> + </xsl:for-each> </xsl:template> diff --git a/help3xsl/help-to-html.sh b/help3xsl/help-to-html.sh index 62efd87d93..1298106ec4 100755 --- a/help3xsl/help-to-html.sh +++ b/help3xsl/help-to-html.sh @@ -66,7 +66,7 @@ langDirSource=`pwd` # iterate existing languages for lang in `ls $langDirSource` -# for lang in en-US +# for lang in en-US pt-BR do echo $lang cd $langDirSource/$lang/helpcontent2/source diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl index 3d8f1736c3..81d61b61dd 100644 --- a/help3xsl/online_transform.xsl +++ b/help3xsl/online_transform.xsl @@ -35,9 +35,6 @@ <xsl:variable name="sl" select="'/'"/> <xsl:variable name="qt" select="'"'"/> -<!-- generic Icon alt text --> -<xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/> - <!-- For calculating pixel sizes --> <xsl:variable name="dpi" select="'96'"/> <xsl:variable name="dpcm" select="'38'"/> @@ -57,15 +54,15 @@ <xsl:param name="Database" select="'swriter'"/> <xsl:variable name="module" select="$Database"/> <xsl:variable name="appl"> - <xsl:choose> - <xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when> - <xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when> - <xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when> - <xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when> - <xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when> - <xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when> - <xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when> - </xsl:choose> + <xsl:choose> + <xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when> + <xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when> + <xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when> + <xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when> + <xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when> + <xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when> + <xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when> + </xsl:choose> </xsl:variable> <!-- the other parameters given by the help caller --> @@ -80,7 +77,12 @@ <xsl:param name="imgtheme" select="''"/> <xsl:param name="Id" /> <xsl:param name="Language"/> +<xsl:param name="root"/> <xsl:variable name="lang" select="$Language"/> +<xsl:variable name="urlpre" select="$root"/> + +<!-- generic Icon alt text --> +<xsl:variable name="alttext" select="concat($root,'text/shared/00/icon_alt.xhp')"/> <xsl:param name="ExtensionId" select="''"/> <xsl:param name="ExtensionPath" select="''"/> @@ -93,7 +95,7 @@ <xsl:variable name="img_url_internal" select="$productversion"/> <xsl:variable name="img_url_prefix" select="concat($productversion,'/media',$imgtheme,'/')"/> <xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/> -<xsl:variable name="urlpre" select="$help_url_prefix" /> +<!-- <xsl:variable name="urlpre" select="$help_url_prefix" /> --> <xsl:variable name="linkprefix" select="concat($productversion,'/',$lang,'/')"/> <!--<xsl:variable name="linkpostfix" select="$urlpost"/>--> <xsl:variable name="linkpostfix" select="''"/> @@ -104,6 +106,12 @@ <xsl:variable name="warning_img" select="concat($img_url_prefix,'helpimg/warning.png')"/> <!-- +######################## +# Schema.org variables # +######################## +//--> + +<!-- ############# # Templates # ############# @@ -112,19 +120,19 @@ <!-- Create the document skeleton --> <xsl:template match="/"> <xsl:variable name="htmlpage"><xsl:call-template name="filehtml"><xsl:with-param name="file" select="$filename"/></xsl:call-template></xsl:variable> -<html> -<head> + <xsl:variable name="titleL10N"> + <xsl:call-template name="brand"><xsl:with-param name="string"><xsl:value-of select="$title"/></xsl:with-param></xsl:call-template> + </xsl:variable> + <html> + <head> <!--<base href="file:///home/tdf/git/core/helpcontent2/source/html/"/> --> <base href="/"/> - <title><xsl:call-template name="brand"><xsl:with-param name="string"> - <xsl:value-of select="$title"/> - </xsl:with-param></xsl:call-template> - </title> - <link href="{$productversion}/default.css" rel="Stylesheet" type="text/css" /> - <link href="{$productversion}/tabs.css" rel="Stylesheet" type="text/css" /> - <link href="{$productversion}/tree.css" rel="Stylesheet" type="text/css" /> + <title><xsl:value-of select="$titleL10N"/></title> + <link href="{$productversion}/{$lang}/default.css" rel="Stylesheet" type="text/css" /> + <link href="{$productversion}/{$lang}/tabs.css" rel="Stylesheet" type="text/css" /> + <link href="{$productversion}/{$lang}/tree.css" rel="Stylesheet" type="text/css" /> <script type="text/javascript" src="{$productversion}/jquery-3.1.1.min.js"></script> - <script type="text/javascript" src="{$productversion}/help.js"></script> + <script type="text/javascript" src="{$productversion}/help.js"></script> <!-- Piwik --> <script type="text/javascript"> <![CDATA[ @@ -143,144 +151,146 @@ </script> <!-- End Piwik Code --> <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> -</head> -<body lang="{$lang}"> - <div id="BottomLeft"> - <div id="container"> <!-- Tabs --> - <input id="tab-1" type="radio" name="tab-group" checked="checked" /> - <label for="tab-1">Index</label> - <input id="tab-2" type="radio" name="tab-group" /> - <label for="tab-2">Contents</label> - <input id="tab-3" type="radio" name="tab-group" /> - <label for="tab-3">Search</label> - <div id="content"> - <div id="content-1"> - <div id="SearchBox"><p> 🔎 <input type="text" id="search-bar"/></p></div> - <div id="Bookmarks"> - <ul id="bookmarkCALC" hidden="true"></ul> - <ul id="bookmarkCHART" hidden="true"></ul> - <ul id="bookmarkWRITER" hidden="true"></ul> - <ul id="bookmarkDRAW" hidden="true"></ul> - <ul id="bookmarkIMPRESS" hidden="true"></ul> - <ul id="bookmarkMATH" hidden="true"></ul> - <ul id="bookmarkBASE" hidden="true"></ul> - <ul id="bookmarkSHARED"></ul> - <ul id="bookmarkBASIC" hidden="true"></ul> + </head> + <body lang="{$lang}"> + <div itemscope="true" itemtype="http://schema.org/TechArticle"> + <meta itemprop="version" content="{$productversion}"/> + <meta itemprop="inLanguage" content="{$lang}"/> + <meta itemprop="datePublished" content="2017"/>" + <div id="BottomLeft"> + <div id="container"> <!-- Tabs --> + <input id="tab-1" type="radio" name="tab-group" checked="checked" /> + <label for="tab-1">Index</label> + <input id="tab-2" type="radio" name="tab-group" /> + <label for="tab-2">Contents</label> + <input id="tab-3" type="radio" name="tab-group" /> + <label for="tab-3">Search</label> + <div id="content"> + <div id="content-1"> + <div id="SearchBox"><p> 🔎 <input type="text" id="search-bar"/></p></div> + <div id="Bookmarks"> + <ul id="bookmarkCALC" hidden="true"></ul> + <ul id="bookmarkCHART" hidden="true"></ul> + <ul id="bookmarkWRITER" hidden="true"></ul> + <ul id="bookmarkDRAW" hidden="true"></ul> + <ul id="bookmarkIMPRESS" hidden="true"></ul> + <ul id="bookmarkMATH" hidden="true"></ul> + <ul id="bookmarkBASE" hidden="true"></ul> + <ul id="bookmarkSHARED"></ul> + <ul id="bookmarkBASIC" hidden="true"></ul> + </div> + </div> + <div id="content-2"> + <p>Lorem ipsum dolor sit amet</p> + </div> + <div id="content-3"> + <p>Lorem ipsum dolor sit amet</p> </div> - </div> - <div id="content-2"> - <p>Lorem ipsum dolor sit amet</p> - </div> - <div id="content-3"> - <p>Lorem ipsum dolor sit amet</p> </div> </div> </div> - </div> - <div id="DisplayArea"> - <xsl:apply-templates select="/helpdocument/body"/> - <div class="debug"> - <h3 class="bug">Help content debug info:</h3> - <p>This page is: <xsl:value-of select="$filename"/></p> - <p>Title is: <xsl:value-of select="$title"/></p> - <p id="bm_module"></p> - <p id="bm_system"></p> + <div id="DisplayArea" itemprop="articleBody"> + <xsl:apply-templates select="/helpdocument/body"/> + <div class="debug"> + <h3 class="bug">Help content debug info:</h3> + <p>This page is: <xsl:value-of select="$filename"/></p> + <p>Title is: <xsl:value-of select="$title"/></p> + <p id="bm_module"></p> + <p id="bm_system"></p> + </div> + </div> + <div id="TopLang"> + <nav> + <ul> + <li><a href="{$productversion}/en-US{$htmlpage}">EN</a></li> + <li><a href="{$productversion}/ast{$htmlpage}">AST</a></li> + <li><a href="{$productversion}/bg{$htmlpage}">BG</a></li> + <li><a href="{$productversion}/bn{$htmlpage}">BN</a></li> + <li><a href="{$productversion}/bn-IN{$htmlpage}">BN-IN</a></li> + <li><a href="{$productversion}/ca{$htmlpage}">CA</a></li> + <li><a href="{$productversion}/cs{$htmlpage}">CS</a></li> + <li><a href="{$productversion}/da{$htmlpage}">DA</a></li> + <li><a href="{$productversion}/de{$htmlpage}">DE</a></li> + <li><a href="{$productversion}/el{$htmlpage}">EL</a></li> + <li><a href="{$productversion}/es{$htmlpage}">ES</a></li> + <li><a href="{$productversion}/eu{$htmlpage}">EU</a></li> + <li><a href="{$productversion}/fi{$htmlpage}">FI</a></li> + <li><a href="{$productversion}/fr{$htmlpage}">FR</a></li> + <li><a href="{$productversion}/hu{$htmlpage}">HU</a></li> + <li><a href="{$productversion}/it{$htmlpage}">IT</a></li> + <li><a href="{$productversion}/ja{$htmlpage}">JA</a></li> + <li><a href="{$productversion}/km{$htmlpage}">KM</a></li> + <li><a href="{$productversion}/ko{$htmlpage}">KO</a></li> + <li><a href="{$productversion}/nb{$htmlpage}">NB</a></li> + <li><a href="{$productversion}/nl{$htmlpage}">NL</a></li> + <li><a href="{$productversion}/om{$htmlpage}">OM</a></li> + <li><a href="{$productversion}/pl{$htmlpage}">PL</a></li> + <li><a href="{$productversion}/pt{$htmlpage}">PT</a></li> + <li><a href="{$productversion}/pt-BR{$htmlpage}">PT-BR</a></li> + <li><a href="{$productversion}/ru{$htmlpage}">RU</a></li> + <li><a href="{$productversion}/sl{$htmlpage}">SL</a></li> + <li><a href="{$productversion}/sv{$htmlpage}">SV</a></li> + <li><a href="{$productversion}/tr{$htmlpage}">TR</a></li> + <li><a href="{$productversion}/vi{$htmlpage}">VI</a></li> + <li><a href="{$productversion}/zh-CN{$htmlpage}">ZH-CN</a></li> + <li><a href="{$productversion}/zh-TW{$htmlpage}">ZH-TW</a></li> + </ul> + </nav> + </div> + <div id="TopRight"> + <script type="text/javascript"> + <![CDATA[ + (function() { + var cx = '010161382024564278136:oejldkqc20o'; + var gcse = document.createElement('script'); + gcse.type = 'text/javascript'; + gcse.async = true; + gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(gcse, s); + })(); + ]]> + </script> + <xsl:text disable-output-escaping="yes"><gcse:search></gcse:search></xsl:text> + </div> + <div id="TopLeft"> + <nav id="SelectModules"> + <ul> + <li><a href="{$productversion}/{$lang}/text/scalc/main0000.html?DbPAR=CALC">Calc</a></li> + <li><a href="{$productversion}/{$lang}/text/swriter/main0000.html?DbPAR=WRITER">Writer</a></li> + <li><a href="{$productversion}/{$lang}/text/simpress/main0000.html?DbPAR=IMPRESS">Impress</a></li> + <li><a href="{$productversion}/{$lang}/text/sdraw/main0000.html?DbPAR=DRAW">Draw</a></li> + <li><a href="{$productversion}/{$lang}/text/schart/main0000.html?DbPAR=CHART">Chart</a></li> + <li><a href="{$productversion}/{$lang}/text/sbasic/shared/main0601.html?DbPAR=BASIC">Basic</a></li> + <li><a href="{$productversion}/{$lang}/text/smath/main0000.html?DbPAR=MATH">Math</a></li> + <li><a href="{$productversion}/{$lang}/text/shared/explorer/database/main.html?DbPAR=BASE">Base</a></li> + <!--<li><a href="{$productversion}/{$lang}/text/shared/guide/main.html?DbPAR=SHARED">Guide</a></li>--> + </ul> + </nav> + </div> + <div id="TopSystem"> + <nav id="SelectSystem"> + <ul> + <li id="win"><a href="{$productversion}/{$lang}{$htmlpage}">Wndows</a></li> + <li id="lin"><a href="{$productversion}/{$lang}{$htmlpage}">Linux</a></li> + <li id="mac"><a href="{$productversion}/{$lang}{$htmlpage}">Mac</a></li> + </ul> + </nav> </div> - </div> - <div id="TopLang"> - <nav> - <ul> - <li><a href="{$productversion}/en-US{$htmlpage}">EN</a></li> - <li><a href="{$productversion}/ast{$htmlpage}">AST</a></li> - <li><a href="{$productversion}/bg{$htmlpage}">BG</a></li> - <li><a href="{$productversion}/bn{$htmlpage}">BN</a></li> - <li><a href="{$productversion}/bn-IN{$htmlpage}">BN-IN</a></li> - <li><a href="{$productversion}/ca{$htmlpage}">CA</a></li> - <li><a href="{$productversion}/cs{$htmlpage}">CS</a></li> - <li><a href="{$productversion}/da{$htmlpage}">DA</a></li> - <li><a href="{$productversion}/de{$htmlpage}">DE</a></li> - <li><a href="{$productversion}/el{$htmlpage}">EL</a></li> - <li><a href="{$productversion}/es{$htmlpage}">ES</a></li> - <li><a href="{$productversion}/eu{$htmlpage}">EU</a></li> - <li><a href="{$productversion}/fi{$htmlpage}">FI</a></li> - <li><a href="{$productversion}/fr{$htmlpage}">FR</a></li> - <li><a href="{$productversion}/hu{$htmlpage}">HU</a></li> - <li><a href="{$productversion}/it{$htmlpage}">IT</a></li> - <li><a href="{$productversion}/ja{$htmlpage}">JA</a></li> - <li><a href="{$productversion}/km{$htmlpage}">KM</a></li> - <li><a href="{$productversion}/ko{$htmlpage}">KO</a></li> - <li><a href="{$productversion}/nb{$htmlpage}">NB</a></li> - <li><a href="{$productversion}/nl{$htmlpage}">NL</a></li> - <li><a href="{$productversion}/om{$htmlpage}">OM</a></li> - <li><a href="{$productversion}/pl{$htmlpage}">PL</a></li> - <li><a href="{$productversion}/pt{$htmlpage}">PT</a></li> - <li><a href="{$productversion}/pt-BR{$htmlpage}">PT-BR</a></li> - <li><a href="{$productversion}/ru{$htmlpage}">RU</a></li> - <li><a href="{$productversion}/sl{$htmlpage}">SL</a></li> - <li><a href="{$productversion}/sv{$htmlpage}">SV</a></li> - <li><a href="{$productversion}/tr{$htmlpage}">TR</a></li> - <li><a href="{$productversion}/vi{$htmlpage}">VI</a></li> - <li><a href="{$productversion}/zh-CN{$htmlpage}">ZH-CN</a></li> - <li><a href="{$productversion}/zh-TW{$htmlpage}">ZH-TW</a></li> - </ul> - </nav> - </div> - <div id="TopRight"> <script type="text/javascript"> <![CDATA[ - (function() { - var cx = '010161382024564278136:oejldkqc20o'; - var gcse = document.createElement('script'); - gcse.type = 'text/javascript'; - gcse.async = true; - gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; - var s = document.getElementsByTagName('script')[0]; - s.parentNode.insertBefore(gcse, s); - })(); + var module = getParameterByName("DbPAR"); + setModule(module); + var system = getParameterByName("System"); + setSystem(system); + fixURL(module,system); + setSystemURLButton(module); + document.getElementById("bm_module").innerHTML ="Module is: "+module; + document.getElementById("bm_system").innerHTML ="System is: "+system; ]]> </script> - <xsl:text disable-output-escaping="yes"><gcse:search></gcse:search></xsl:text> + <script type="text/javascript" src="{$productversion}/{$lang}/bookmarks.js"/> </div> - <div id="TopLeft"> - <nav id="SelectModules"> - <ul> - <li><a href="{$productversion}/{$lang}/text/scalc/main0000.html?DbPAR=CALC">Calc</a></li> - <li><a href="{$productversion}/{$lang}/text/swriter/main0000.html?DbPAR=WRITER">Writer</a></li> - <li><a href="{$productversion}/{$lang}/text/simpress/main0000.html?DbPAR=IMPRESS">Impress</a></li> - <li><a href="{$productversion}/{$lang}/text/sdraw/main0000.html?DbPAR=DRAW">Draw</a></li> - <li><a href="{$productversion}/{$lang}/text/schart/main0000.html?DbPAR=CHART">Chart</a></li> - <li><a href="{$productversion}/{$lang}/text/sbasic/shared/main0601.html?DbPAR=BASIC">Basic</a></li> - <li><a href="{$productversion}/{$lang}/text/smath/main0000.html?DbPAR=MATH">Math</a></li> - <li><a href="{$productversion}/{$lang}/text/shared/explorer/database/main.html?DbPAR=BASE">Base</a></li> - <!--<li><a href="{$productversion}/{$lang}/text/shared/guide/main.html?DbPAR=SHARED">Guide</a></li>--> - </ul> - </nav> - </div> - <div id="TopSystem"> - <nav id="SelectSystem"> - <ul> - <li id="win"><a href="{$productversion}/{$lang}{$htmlpage}">Wndows</a></li> - <li id="lin"><a href="{$productversion}/{$lang}{$htmlpage}">Linux</a></li> - <li id="mac"><a href="{$productversion}/{$lang}{$htmlpage}">Mac</a></li> - </ul> - </nav> - </div> - <script type="text/javascript"> - <![CDATA[ - //if (window.location.href.indexOf('?') == -1) { - //window.open('text/shared/main0108.html?System=DEFSYS&DbPAR=WRITER&System=WIN','_self'); - //} - var module = getParameterByName("DbPAR"); - setModule(module); - var system = getParameterByName("System"); - setSystem(system); - fixURL(module,system); - setSystemURLButton(module); - document.getElementById("bm_module").innerHTML ="Module is: "+module; - document.getElementById("bm_system").innerHTML ="System is: "+system; - ]]> - </script> - <script type="text/javascript" src="{$productversion}/{$lang}/bookmarks.js"/> </body> </html> </xsl:template> @@ -309,7 +319,12 @@ <xsl:template match="bookmark" mode="embedded" /> <!-- BOOKMARK_VALUE --> -<xsl:template match="bookmark_value" /> +<xsl:template match="bookmark_value"> + <xsl:element name="meta"> + <xsl:attribute name="itemprop">keywords</xsl:attribute> + <xsl:attribute name="content"><xsl:value-of select="translate(.,';',',')"/></xsl:attribute> + </xsl:element> +</xsl:template> <!-- BR --> <xsl:template match="br"><br /></xsl:template> @@ -737,9 +752,6 @@ <xsl:apply-templates/> </xsl:when> <xsl:otherwise> <!-- old style --> - <xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable> - <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable>--> - <!--<xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable>--> <xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before($linkhref,'#'))"/></xsl:variable> <xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable> <xsl:variable name="docum" select="document($href)"/> @@ -807,18 +819,24 @@ <!-- Insert a heading --> <xsl:template name="insertheading"> - <xsl:param name="level" /> - <xsl:param name="embedded" /> + <xsl:param name="level" /> + <xsl:param name="embedded" /> <xsl:element name="{concat('h',$level)}"> - <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> - <xsl:choose> - <xsl:when test="$embedded = 'yes'"> - <xsl:apply-templates mode="embedded"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates /> - </xsl:otherwise> - </xsl:choose> + <xsl:choose> + <xsl:when test="$level = '1'"> + <xsl:attribute name="itemprop"><xsl:text>headline</xsl:text></xsl:attribute> + </xsl:when> + <xsl:otherwise></xsl:otherwise> + </xsl:choose> + <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute> + <xsl:choose> + <xsl:when test="$embedded = 'yes'"> + <xsl:apply-templates mode="embedded"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates /> + </xsl:otherwise> + </xsl:choose> </xsl:element> </xsl:template> @@ -931,29 +949,32 @@ <xsl:template name="insertimage"> <xsl:variable name="src"> <xsl:choose> - <xsl:when test="starts-with(@src,'media/')"> - <xsl:value-of select="concat($img_url_internal,'/',@src)"/> - </xsl:when> - <xsl:when test="not(starts-with(@src,'media/'))"> - <xsl:value-of select="concat($img_url_internal,'/media/icon-themes/',@src)"/> - </xsl:when> - <xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)"> - <xsl:value-of select="concat($ExtensionPath,'/',@src)"/> - </xsl:when> - <xsl:otherwise> - <xsl:choose> - <xsl:when test="@localize='true'"> - <xsl:value-of select="concat($img_url_prefix,@src,'?lang=',$lang)"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="concat($img_url_prefix,@src)"/> - </xsl:otherwise> - </xsl:choose> - </xsl:otherwise> + <xsl:when test="starts-with(@src,'media/screenshots/')"> + <xsl:choose> + <xsl:when test="@localize='true'"> + <xsl:variable name="tmp0" select="substring-before(@src, '/ui')"/> + <xsl:variable name="tmp1" select="substring-after(@src, '/ui/')"/> + <xsl:variable name="tmp2" select="substring-before($tmp1,'/')"/> + <xsl:variable name="tmp3" select="substring-after($tmp1,'/')"/> + <xsl:value-of select="concat('/',$productversion,'/', $tmp0,'/ui/', $tmp2, '/',$lang,'/',$tmp3)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('/',$productversion,'/',@src)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="starts-with(@src,'media/')"> + <xsl:value-of select="concat('/',$productversion,'/',@src)"/> + </xsl:when> + <xsl:when test="not(starts-with(@src,'media/'))"> + <xsl:value-of select="concat('/',$productversion,'/media/icon-themes/',@src)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('/',$productversion,@src)"/> + </xsl:otherwise> </xsl:choose> </xsl:variable> -<!-- <p class="debug">Image: <xsl:value-of select="$src"/></p>--> - <!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>--> +<!-- <p class="debug">Image: <xsl:value-of select="$src"/></p>--> <xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable> <xsl:variable name="width"> <xsl:call-template name="convert2px"><xsl:with-param name="value" select="@width"/></xsl:call-template> @@ -1012,8 +1033,8 @@ <xsl:value-of select="$value"/> </xsl:when> <xsl:otherwise> - <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message> - <xsl:value-of select="$value"/> +<!-- <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message> --> + <xsl:value-of select="concat($value, 'px')"/> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -1060,8 +1081,6 @@ <xsl:template name="resolveembed"> <div class="embedded"> - <xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable> - <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable> <xsl:variable name="href"><xsl:value-of select="concat($urlpre,substring-before(@href,'#'))"/></xsl:variable> <xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable> <xsl:variable name="docum" select="document($href)"/> 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 |