diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2017-07-16 09:27:44 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@edx.srv.br> | 2017-07-16 14:35:05 +0200 |
commit | 7d9270f4d45603665daaa51f31914eadbbd6b353 (patch) | |
tree | dbac7606241632d6fb4a6c53100c8daed9c61459 /help3xsl | |
parent | 0d9a8fd684b33942185c76e1a37353ce4566f014 (diff) |
Help-in-browser (ix) Add contents treeview
Add Contents tree transforming *.tree files
Reposition <meta> tag for UTF-8
Fork bash script for faster processing
Change-Id: I6c74aa1e855b7f4bb152e2c632f6ab7d683e5462
Reviewed-on: https://gerrit.libreoffice.org/40007
Reviewed-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Tested-by: Olivier Hallot <olivier.hallot@edx.srv.br>
Diffstat (limited to 'help3xsl')
-rw-r--r-- | help3xsl/default.css | 119 | ||||
-rw-r--r-- | help3xsl/get_tree.xsl | 163 | ||||
-rw-r--r-- | help3xsl/online_transform.xsl | 198 | ||||
-rwxr-xr-x | help3xsl/xhp2html.sh | 77 |
4 files changed, 432 insertions, 125 deletions
diff --git a/help3xsl/default.css b/help3xsl/default.css index 1fe3b9bb18..7cbfba3f15 100644 --- a/help3xsl/default.css +++ b/help3xsl/default.css @@ -95,7 +95,126 @@ footer a{ color:#c2f6ba; } +/* tree view */ +.contents-treeview ul, +.contents-treeview li +{ + padding: 0; + margin: 0; + list-style: none; +} + +.contents-treeview input +{ + position: absolute; + opacity: 0; +} + +.contents-treeview +{ +/* font: normal 11px "Segoe UI", Arial, Sans-serif;*/ + -moz-user-select: none; + -webkit-user-select: none; + user-select: none; +} + +.contents-treeview a +{ +/* color: #00f; */ + text-decoration: none; +} + +.contents-treeview a:hover +{ + text-decoration: underline; +} + +.contents-treeview input + label + ul +{ + margin: 0 0 0 22px; +} + +.contents-treeview input ~ ul +{ + display: none; +} + +.contents-treeview label, +.contents-treeview label::before +{ + cursor: pointer; +} + +.contents-treeview input:disabled + label +{ + cursor: default; + opacity: .6; +} + +.contents-treeview input:checked:not(:disabled) ~ ul +{ + display: block; +} + +.contents-treeview label, +.contents-treeview label::before +{ + background: url("media/icon-themes/res/folderop.png") no-repeat; +} + +.contents-treeview label, +.contents-treeview a, +.contents-treeview label::before +{ + display: inline-block; + height: 16px; + line-height: 16px; + vertical-align: middle; +} + +.contents-treeview label +{ + background-position: 18px 0; +} + +.contents-treeview label::before +{ + content: ""; + width: 16px; + margin: 0 22px 0 0; + vertical-align: middle; + background-position: 0 -32px; +} + +.contents-treeview input:checked + label::before +{ + background-position: 0 -16px; +} + +/* webkit adjacent element selector bugfix */ +@media screen and (-webkit-min-device-pixel-ratio:0) +{ + .contents-treeview + { + -webkit-animation: webkit-adjacent-element-selector-bugfix infinite 1s; + } + + @-webkit-keyframes webkit-adjacent-element-selector-bugfix + { + from + { + padding: 0; + } + to + { + padding: 0; + } + } +} + + +/* default from old LibreOffice help system */ body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable { font-family: "Segoe UI", Ubuntu, Cantarell, "Noto Sans", "DejaVu Sans", "Lucida Sans Unicode", "Helvetica Neue", Helvetica, Tahoma, sans-serif; } diff --git a/help3xsl/get_tree.xsl b/help3xsl/get_tree.xsl new file mode 100644 index 0000000000..0dd417798f --- /dev/null +++ b/help3xsl/get_tree.xsl @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + * 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/. +--> +<!-- +Stylesheet to extract tree context and generate a neste list +Usage: +xsltproc get_tree.xsl <file.tree> +--> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:param name="app"/> +<xsl:param name="lang"/> +<xsl:param name="productname" select="'LibreOffice'"/> +<xsl:param name="productversion"/> + +<xsl:output indent="yes" method="html"/> + +<!-- +############################ +# Variables and Parameters # +############################ +//--> +<!-- Product brand variables used in the help files --> +<xsl:variable name="brand1" select="'$[officename]'"/> +<xsl:variable name="brand2" select="'$[officeversion]'"/> +<xsl:variable name="brand3" select="'%PRODUCTNAME'"/> +<xsl:variable name="brand4" select="'%PRODUCTVERSION'"/> +<!-- +############# +# Templates # +############# +//--> + +<!-- Extract the tree and generate a nested UL--> +<xsl:template match="/"> + <xsl:apply-templates/> +</xsl:template> + +<xsl:template match="help_section"> + <ul> + <li><input type="checkbox" id="{@id}"/> + <label for="{@id}"> + <xsl:call-template name="brand"><xsl:with-param name="string"><xsl:value-of select="@title"/></xsl:with-param></xsl:call-template> + </label> + <ul><xsl:apply-templates/></ul> + </li> + </ul> +</xsl:template> + +<xsl:template match="node"> + <li><input type="checkbox" id="{@id}"/> + <label for="{@id}"> + <xsl:call-template name="brand"><xsl:with-param name="string"><xsl:value-of select="@title"/></xsl:with-param></xsl:call-template> + </label> + <ul><xsl:apply-templates/></ul> + </li> +</xsl:template> + +<xsl:template match="topic"> + <xsl:variable name="htmlpage"><xsl:call-template name="filehtml"> + <xsl:with-param name="file" select="concat('/',$productversion,'/',$lang,'/',substring-after(@id,'/'))"/> + </xsl:call-template></xsl:variable> + <li><a target="_top" href="{$htmlpage}"><xsl:call-template name="brand"><xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param></xsl:call-template></a></li> +</xsl:template> + +<!-- weird characters inside bookmarks, replace by HTML entities--> +<xsl:template name="apostrophe"> + <xsl:param name="string"/> + <xsl:variable name="apost">'</xsl:variable><!-- apostrophe --> + <xsl:choose> + <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:value-of select="substring-after($string,$apost)"/> + </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: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:template> + + +<xsl:template name="brand" > + <xsl:param name="string"/> + + <xsl:choose> + + <xsl:when test="contains($string,$brand1)"> + <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:when> + + <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: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:when test="contains($string,$brand4)"> + <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:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> +<xsl:template name="filehtml"> + <xsl:param name="file"/> + <xsl:value-of select="substring-after(concat(substring-before($file,'.xhp'),'.html'),'/')"/> +</xsl:template> +</xsl:stylesheet> diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl index bf4b72f21e..9ce04e29d2 100644 --- a/help3xsl/online_transform.xsl +++ b/help3xsl/online_transform.xsl @@ -21,6 +21,7 @@ <xsl:output indent="yes" method="html" doctype-system= "about:legacy-compat"/> + <!-- ############################ # Variables and Parameters # @@ -127,8 +128,9 @@ <head> <!--<base href="file:///home/tdf/git/core/helpcontent2/source/html/"/> --> <base href="/"/> + <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <title><xsl:value-of select="$titleL10N"/></title> - <link href="{$productversion}/default.css" rel="Stylesheet" type="text/css" /> + <link type="text/css" href="{$productversion}/default.css" rel="Stylesheet" /> <script type="text/javascript" src="{$productversion}/jquery-3.1.1.min.js"></script> <script type="text/javascript" src="{$productversion}/help.js"></script> <!-- Piwik --> @@ -148,7 +150,6 @@ ]]> </script> <!-- End Piwik Code --> - <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width,initial-scale=1"/> </head> <body lang="{$lang}" itemscope="true" itemtype="http://schema.org/TechArticle"> @@ -250,18 +251,18 @@ function changeModuleHandler(event) { // You can use “this” to refer to the selected element. var system = getParameterByName("System"); - window.open('/'+event.target.value + '&System=' + system,'_self'); + window.open('/'+event.target.value + '&System=' + system,'_top'); } function changeSystemHandler(event) { // You can use “this” to refer to the selected element. var module = getParameterByName("DbPAR"); - window.open('/'+event.target.value + '&DbPAR=' + module,'_self'); + window.open('/'+event.target.value + '&DbPAR=' + module,'_top'); } function changeLangHandler(event) { // You can use “this” to refer to the selected element. var system = getParameterByName("System"); var module = getParameterByName("DbPAR"); - window.open('/' + event.target.value + '?DbPAR=' + module + '&System=' + system ,'_self'); + window.open('/' + event.target.value + '?DbPAR=' + module + '&System=' + system ,'_top'); } ]]> </script> @@ -305,12 +306,9 @@ </script> <xsl:text disable-output-escaping="yes"><gcse:search></gcse:search></xsl:text> </div> - <a href="#" onClick="myTabs.next(); return false">Come back to first tab</a> </article> <article data-title="Contents"> - <h2>Tree</h2> - <p>TBD</p> - <a href="#" onClick="myTabs.next(); return false">Finished ? Go to the next tab</a> + <div id="Contents" class="contents-treeview"></div> </article> </section> <footer> @@ -334,6 +332,7 @@ fixURL(module,system); document.getElementById("bm_module").innerHTML ="Module is: "+module; document.getElementById("bm_system").innerHTML ="System is: "+system; + $("#Contents").load(']]><xsl:value-of select="concat('/',$productversion,'/',$lang)"/><![CDATA[/contents.html'); ]]> </script> <script type="text/javascript" src="{$productversion}/{$lang}/bookmarks.js"/> @@ -791,84 +790,83 @@ <!-- Insert "How to get Link" --> <xsl:template name="insert_howtoget"> - <xsl:param name="linkhref" /> - <xsl:variable name="archive" select="'shared'"/> - <!--<xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>--> - <xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp')"/></xsl:variable> - <xsl:variable name="tmp_doc" select="document($tmp_href)"/> - <table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0"> - <tr> - <td> - <p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p> - <div class="howtogetbody"> - <xsl:choose> - <xsl:when test="$linkhref = ''"> <!-- new style --> - <xsl:apply-templates/> - </xsl:when> - <xsl:otherwise> <!-- old style --> - <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)"/> - - <xsl:call-template name="insertembed"> - <xsl:with-param name="doc" select="$docum" /> - <xsl:with-param name="anchor" select="$anc" /> - </xsl:call-template> - - </xsl:otherwise> - </xsl:choose> - </div> - </td> - </tr> - </table> - <br/> + <xsl:param name="linkhref" /> + <xsl:variable name="archive" select="'shared'"/> + <!--<xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>--> + <xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'text/shared/00/00000004.xhp')"/></xsl:variable> + <xsl:variable name="tmp_doc" select="document($tmp_href)"/> + <table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0"> + <tr> + <td> + <p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p> + <div class="howtogetbody"> + <xsl:choose> + <xsl:when test="$linkhref = ''"> <!-- new style --> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> <!-- old style --> + <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)"/> + + <xsl:call-template name="insertembed"> + <xsl:with-param name="doc" select="$docum" /> + <xsl:with-param name="anchor" select="$anc" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </div> + </td> + </tr> + </table> + <br/> </xsl:template> <!-- Create a link --> <xsl:template name="createlink"> - <xsl:choose> - <xsl:when test="starts-with(@href,'http://') or starts-with(@href,'https://')"> <!-- web links --> - <a href="{@href}"><xsl:apply-templates /></a> - </xsl:when> - <xsl:when test="contains(@href,'#')"> <!-- internal links with bookmark --> - <xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable> - <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,substring-before(@href, 'xhp'),'html',$anchor,$linkpostfix)"/></xsl:variable> - <a href="{$href}"><xsl:apply-templates /></a> - </xsl:when> - <xsl:otherwise> - <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,substring-before(@href, 'xhp'),'html',$linkpostfix)"/></xsl:variable> - <a href="{$href}"><xsl:apply-templates /></a> - </xsl:otherwise> - </xsl:choose> + <xsl:choose> + <xsl:when test="starts-with(@href,'http://') or starts-with(@href,'https://')"> <!-- web links --> + <a target ="_blank" href="{@href}"><xsl:apply-templates /></a> + </xsl:when> + <xsl:when test="contains(@href,'#')"> <!-- internal links with bookmark --> + <xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable> + <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,substring-before(@href, 'xhp'),'html',$anchor,$linkpostfix)"/></xsl:variable> + <a target ="_top" href="{$href}"><xsl:apply-templates /></a> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="href"><xsl:value-of select="concat($linkprefix,substring-before(@href, 'xhp'),'html',$linkpostfix)"/></xsl:variable> + <a target ="_top" href="{$href}"><xsl:apply-templates /></a> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- Insert Note, Warning, or Tip --> <xsl:template name="insertnote"> - <xsl:param name="type" /> <!-- note, tip, or warning --> - <xsl:variable name="imgsrc"> - <xsl:choose> - <xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when> - <xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when> - <xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when> - </xsl:choose> - </xsl:variable> - <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable> - <xsl:variable name="alt"> - <xsl:variable name="href"><xsl:value-of select="$alttext"/></xsl:variable> - <xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable> - <xsl:variable name="doc" select="document($href)"/> - <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> - </xsl:variable> -<!-- <p class="debug">image source: <xsl:value-of select="$imgsrc"/></p> --> - <div class="{$type}"> - <table border="0" class="{$type}" cellspacing="0" cellpadding="5"> - <tr> - <td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td> - <td><xsl:apply-templates /></td> - </tr> - </table> - </div> - <br/> + <xsl:param name="type" /> <!-- note, tip, or warning --> + <xsl:variable name="imgsrc"> + <xsl:choose> + <xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when> + <xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when> + <xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable> + <xsl:variable name="alt"> + <xsl:variable name="href"><xsl:value-of select="$alttext"/></xsl:variable> + <xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable> + <xsl:variable name="doc" select="document($href)"/> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </xsl:variable> + <!-- <p class="debug">image source: <xsl:value-of select="$imgsrc"/></p> --> + <div class="{$type}"> + <table border="0" class="{$type}" cellspacing="0" cellpadding="5"> + <tr> + <td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td> + <td><xsl:apply-templates /></td> + </tr> + </table> + </div> + <br/> </xsl:template> <!-- Insert a heading --> @@ -973,27 +971,27 @@ <!-- evaluate embeds --> <xsl:template name="insertembed"> - <xsl:param name="doc" /> - <xsl:param name="anchor" /> - <!-- different embed targets (also falsely used embed instead embedvar) --> - <xsl:choose> - <xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name --> - <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/> - </xsl:when> - <xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name --> - <p class="embedded"> - <xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/> - </p> - </xsl:when> - <xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name --> - <p class="embedded"> - <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> - </p> - </xsl:when> - <xsl:otherwise> <!-- then give up --> - <p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p> - </xsl:otherwise> - </xsl:choose> + <xsl:param name="doc" /> + <xsl:param name="anchor" /> + <!-- different embed targets (also falsely used embed instead embedvar) --> + <xsl:choose> + <xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name --> + <xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/> + </xsl:when> + <xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name --> + <p class="embedded"> + <xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/> + </p> + </xsl:when> + <xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name --> + <p class="embedded"> + <xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/> + </p> + </xsl:when> + <xsl:otherwise> <!-- then give up --> + <p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- Insert an image --> diff --git a/help3xsl/xhp2html.sh b/help3xsl/xhp2html.sh index 556a23de7e..be8f3d439c 100755 --- a/help3xsl/xhp2html.sh +++ b/help3xsl/xhp2html.sh @@ -20,9 +20,11 @@ function convert2HTML() { #outDirLang =1 #outDirHTML =2 +#lang =3 +#productversion =4 -xsltparm='--stringparam Language '$lang' --stringparam productversion '$productversion' --stringparam root '$outDirLang'/' -echo 'Converting to HTML started' +xsltparm='--stringparam Language '$3' --stringparam productversion '$4' --stringparam root '$1'/' +echo 'Conversion to HTML started for '$3 for filep in `find $1/text -name "*.xhp"` do DIR=${filep##*text/} @@ -30,9 +32,42 @@ name=${DIR:0:-3} outFile=$2'/text/'$name'html' xsltproc $xsltparm -o $outFile online_transform.xsl $filep done -echo 'Conversion to HTML finished' + +# Process tree files + +treePOFile=`mktemp` +echo $root/translations/source/$3/helpcontent2/source/auxiliary.po > $treePOFile + +ALL_TREE='sbasic.tree scalc.tree schart.tree shared.tree simpress.tree smath.tree swriter.tree' + +xhpFiles=$here/l10n/$productversion/$3/text + +treeFileHTML=$outDirHTML/contents.html +rm -f $treeFileHTML +touch $treeFileHTML + +xsltparm='--stringparam lang '$3' --stringparam productversion '$4 +for tree in $ALL_TREE +do +treeSourceFile=$root'/helpcontent2/source/auxiliary/'$tree +treeTemp1=`mktemp` +treeTemp2=`mktemp` + +"${exedir}/treex" -l $3 -i $treeSourceFile -m $treePOFile -o $treeTemp1 -r $xhpFiles + +xsltproc $xsltparm -o $treeTemp2 get_tree.xsl $treeTemp1 + +cat $treeTemp2>>$treeFileHTML + +rm -f $treeTemp1 $treeTemp2 +done + +rm -f $treePOFile + +echo 'Conversion to HTML finished for '$3 } +# Change root of git core productversion='6.0' rootHelpex=/home/tdf/git/core @@ -41,15 +76,11 @@ ALL_LANGS='en-US am ar ast bg bn bn-IN bo bs ca ca-valencia cs da de dz el en-GB here=`pwd` root=$(realpath "$here/../..") - 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 mkdir -p $here'/html/'$productversion echo 'copy global service files' @@ -95,36 +126,35 @@ echo $stub1 >> $ffile awk 'NF' $ffile2 >> $ffile echo $stub2 >> $ffile -# ALL_LANGS="en-US fr" for lang in $ALL_LANGS do -echo 'lang = '$lang +echo 'Processing Language '$lang -echo 'LIB -> '${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:} - -mkdir -p $here'/l10n/'$productversion'/'$lang outDirLang=$here'/l10n/'$productversion'/'$lang +mkdir -p $outDirLang -mkdir -p $here'/html/'$productversion'/'$lang outDirHTML=$here'/html/'$productversion'/'$lang +mkdir -p $outDirHTML -xsltparm='--stringparam Language '$lang' --stringparam productversion '$productversion' --stringparam root '$outDirLang'/' +# Special case of en-US, tehre is no translation to do 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 +pofiles=`mktemp` +xhpfiles=`mktemp` +# gather all po files of dir find $translations -type f >$pofiles +# For each po file for ff in `cat $pofiles` do echo 'Processing po file: '$ff @@ -137,7 +167,7 @@ do mkdir -p $outDir ls $hlpFileDir/*.xhp >$xhpfiles "${exedir}/helpex" -l $lang -mi $xhpfiles -m $potemp -o $outDir - rm $potemp + rm -f $potemp done fi @@ -145,12 +175,9 @@ fi echo 'Extracting bookmarks' ./get_bookmark.sh $lang $productversion & -convert2HTML $outDirLang $outDirHTML & +# converting to HTML +convert2HTML $outDirLang $outDirHTML $lang $productversion & +rm -f $pofiles $xhpfiles done exit - - - - - |