Ticket #1166: links.patch

File links.patch, 2.1 KB (added by Daniel James, 15 years ago)

Updated implementation, that uses 'boost:/libs..' instead of 'boost://libs..', and works for links from sub-directories.

  • tools/boostbook/xsl/relative-href.xsl

     
    1111
    1212<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/lib/lib.xsl"/>
    1313
     14<xsl:param name="boost.root" select="../.."/>
     15
    1416<!-- ==================================================================== -->
    1517
    1618<!-- Check if path is absolute
     
    4850
    4951    <xsl:choose>
    5052        <xsl:when test="$isabsoluteuri='1'">
    51             <xsl:value-of select="$target"/>
     53            <xsl:choose>
     54                <xsl:when test="starts-with($target, 'boost:/')">
     55                    <xsl:call-template name="href.target.relative">
     56                        <xsl:with-param name="target" select="concat($boost.root, substring-after($target, 'boost:'))"/>
     57                    </xsl:call-template>
     58                </xsl:when>
     59                <xsl:when test="starts-with($target, 'boost:')">
     60                    <xsl:call-template name="href.target.relative">
     61                        <xsl:with-param name="target" select="concat($boost.root, concat('/', substring-after($target, 'boost:')))"/>
     62                    </xsl:call-template>
     63                </xsl:when>
     64                <xsl:otherwise>
     65                    <xsl:value-of select="$target"/>
     66                </xsl:otherwise>
     67            </xsl:choose>
    5268        </xsl:when>
    5369
    5470        <xsl:otherwise>
  • tools/boostbook/xsl/xref.xsl

     
    2020    <xsl:param name="target"/>
    2121    <xsl:param name="context" select="."/>
    2222
    23     <xsl:choose>
    24         <xsl:when test="contains($target, ':')">
    25           <xsl:value-of select="$target"/>
    26         </xsl:when>
    27         <xsl:otherwise>
    2823          <xsl:call-template name="href.target.relative">
    2924            <xsl:with-param name="target" select="$target"/>
    3025          </xsl:call-template>
    31         </xsl:otherwise>
    32     </xsl:choose>
    3326
    3427</xsl:template>
    3528