|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51261 - in trunk: doc/test tools/boostbook/xsl
From: daniel_james_at_[hidden]
Date: 2009-02-15 14:31:38
Author: danieljames
Date: 2009-02-15 14:31:37 EST (Sun, 15 Feb 2009)
New Revision: 51261
URL: http://svn.boost.org/trac/boost/changeset/51261
Log:
Implement the 'boost:' for links relative to boost root. Also, optionally
replace links within the boost distribution with links to the the boost site,
which is useful for generating pdfs and standalone documentation.
Implemented with John Maddock. Fixes #1166.
Text files modified:
trunk/doc/test/Jamfile.v2 | 1
trunk/doc/test/test.qbk | 9 +++++++
trunk/tools/boostbook/xsl/docbook.xsl | 46 +++++++++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 1 deletions(-)
Modified: trunk/doc/test/Jamfile.v2
==============================================================================
--- trunk/doc/test/Jamfile.v2 (original)
+++ trunk/doc/test/Jamfile.v2 2009-02-15 14:31:37 EST (Sun, 15 Feb 2009)
@@ -164,6 +164,7 @@
# PDF Options:
#======================================================================
<format>pdf:<xsl:param>img.src.path=$(images_location)/
+ <xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/test/html
;
Modified: trunk/doc/test/test.qbk
==============================================================================
--- trunk/doc/test/test.qbk (original)
+++ trunk/doc/test/test.qbk 2009-02-15 14:31:37 EST (Sun, 15 Feb 2009)
@@ -375,6 +375,15 @@
Try this: [@http://www.boost.org this is [*boost's] website....] it should
be visible as a link.
+This is [@../../../boost/math/distributions.hpp a link to a header file (boost/math/distributions.hpp)],
+it should be rewritable and point to the website when built as a PDF.
+
+This is [@boost:libs/regex/index.html a link to another library's documentation (Boost.Regex)], using the boost: protocol,
+it should be rewritten to point to the website when building a PDF.
+
+This is [@boost:/libs/regex/index.html a link to another library's documentation (Boost.Regex)], using the boost:/ protocol,
+it should be rewritten to point to the website when building a PDF.
+
[endsect]
[section Footnotes]
Modified: trunk/tools/boostbook/xsl/docbook.xsl
==============================================================================
--- trunk/tools/boostbook/xsl/docbook.xsl (original)
+++ trunk/tools/boostbook/xsl/docbook.xsl 2009-02-15 14:31:37 EST (Sun, 15 Feb 2009)
@@ -20,16 +20,37 @@
<!-- The root of the Boost directory -->
<xsl:param name="boost.root" select="'../..'"/>
- <xsl:param name="boost.header.root" select="$boost.root"/>
<!-- A space-separated list of libraries to include in the
output. If this list is empty, all libraries will be included. -->
<xsl:param name="boost.include.libraries" select="''"/>
+ <!-- Whether to rewrite relative URL's to point to the website -->
+ <xsl:param name="boost.url.prefix"/>
+
<!-- A space-separated list of xml elements in the input file for which
whitespace should be preserved -->
<xsl:preserve-space elements="*"/>
+ <!-- The root for boost headers -->
+ <xsl:param name="boost.header.root">
+ <xsl:if test="$boost.url.prefix">
+ <xsl:value-of select="$boost.url.prefix"/>
+ <xsl:text>/</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="$boost.root"/>
+ </xsl:param>
+
+ <!-- The prefix for 'boost:' links. -->
+ <xsl:variable name="boost.protocol.text">
+ <xsl:if test="($boost.url.prefix != '') and (contains($boost.root, '://') = 0)">
+ <xsl:value-of select="concat($boost.url.prefix, '/', $boost.root)"/>
+ </xsl:if>
+ <xsl:if test="($boost.url.prefix = '') or contains($boost.root, '://')">
+ <xsl:value-of select="$boost.root"/>
+ </xsl:if>
+ </xsl:variable>
+
<xsl:template match="library-reference">
<xsl:choose>
<xsl:when test="ancestor::library-reference">
@@ -183,6 +204,28 @@
</xsl:template>
<!-- Linking -->
+ <xsl:template match="ulink">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:attribute name="url">
+ <xsl:choose>
+ <xsl:when test="starts-with(@url, 'boost:/')">
+ <xsl:value-of select="concat($boost.protocol.text, substring-after(@url, 'boost:'))"/>
+ </xsl:when>
+ <xsl:when test="starts-with(@url, 'boost:')">
+ <xsl:value-of select="concat($boost.protocol.text, '/', substring-after(@url, 'boost:'))"/>
+ </xsl:when>
+ <xsl:when test="$boost.url.prefix != '' and not(contains(@url, ':') or starts-with(@url, '//'))">
+ <xsl:value-of select="concat($boost.url.prefix, '/', @url)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@url"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
<xsl:template name="internal-link">
<xsl:param name="to"/>
<xsl:param name="text"/>
@@ -496,3 +539,4 @@
</xsl:if>
</xsl:template>
</xsl:stylesheet>
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk