diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2017-07-17 11:28:49 -0300 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@edx.srv.br> | 2017-07-17 16:37:46 +0200 |
commit | e9e6c25c54de48394ca994073aa837de529dc89e (patch) | |
tree | abca562329afa5a993a9b53e737887c8b641cb40 /help3xsl | |
parent | 7c56a1e73cb266350862ea05c5b9592ad5a482c0 (diff) |
tdf#97745 Help-in-browser (x) refactor contents
Tree files now loaded as javascript
More fixes
Change-Id: Ifa353e717eec63e2369fbeabab7463f4ccd72392
Reviewed-on: https://gerrit.libreoffice.org/40069
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 | 15 | ||||
-rw-r--r-- | help3xsl/get_bookmark.xsl | 17 | ||||
-rw-r--r-- | help3xsl/get_tree.xsl | 61 | ||||
-rw-r--r-- | help3xsl/online_transform.xsl | 3 | ||||
-rwxr-xr-x | help3xsl/xhp2html.sh | 6 |
5 files changed, 47 insertions, 55 deletions
diff --git a/help3xsl/default.css b/help3xsl/default.css index 7cbfba3f15..d0ac1d303e 100644 --- a/help3xsl/default.css +++ b/help3xsl/default.css @@ -25,7 +25,7 @@ */ -/* Structure */ +/* Document Structure */ html{ background: #FFFFFF; } @@ -37,6 +37,8 @@ body { max-width: 900px; } +/* Document Header */ + header { background: #00a500; padding: .5em 2em; @@ -81,9 +83,15 @@ header nav a:hover, header nav a:focus{ [role=main]{ padding:1.5em 3em; } + +/* Document Article */ + article{ padding: 1em 0; } + +/* Document Footer */ + footer{ background: #00a500; color: #fff; @@ -113,7 +121,6 @@ footer a{ .contents-treeview { -/* font: normal 11px "Segoe UI", Arial, Sans-serif;*/ -moz-user-select: none; -webkit-user-select: none; user-select: none; @@ -121,7 +128,6 @@ footer a{ .contents-treeview a { -/* color: #00f; */ text-decoration: none; } @@ -283,7 +289,6 @@ h4, h5, h6 { } .avis { -/* background-color: #EEEEEE;*/ } .relatedtopics { @@ -373,7 +378,7 @@ a:active{ top:1px; } -/* Tabs */ +/* Document Tabs */ .js-on #tabs article { diff --git a/help3xsl/get_bookmark.xsl b/help3xsl/get_bookmark.xsl index 80dfa2c025..1a153c89e6 100644 --- a/help3xsl/get_bookmark.xsl +++ b/help3xsl/get_bookmark.xsl @@ -57,16 +57,15 @@ xsltproc get_bookmark.xsl <file.xhp> <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: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: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> diff --git a/help3xsl/get_tree.xsl b/help3xsl/get_tree.xsl index 0dd417798f..c80ba1b95b 100644 --- a/help3xsl/get_tree.xsl +++ b/help3xsl/get_tree.xsl @@ -13,14 +13,11 @@ 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"/> - +<xsl:output indent="no" method="text"/> <!-- ############################ # Variables and Parameters # @@ -36,39 +33,41 @@ xsltproc get_tree.xsl <file.tree> # 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> +<![CDATA[<ul><li><input type="checkbox" id="]]><xsl:value-of select="@id"/><![CDATA["><label for="]]><xsl:value-of select="@id"/><![CDATA[">]]><xsl:call-template name="replace"><xsl:with-param name="text"><xsl:value-of select="@title"/></xsl:with-param></xsl:call-template><![CDATA[</label><ul>\]]> +<xsl:apply-templates/><![CDATA[</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> +<![CDATA[<li><input type="checkbox" id="]]><xsl:value-of select="@id"/><![CDATA["><label for="]]><xsl:value-of select="@id"/><![CDATA[">]]><xsl:call-template name="replace"><xsl:with-param name="text"><xsl:value-of select="@title"/></xsl:with-param></xsl:call-template><![CDATA[</label><ul>\]]> +<xsl:apply-templates/><![CDATA[</ul></li>\]]> </xsl:template> <xsl:template match="topic"> - <xsl:variable name="htmlpage"><xsl:call-template name="filehtml"> + <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:call-template> + </xsl:variable> +<![CDATA[<li><a target="_top" href="]]><xsl:value-of select="$htmlpage"/><![CDATA[">]]><xsl:call-template name="replace"><xsl:with-param name="text"><xsl:value-of select="."/></xsl:with-param></xsl:call-template><![CDATA[</a></li>\]]> </xsl:template> +<xsl:template name="replace"> + <xsl:param name="text"/> + <xsl:call-template name="brand"> + <xsl:with-param name="string"> + <xsl:call-template name="apostrophe"> + <xsl:with-param name="string"> + <xsl:value-of select="$text"/> + </xsl:with-param> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> +</xsl:template> <!-- weird characters inside bookmarks, replace by HTML entities--> <xsl:template name="apostrophe"> <xsl:param name="string"/> @@ -77,7 +76,7 @@ xsltproc get_tree.xsl <file.tree> <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[']]></xsl:text> <xsl:value-of select="substring-after($string,$apost)"/> </xsl:variable> <xsl:call-template name="apostrophe"> @@ -89,18 +88,6 @@ xsltproc get_tree.xsl <file.tree> </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"/> @@ -154,8 +141,8 @@ xsltproc get_tree.xsl <file.tree> <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'),'/')"/> diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl index 9ce04e29d2..4d630a59c1 100644 --- a/help3xsl/online_transform.xsl +++ b/help3xsl/online_transform.xsl @@ -332,10 +332,10 @@ 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"/> + <script type="text/javascript" src="{$productversion}/{$lang}/contents.js"/> <script type="text/javascript" src="{$productversion}/tabs.js"></script> <script> var myTabs = new tabs(document.getElementById("tabs"), "article", "h2").responsive("myTabs", { @@ -343,7 +343,6 @@ next: "Next" }); </script> - </body> </html> </xsl:template> diff --git a/help3xsl/xhp2html.sh b/help3xsl/xhp2html.sh index be8f3d439c..8c402d7333 100755 --- a/help3xsl/xhp2html.sh +++ b/help3xsl/xhp2html.sh @@ -42,9 +42,10 @@ ALL_TREE='sbasic.tree scalc.tree schart.tree shared.tree simpress.tree smat xhpFiles=$here/l10n/$productversion/$3/text -treeFileHTML=$outDirHTML/contents.html +treeFileHTML=$outDirHTML/contents.js rm -f $treeFileHTML touch $treeFileHTML +echo 'document.getElementById("Contents").innerHTML='$'\047''\'>$treeFileHTML xsltparm='--stringparam lang '$3' --stringparam productversion '$4 for tree in $ALL_TREE @@ -57,10 +58,11 @@ treeTemp2=`mktemp` xsltproc $xsltparm -o $treeTemp2 get_tree.xsl $treeTemp1 -cat $treeTemp2>>$treeFileHTML +awk 'NF' $treeTemp2>>$treeFileHTML rm -f $treeTemp1 $treeTemp2 done +echo $'\047'';'>>$treeFileHTML rm -f $treePOFile |