help3xsl/online_transform.xsl | 59 ++++++++++++++++++++++++++++++--- helpers/xmlhelp.dtd | 1 source/text/sbasic/shared/03000000.xhp | 4 +- 3 files changed, 58 insertions(+), 6 deletions(-)
New commits: commit 81014e5cb46166183723ae911f6968e56b403107 Author: Olivier Hallot <olivier.hal...@libreoffice.org> AuthorDate: Wed Apr 14 15:51:02 2021 -0300 Commit: Olivier Hallot <olivier.hal...@libreoffice.org> CommitDate: Wed Apr 14 21:00:20 2021 +0200 Fix sort command in Help pages After the introduction of the headings h1 ... h6 in the Help pages the sort command broke. It relied only in the <paragraph> tag for sorting, usually the first paragraph in the section. The patch extend the DTD to handle the new descendant="" attribute to select which tag to sort in the Help page Default is <paragraph> for backward compatibility. Pages with <sort> must be revisited. Change-Id: I3c6f243369429ed7824a68b11757dc15f4555c0f Reviewed-on: https://gerrit.libreoffice.org/c/help/+/114110 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org> diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl index c6e2ee1bb..d30add9d9 100644 --- a/help3xsl/online_transform.xsl +++ b/help3xsl/online_transform.xsl @@ -589,20 +589,71 @@ <xsl:template match="sort" > <xsl:variable name="order1"> <xsl:choose> - <xsl:when test="string-length(@order) = 0"><xsl:value-of select="'ascending'"/></xsl:when> + <xsl:when test="string-length(@order) = 0"><xsl:value-of select="'ascending'"/></xsl:when> <xsl:otherwise><xsl:value-of select="concat(@order,'ending')"/></xsl:otherwise> </xsl:choose> </xsl:variable> - <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::paragraph"/></xsl:apply-templates> + <xsl:choose> + <xsl:when test="string-length(@descendant)=0"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::paragraph"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h1'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h1"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h2'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h2"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h3'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h3"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h4'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h4"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h5'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h5"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h6'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h6"/></xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::paragraph"/></xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="sort" mode="embedded"> <xsl:variable name="order1"> <xsl:choose> - <xsl:when test="string-length(@order) = 0"><xsl:value-of select="'ascending'"/></xsl:when> + <xsl:when test="string-length(@order) = 0"><xsl:value-of select="'ascending'"/></xsl:when> <xsl:otherwise><xsl:value-of select="concat(@order,'ending')"/></xsl:otherwise> </xsl:choose> </xsl:variable> - <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::paragraph"/></xsl:apply-templates> + <xsl:choose> + <xsl:when test="string-length(@descendant)=0"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::paragraph"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h1'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h1"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h2'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h2"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h3'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h3"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h4'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h4"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h5'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h5"/></xsl:apply-templates> + </xsl:when> + <xsl:when test="@descendant='h6'"> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::h6"/></xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates><xsl:sort order="{$order1}" select="descendant::paragraph"/></xsl:apply-templates> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <!-- SWITCH --> diff --git a/helpers/xmlhelp.dtd b/helpers/xmlhelp.dtd index 488e7286f..6a4ef9778 100644 --- a/helpers/xmlhelp.dtd +++ b/helpers/xmlhelp.dtd @@ -215,6 +215,7 @@ Version Nov 2018 <!ELEMENT sort (section+)> <!ATTLIST sort order (asc | desc) #IMPLIED + descendant (paragraph | h1 | h2 | h3 | h4 | h5 | h6 ) #IMPLIED > <!ELEMENT switch ((case | comment)* | default?)*> commit d5c6af3d35bef4a734dd38725f069b393d02379d Author: Olivier Hallot <olivier.hal...@libreoffice.org> AuthorDate: Wed Apr 14 15:27:15 2021 -0300 Commit: Olivier Hallot <olivier.hal...@libreoffice.org> CommitDate: Wed Apr 14 21:00:06 2021 +0200 Fix broken link Change-Id: I7ba4bb85586d7207e8c6f83006b172662344c118 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/114109 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org> diff --git a/source/text/sbasic/shared/03000000.xhp b/source/text/sbasic/shared/03000000.xhp index c9eff8c04..a4d518f14 100644 --- a/source/text/sbasic/shared/03000000.xhp +++ b/source/text/sbasic/shared/03000000.xhp @@ -43,9 +43,9 @@ <embed href="text/sbasic/shared/03080000.xhp#numeric"/> <embed href="text/sbasic/shared/03090000.xhp#prog_execution"/> <embed href="text/sbasic/shared/03100000.xhp#variables"/> -<embed href="text/sbasic/shared/03110000.xhp#operators"/> +<embed href="text/sbasic/shared/03110100.xhp#operators"/> <embed href="text/sbasic/shared/03120000.xhp#strings"/> <embed href="text/sbasic/shared/03130000.xhp#other"/> </body> -</helpdocument> \ No newline at end of file +</helpdocument> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits