Skip to content

Commit

Permalink
Fix infotexture#52 - remove chunked reference from href
Browse files Browse the repository at this point in the history
Only take the `id` after the `#` when generating the connected xref button.
  • Loading branch information
jason-fox committed Sep 6, 2022
1 parent 5f618f7 commit d29ea08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Customization/xsl/collapse.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- https://getbootstrap.com/docs/5.2/components/collapse/ -->

<xsl:template match="*[contains(@class,' topic/bodydiv ') and contains(@outputclass, 'collapse-horizontal')]">
<xsl:variable name="id" select="dita-ot:generate-html-id(.)"/>
<xsl:variable name="id" select="if(@id) then dita-ot:generate-html-id(.) else generate-id(.)"/>
<div>
<xsl:if test="contains(@otherprops, 'style(')">
<xsl:attribute name="style">
Expand Down Expand Up @@ -68,8 +68,8 @@

<!-- Override to connect an collapsed element to a button -->
<xsl:template match="*[contains(@class,' topic/xref ') and contains(@props, 'collapse-toggle')]">
<xsl:variable name="href" select="replace(@href, '#', '')"/>
<xsl:variable name="id" select="dita-ot:generate-html-id(//*[@id=$href])"/>
<xsl:variable name="href" select="substring-after(@href, '#')"/>
<xsl:variable name="id" select="if(//*[@id=$href]) then dita-ot:generate-html-id(//*[@id=$href]) else generate-id(//*[@id=$href])"/>

<a data-bs-toggle="collapse">
<xsl:call-template name="commonattributes"/>
Expand Down
4 changes: 2 additions & 2 deletions Customization/xsl/offcanvas.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

<!-- Override to connect an offcanvas to a button -->
<xsl:template match="*[contains(@class,' topic/xref ') and contains(@props, 'offcanvas-toggle')]">
<xsl:variable name="href" select="replace(@href, '#', '')"/>
<xsl:variable name="id" select="dita-ot:generate-html-id(../*[@id=$href])"/>
<xsl:variable name="href" select="substring-after(@href, '#')"/>
<xsl:variable name="id" select="if(//*[@id=$href]) then dita-ot:generate-html-id(//*[@id=$href]) else generate-id(//*[@id=$href])"/>

<a data-bs-toggle="offcanvas">
<xsl:call-template name="commonattributes"/>
Expand Down

0 comments on commit d29ea08

Please sign in to comment.