Revision: 433 Author: alai04 Date: Sun Sep 12 19:23:16 2010 Log: 升级至1.44.0,第10批,tools/目录 http://code.google.com/p/boost-doc-zh/source/detail?r=433 Added: /trunk/tools/boostbook/xsl/html-base.xsl /trunk/tools/inspect/apple_macro_check.cpp /trunk/tools/inspect/apple_macro_check.hpp /trunk/tools/inspect/end_check.cpp /trunk/tools/inspect/end_check.hpp /trunk/tools/inspect/link_check_test.html Modified: /trunk/tools/bcp/add_path.cpp /trunk/tools/bcp/copy_path.cpp /trunk/tools/bcp/doc/Jamfile.v2 /trunk/tools/bcp/doc/html/index.html /trunk/tools/bcp/fileview.cpp /trunk/tools/boostbook/doc/Jamfile.v2 /trunk/tools/boostbook/doc/boostbook.xml /trunk/tools/boostbook/xsl/admon.xsl /trunk/tools/boostbook/xsl/annotation.xsl /trunk/tools/boostbook/xsl/callout.xsl /trunk/tools/boostbook/xsl/chunk-common.xsl /trunk/tools/boostbook/xsl/docbook.xsl /trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl /trunk/tools/boostbook/xsl/fo.xsl /trunk/tools/boostbook/xsl/function.xsl /trunk/tools/boostbook/xsl/global.xsl /trunk/tools/boostbook/xsl/html-single.xsl /trunk/tools/boostbook/xsl/html.xsl /trunk/tools/boostbook/xsl/lookup.xsl /trunk/tools/boostbook/xsl/navbar.xsl /trunk/tools/boostbook/xsl/reference.xsl /trunk/tools/boostbook/xsl/source-highlight.xsl /trunk/tools/boostbook/xsl/template.xsl /trunk/tools/boostbook/xsl/type.xsl /trunk/tools/boostbook/xsl/xhtml.xsl /trunk/tools/build/v2/doc/jamfile.jam /trunk/tools/build/v2/doc/src/standalone.xml /trunk/tools/build/v2/doc/src/userman.xml /trunk/tools/build/v2/index.html /trunk/tools/index.html /trunk/tools/inspect/ascii_check.cpp /trunk/tools/inspect/ascii_check.hpp /trunk/tools/inspect/copyright_check.cpp /trunk/tools/inspect/copyright_check.hpp /trunk/tools/inspect/crlf_check.cpp /trunk/tools/inspect/crlf_check.hpp /trunk/tools/inspect/cvs_iterator.hpp /trunk/tools/inspect/doc/build.jam /trunk/tools/inspect/inspect.cpp /trunk/tools/inspect/inspector.hpp /trunk/tools/inspect/license_check.cpp /trunk/tools/inspect/license_check.hpp /trunk/tools/inspect/link_check.cpp /trunk/tools/inspect/link_check.hpp /trunk/tools/inspect/minmax_check.cpp /trunk/tools/inspect/minmax_check.hpp /trunk/tools/inspect/path_name_check.cpp /trunk/tools/inspect/path_name_check.hpp /trunk/tools/inspect/tab_check.cpp /trunk/tools/inspect/tab_check.hpp /trunk/tools/inspect/time_string.hpp /trunk/tools/inspect/unnamed_namespace_check.cpp /trunk/tools/inspect/unnamed_namespace_check.hpp /trunk/tools/inspect/wrong_line_ends_test.cpp /trunk/tools/quickbook/doc/Jamfile.v2 /trunk/tools/quickbook/doc/quickbook.qbk /trunk/tools/regression/doc/index.html /trunk/tools/regression/doc/library_status.html /trunk/tools/release/index.html ======================================= --- /dev/null +++ /trunk/tools/boostbook/xsl/html-base.xsl Sun Sep 12 19:23:16 2010 @@ -0,0 +1,320 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com> + + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) + --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";+ xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision";
+ version="1.0"> + + <xsl:param name="html.stylesheet"> + <xsl:choose> + <xsl:when test = "$boost.defaults = 'Boost'">+ <xsl:value-of select = "concat($boost.root, '/doc/src/boostbook.css')"/>
+ </xsl:when> + <xsl:otherwise> + boostbook.css + </xsl:otherwise> + </xsl:choose> + </xsl:param> + + <xsl:param name="boost.graphics.root"> + <xsl:choose> + <xsl:when test = "$boost.defaults = 'Boost'"> + <xsl:value-of select = "concat($boost.root, '/doc/src/images/')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select = "'images/'"/> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + + <xsl:param name="admon.style"/> + <xsl:param name="admon.graphics">1</xsl:param> + <xsl:param name="boostbook.verbose" select="0"/> + <xsl:param name="navig.graphics" select="1"/> + <xsl:param name="navig.graphics.extension" select="'.png'"/> + <xsl:param name="chapter.autolabel" select="1"/> + <xsl:param name="use.id.as.filename" select="1"/> + <xsl:param name="refentry.generate.name" select="0"/> + <xsl:param name="refentry.generate.title" select="1"/> + <xsl:param name="make.year.ranges" select="1"/> + <xsl:param name="generate.manifest" select="1"/> + <xsl:param name="generate.section.toc.level" select="3"/> + <xsl:param name="doc.standalone">false</xsl:param> + <xsl:param name="chunker.output.indent">yes</xsl:param> + <xsl:param name="chunker.output.encoding">US-ASCII</xsl:param>+ <xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
+ <xsl:param name="toc.max.depth">2</xsl:param> + <xsl:param name="callout.graphics.number.limit">15</xsl:param> + <xsl:param name = "admon.graphics.path" select="$boost.graphics.root" /> + <xsl:param name = "navig.graphics.path" select="$boost.graphics.root" /> + <xsl:param name = "callout.graphics.path" + select = "concat($boost.graphics.root, 'callouts/')"/> + + + <xsl:param name="admon.style"> + <!-- Remove the style. Let the CSS do the styling --> +</xsl:param> + +<!-- Always have graphics --> +<xsl:param name="admon.graphics" select="1"/> + + <xsl:param name="generate.toc"> +appendix toc,title +article/appendix nop +article toc,title +book toc,title +chapter toc,title +part toc,title +preface toc,title +qandadiv toc +qandaset toc +reference toc,title +sect1 toc +sect2 toc +sect3 toc +sect4 toc +sect5 toc +section toc +set toc,title + </xsl:param> + + + <xsl:template name="format.cvs.revision"> + <xsl:param name="text"/> + + <!-- Remove the "$Date: " --> + <xsl:variable name="text.noprefix" + select="substring-after($text, '$Date: ')"/> + + <!-- Grab the year -->+ <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
+ <xsl:variable name="text.noyear" + select="substring-after($text.noprefix, '/')"/> + + <!-- Grab the month -->+ <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
+ <xsl:variable name="text.nomonth" + select="substring-after($text.noyear, '/')"/> + + <!-- Grab the year -->+ <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
+ <xsl:variable name="text.noday" + select="substring-after($text.nomonth, ' ')"/> + + <!-- Get the time --> + <xsl:variable name="time" select="substring-before($text.noday, ' ')"/> + + <xsl:variable name="month.name"> + <xsl:choose> + <xsl:when test="$month=1">January</xsl:when> + <xsl:when test="$month=2">February</xsl:when> + <xsl:when test="$month=3">March</xsl:when> + <xsl:when test="$month=4">April</xsl:when> + <xsl:when test="$month=5">May</xsl:when> + <xsl:when test="$month=6">June</xsl:when> + <xsl:when test="$month=7">July</xsl:when> + <xsl:when test="$month=8">August</xsl:when> + <xsl:when test="$month=9">September</xsl:when> + <xsl:when test="$month=10">October</xsl:when> + <xsl:when test="$month=11">November</xsl:when> + <xsl:when test="$month=12">December</xsl:when> + </xsl:choose> + </xsl:variable> ++ <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
+ $time, ' GMT')"/> + </xsl:template> + + + <xsl:template name="format.svn.revision"> + <xsl:param name="text"/> + + <!-- Remove the "$Date: " --> + <xsl:variable name="text.noprefix" + select="substring-after($text, '$Date: ')"/> + + <!-- Grab the year -->+ <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
+ <xsl:variable name="text.noyear" + select="substring-after($text.noprefix, '-')"/> + + <!-- Grab the month -->+ <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
+ <xsl:variable name="text.nomonth" + select="substring-after($text.noyear, '-')"/> + + <!-- Grab the year -->+ <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
+ <xsl:variable name="text.noday" + select="substring-after($text.nomonth, ' ')"/> + + <!-- Get the time --> + <xsl:variable name="time" select="substring-before($text.noday, ' ')"/> + <xsl:variable name="text.notime" + select="substring-after($text.noday, ' ')"/> + + <!-- Get the timezone -->+ <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
+ + <xsl:variable name="month.name"> + <xsl:choose> + <xsl:when test="$month=1">January</xsl:when> + <xsl:when test="$month=2">February</xsl:when> + <xsl:when test="$month=3">March</xsl:when> + <xsl:when test="$month=4">April</xsl:when> + <xsl:when test="$month=5">May</xsl:when> + <xsl:when test="$month=6">June</xsl:when> + <xsl:when test="$month=7">July</xsl:when> + <xsl:when test="$month=8">August</xsl:when> + <xsl:when test="$month=9">September</xsl:when> + <xsl:when test="$month=10">October</xsl:when> + <xsl:when test="$month=11">November</xsl:when> + <xsl:when test="$month=12">December</xsl:when> + </xsl:choose> + </xsl:variable> ++ <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
+ $time, ' ', $timezone)"/> + </xsl:template> + + <!-- Footer Copyright --> + <xsl:template match="copyright" mode="boost.footer"> + <xsl:if test="position() > 1"> + <br/> + </xsl:if> + <xsl:call-template name="gentext"> + <xsl:with-param name="key" select="'Copyright'"/> + </xsl:call-template> + <xsl:call-template name="gentext.space"/> + <xsl:call-template name="dingbat"> + <xsl:with-param name="dingbat">copyright</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="gentext.space"/> + <xsl:call-template name="copyright.years"> + <xsl:with-param name="years" select="year"/> + <xsl:with-param name="print.ranges" select="$make.year.ranges"/> + <xsl:with-param name="single.year.ranges" + select="$make.single.year.ranges"/> + </xsl:call-template> + <xsl:call-template name="gentext.space"/> + <xsl:apply-templates select="holder" mode="titlepage.mode"/> + </xsl:template> + + <!-- Footer License --> + <xsl:template match="legalnotice" mode="boost.footer"> + <xsl:apply-templates select="para" mode="titlepage.mode" /> + </xsl:template> + + <xsl:template name="user.footer.content"> + <table width="100%"> + <tr> + <td align="left"> + <xsl:variable name="revision-nodes" + select="ancestor-or-self::* + [not (attribute::rev:last-revision='')]"/> + <xsl:if test="count($revision-nodes) > 0"> + <xsl:variable name="revision-node" + select="$revision-nodes[last()]"/> + <xsl:variable name="revision-text"> + <xsl:value-of+ select="normalize-space($revision-node/attribute::rev:last-revision)"/>
+ </xsl:variable> + <xsl:if test="string-length($revision-text) > 0"> + <p> + <small> + <xsl:text>Last revised: </xsl:text> + <xsl:choose> + <xsl:when test="contains($revision-text, '/')"> + <xsl:call-template name="format.cvs.revision">+ <xsl:with-param name="text" select="$revision-text"/>
+ </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="format.svn.revision">+ <xsl:with-param name="text" select="$revision-text"/>
+ </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </small> + </p> + </xsl:if> + </xsl:if> + </td> + <td align="right"> + <div class = "copyright-footer"> + <xsl:apply-templates select="ancestor::*/*/copyright" + mode="boost.footer"/> + <xsl:apply-templates select="ancestor::*/*/legalnotice" + mode="boost.footer"/> + </div> + </td> + </tr> + </table> + </xsl:template> + + <!-- We don't want refentry's to show up in the TOC because they + will merely be redundant with the synopsis. --> + <xsl:template match="refentry" mode="toc"/> + + <!-- override the behaviour of some DocBook elements for better + rendering facilities --> + + <xsl:template match = "programlisting[ancestor::informaltable]"> + <pre class = "table-{name(.)}"><xsl:apply-templates/></pre> + </xsl:template> + + <xsl:template match = "refsynopsisdiv"> + <h2 class = "{name(.)}-title">Synopsis</h2> + <div class = "{name(.)}"> + <xsl:apply-templates/> + </div> + </xsl:template> + + <xsl:template name="generate.html.title"/> + +<!-- ============================================================ --> + +<xsl:template name="output.html.stylesheets"> + <xsl:param name="stylesheets" select="''"/> + + <xsl:choose> + <xsl:when test="contains($stylesheets, ' ')"> + <link rel="stylesheet"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target.relative">+ <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
+ </xsl:call-template> + </xsl:attribute> + <xsl:if test="$html.stylesheet.type != ''"> + <xsl:attribute name="type"> + <xsl:value-of select="$html.stylesheet.type"/> + </xsl:attribute> + </xsl:if> + </link> + <xsl:call-template name="output.html.stylesheets">+ <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
+ </xsl:call-template> + </xsl:when> + <xsl:when test="$stylesheets != ''"> + <link rel="stylesheet"> + <xsl:attribute name="href"> + <xsl:call-template name="href.target.relative">+ <xsl:with-param name="target" select="$stylesheets"/>
+ </xsl:call-template> + </xsl:attribute> + <xsl:if test="$html.stylesheet.type != ''"> + <xsl:attribute name="type"> + <xsl:value-of select="$html.stylesheet.type"/> + </xsl:attribute> + </xsl:if> + </link> + </xsl:when> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> ======================================= --- /dev/null +++ /trunk/tools/inspect/apple_macro_check.cpp Sun Sep 12 19:23:16 2010 @@ -0,0 +1,105 @@+// apple_macro_check implementation ------------------------------------------------//
+ +// Copyright Marshall Clow 2007. +// Based on the tab-check checker by Beman Dawes +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include "apple_macro_check.hpp" +#include <functional> +#include "boost/regex.hpp" +#include "boost/lexical_cast.hpp" +#include "boost/filesystem/operations.hpp" + +namespace fs = boost::filesystem; + +namespace +{ + boost::regex apple_macro_regex( + "(" + "^\\s*#\\s*undef\\s*" // # undef+ "\\b(check|verify|require|check_error)\\b" // followed by apple macro name, whole word
+ ")" + "|" // or (ignored) + "(" + "//[^\\n]*" // single line comments (//) + "|" + "/\\*.*?\\*/" // multi line comments (/**/) + "|" + "\"(?:\\\\\\\\|\\\\\"|[^\"])*\"" // string literals + ")" + "|" // or + "("+ "\\b(check|verify|require|check_error)\\b" // apple macro name, whole word
+ "\\s*\\(" // followed by 0 or more spaces and an opening paren + ")" + , boost::regex::normal); + +} // unnamed namespace + + +namespace boost +{ + namespace inspect + { + apple_macro_check::apple_macro_check() : m_files_with_errors(0) + { + register_signature( ".c" ); + register_signature( ".cpp" ); + register_signature( ".cxx" ); + register_signature( ".h" ); + register_signature( ".hpp" ); + register_signature( ".hxx" ); + register_signature( ".ipp" ); + } + + void apple_macro_check::inspect( + const string & library_name,+ const path & full_path, // example: c:/foo/boost/filesystem/path.hpp
+ const string & contents ) // contents of file to be inspected + {+ if (contents.find( "boostinspect:" "naapple_macros" ) != string::npos) return;
++ // Only check files in the boost directory, as we can avoid including the
+ // apple test headers elsewhere.+ path relative( relative_to( full_path, fs::initial_path() ), fs::no_check );
+ if ( relative.empty() || *relative.begin() != "boost") return; ++ boost::sregex_iterator cur(contents.begin(), contents.end(), apple_macro_regex), end;
+ + long errors = 0; + + for( ; cur != end; ++cur /*, ++m_files_with_errors*/ ) + { + + if(!(*cur)[3].matched) + { + string::const_iterator it = contents.begin(); + string::const_iterator match_it = (*cur)[0].first; + + string::const_iterator line_start = it; + + string::size_type line_number = 1; + for ( ; it != match_it; ++it) { + if (string::traits_type::eq(*it, '\n')) { + ++line_number; + line_start = it + 1; // could be end() + } + } + + ++errors; + error( library_name, full_path,+ "Apple macro clash: " + std::string((*cur)[0].first, (*cur)[0].second-1),
+ line_number ); + } + } + if(errors > 0) { + ++m_files_with_errors; + } + } + } // namespace inspect +} // namespace boost + + ======================================= --- /dev/null +++ /trunk/tools/inspect/apple_macro_check.hpp Sun Sep 12 19:23:16 2010 @@ -0,0 +1,39 @@+// apple_macro_check header --------------------------------------------------------//
+ +// Copyright Marshall Clow 2007. +// Based on the tab-check checker by Beman Dawes +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_APPLE_MACRO_CHECK_HPP +#define BOOST_APPLE_MACRO_CHECK_HPP + +#include "inspector.hpp" + + +namespace boost +{ + namespace inspect + { + class apple_macro_check : public inspector + { + long m_files_with_errors; + public: + + apple_macro_check(); + virtual const char * name() const { return "*APPLE-MACROS*"; }+ virtual const char * desc() const { return "calls to Apple's debugging macros in file"; }
+ + virtual void inspect( + const std::string & library_name, + const path & full_path, + const std::string & contents ); + + virtual ~apple_macro_check()+ { std::cout << " " << m_files_with_errors << " files with Apple macros" << line_break(); }
+ }; + } +} + +#endif // BOOST_APPLE_MACRO_CHECK_HPP ======================================= --- /dev/null +++ /trunk/tools/inspect/end_check.cpp Sun Sep 12 19:23:16 2010 @@ -0,0 +1,58 @@+// end_check implementation -------------------------------------------------//
+ +// Copyright Beman Dawes 2002. +// Copyright Daniel James 2009. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include "end_check.hpp" +#include <boost/next_prior.hpp> + +namespace boost +{ + namespace inspect + { + end_check::end_check() : m_files_with_errors(0) + { + register_signature( ".c" ); + register_signature( ".cpp" ); + register_signature( ".cxx" ); + register_signature( ".h" ); + register_signature( ".hpp" ); + register_signature( ".hxx" ); + register_signature( ".ipp" ); + } + + void end_check::inspect( + const string & library_name,+ const path & full_path, // example: c:/foo/boost/filesystem/path.hpp
+ const string & contents ) // contents of file to be inspected + { + if (contents.find( "boostinspect:" "noend" ) != string::npos) return; + + // this file deliberately contains errors + const char test_file_name[] = "wrong_line_ends_test.cpp"; + + char final_char = contents.begin() == contents.end() ? '\0' + : *(boost::prior(contents.end())); + + bool failed = final_char != '\n' && final_char != '\r'; + + if (failed && full_path.leaf() != test_file_name) + { + ++m_files_with_errors; + error( library_name, full_path, string(name()) + ' ' + desc() ); + } + + if (!failed && full_path.leaf() == test_file_name) + { + ++m_files_with_errors;+ error( library_name, full_path, string(name()) + " should not end with a newline" );
+ } + } + } // namespace inspect +} // namespace boost + + ======================================= --- /dev/null +++ /trunk/tools/inspect/end_check.hpp Sun Sep 12 19:23:16 2010 @@ -0,0 +1,40 @@+// end_check header ---------------------------------------------------------//
+ +// Copyright Beman Dawes 2002. +// Copyright Rene Rivera 2004. +// Copyright Daniel James 2009. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_END_CHECK_HPP +#define BOOST_END_CHECK_HPP + +#include "inspector.hpp" + +namespace boost +{ + namespace inspect + { + class end_check : public inspector + { + long m_files_with_errors; + public: + + end_check(); + virtual const char * name() const { return "*END*"; }+ virtual const char * desc() const { return "file doesn't end with a newline"; }
+ + virtual void inspect( + const std::string & library_name, + const path & full_path, + const std::string & contents ); + + virtual ~end_check()+ { std::cout << " " << m_files_with_errors << " files that don't end with a newline" << line_break(); }
+ }; + } +} + +#endif // BOOST_END_CHECK_HPP ======================================= --- /dev/null +++ /trunk/tools/inspect/link_check_test.html Sun Sep 12 19:23:16 2010 @@ -0,0 +1,24 @@ +<html> + +<head> +<meta http-equiv="Content-Language" content="en-us"> +<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> +<meta name="ProgId" content="FrontPage.Editor.Document"> +<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<title>valid link</title> +</head> + +<body> + +<p><a href="#link-target">valid bookmark link</a></p> +<p><a href="link_check_test.html">valid relative link</a></p> +<p><a href="foo.html#bar">broken relative link with bookmark</a></p> +<p><a href="#broken">broken bookmark link</a></p> +<p><a name="link-target">bookmark</a></p> +<p><a name="second-target">second bookmark</a></p> +<p><a name="SECOND-TARGET">duplicate second bookmark</a></p> +<p> </p> + +</body> + +</html> ======================================= --- /trunk/tools/bcp/add_path.cpp Mon Feb 8 23:37:27 2010 +++ /trunk/tools/bcp/add_path.cpp Sun Sep 12 19:23:16 2010 @@ -71,10 +71,11 @@ std::string s(i->string()); if(m_boost_path.string().size()) s.erase(0, m_boost_path.string().size() + 1); - if(!m_dependencies.count(fs::path(s))) - { - m_dependencies[fs::path(s)] = p; // set up dependency tree - add_path(fs::path(s)); + fs::path np = s; + if(!m_dependencies.count(np)) + { + m_dependencies[np] = p; // set up dependency tree + add_path(np); } ++i; } @@ -290,6 +291,24 @@ continue; } include_file = i->str(); + fs::path test_file(m_boost_path / p.branch_path() / include_file);+ if(fs::exists(test_file) && !fs::is_directory(test_file) && (p.branch_path().string() != "boost"))
+ { + if(!m_dependencies.count(p.branch_path() / include_file)) + { + m_dependencies[p.branch_path() / include_file] = p; + add_path(p.branch_path() / include_file); + } + } + else if(fs::exists(m_boost_path / include_file)) + { + if(!m_dependencies.count(include_file)) + { + m_dependencies[include_file] = p; + add_path(include_file); + } + } + ++i; } catch(const fs::filesystem_error&) { @@ -297,24 +316,6 @@ ++i; continue; } - fs::path test_file(m_boost_path / p.branch_path() / include_file);- if(fs::exists(test_file) && !fs::is_directory(test_file) && (p.branch_path().string() != "boost"))
- { - if(!m_dependencies.count(p.branch_path() / include_file)) - { - m_dependencies[p.branch_path() / include_file] = p; - add_path(p.branch_path() / include_file); - } - } - else if(fs::exists(m_boost_path / include_file)) - { - if(!m_dependencies.count(include_file)) - { - m_dependencies[include_file] = p; - add_path(include_file); - } - } - ++i; } // // Now we need to scan for Boost.Preprocessor includes that ======================================= --- /trunk/tools/bcp/copy_path.cpp Mon Feb 8 23:37:27 2010 +++ /trunk/tools/bcp/copy_path.cpp Sun Sep 12 19:23:16 2010 @@ -58,7 +58,7 @@ // // do text based copy if requested: // - if(m_namespace_name.size() && m_lib_names.size() && is_jam_file(p)) + if(p.leaf() == "Jamroot") { static std::vector<char> v1, v2; v1.clear(); @@ -66,6 +66,32 @@ std::ifstream is((m_boost_path / p).native_file_string().c_str());std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
+ static boost::regex libname_matcher; + if(libname_matcher.empty()) + { + libname_matcher.assign("boost_"); + } ++ regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), libname_matcher, m_namespace_name + "_");
+ std::swap(v1, v2); + v2.clear(); + + std::ofstream os; + if(m_unix_lines)+ os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
+ else+ os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::out);
+ os.write(&*v1.begin(), v1.size()); + os.close(); + } + else if(m_namespace_name.size() && m_lib_names.size() && is_jam_file(p)) + { + static std::vector<char> v1, v2; + v1.clear(); + v2.clear(); + std::ifstream is((m_boost_path / p).native_file_string().c_str());+ std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1));
+ static boost::regex libname_matcher; if(libname_matcher.empty()) { @@ -106,25 +132,33 @@ static const boost::regex namespace_matcher( "(?|" - "(namespace\\s+)boost(_\\w+)?" + "(namespace\\s+)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?" "|" "(namespace\\s+)(adstl|phoenix|rapidxml)\\>" "|" - "()boost((?:_\\w+)?\\s*(?:::|,|\\)))" + "()\\<boost((?:_(?!intrusive_tags)\\w+)?\\s*(?:::))(?:(\\s*)phoenix)?" "|" - "()((?:adstl|phoenix|rapidxml)\\s*(?:::|,|\\)))" + "()\\<((?:adstl|phoenix|rapidxml)\\s*(?:::))" "|" - "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)boost(_\\w+)?" + "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?" "|"- "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)(adstl|phoenix| rapidxml)\\>" + "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?(?:\\w+\\s*::\\s*)?)(adstl| phoenix| rapidxml)\\>"
"|" - "(^\\s*#\\s*define[^\\n]+)boost((?:_\\w+)?\\s*)$" + "(^\\s*#\\s*define\\s+\\w+\\s+)boost((?:_\\w+)?\\s*)$" "|" "(^\\s*#\\s*define[^\\n]+)((?:adstl|phoenix|rapidxml)\\s*)$" + "|"+ "()boost(_asio_detail_posix_thread_function| _regex_free_static_mutex)"
+ "|"+ "()(lw_thread_routine|at_thread_exit|on_process_enter| on_process_exit|on_thread_enter|on_thread_exit|tss_cleanup_implemented)"
+ "|" + "(BOOST_CLASS_REQUIRE4?[^;]*)boost((?:_\\w+)?\\s*,)" + "|" + "(\\(\\s*)boost(\\s*\\))" ")" - ); -- regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_matcher, "$1" + m_namespace_name + "$2");
+ ); ++ regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_matcher, "$1" + m_namespace_name + "$2(?3$3" + m_namespace_name + "phoenix)", boost::regex_constants::format_all);
std::swap(v1, v2); v2.clear(); @@ -171,7 +205,8 @@os.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::binary | std::ios_base::out);
elseos.open((m_dest_path / p).native_file_string().c_str(), std::ios_base::out);
- os.write(&*v1.begin(), v1.size()); + if(v1.size()) + os.write(&*v1.begin(), v1.size()); os.close(); } else if(m_unix_lines && !is_binary_file(p)) ======================================= --- /trunk/tools/bcp/doc/Jamfile.v2 Mon Feb 8 23:37:27 2010 +++ /trunk/tools/bcp/doc/Jamfile.v2 Sun Sep 12 19:23:16 2010 @@ -14,9 +14,5 @@ <xsl:param>chunk.section.depth=0 # Path for links to Boost: <xsl:param>boost.root=../../../.. - # Path for libraries index: - <xsl:param>boost.libraries=../../../../libs/libraries.htm - # Use the main Boost stylesheet: - <xsl:param>html.stylesheet=../../../../doc/html/boostbook.css ; ======================================= --- /trunk/tools/bcp/doc/html/index.html Mon Feb 8 23:37:27 2010 +++ /trunk/tools/bcp/doc/html/index.html Sun Sep 12 19:23:16 2010 @@ -2,8 +2,8 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>BCP</title>-<link rel="stylesheet" href="../../../../doc/html/boostbook.css" type="text/css">
-<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">+<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.75.2"> <link rel="home" href="index.html" title="BCP"> </head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
@@ -17,7 +17,7 @@ </tr></table> <hr> <div class="spirit-nav"></div> -<div class="article" lang="en"> +<div class="article"> <div class="titlepage"> <div> <div><h2 class="title"> @@ -27,7 +27,7 @@ </h3></div></div></div> <div><p class="copyright">Copyright © 2209 John Maddock</p></div> <div><div class="legalnotice"> -<a name="id774375"></a><p> +<a name="id759699"></a><p>Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"; target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p> @@ -50,7 +50,7 @@ </dl></dd> </dl> </div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="bcp.overview"></a><a class="link" href="index.html#bcp.overview" title="Overview"> Overview</a>
</h2></div></div></div> @@ -64,7 +64,7 @@ what licences are used by those dependencies. </p> </div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="bcp.examples"></a><a class="link" href="index.html#bcp.examples" title="Examples"> Examples</a>
</h2></div></div></div> @@ -109,7 +109,7 @@The report contains license information, author details, and file dependencies.
</p> </div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="bcp.syntax"></a><a class="link" href="index.html#bcp.syntax" title="Syntax"> Syntax</a>
</h2></div></div></div> @@ -120,7 +120,7 @@<dt><span class="section"><a href="index.html#bcp.syntax.output"> output-path</a></span></dt> <dt><span class="section"><a href="index.html#bcp.syntax.dependencies">Dependencies</a></span></dt>
</dl></div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h3 class="title"><a name="bcp.syntax.main"></a><a class="link" href="index.html#bcp.syntax.main" title="Behaviour Selection"> Behaviour Selection</a>
</h3></div></div></div> @@ -139,29 +139,29 @@ <p> Outputs a html report file containing: </p> -<div class="itemizedlist"><ul type="disc"> -<li>- All the licenses in effect, plus the files using each license, and the
- copyright holders using each license. - </li> -<li>- Any files with no recognizable license (please report these to the boost
- mailing lists). - </li> -<li>- Any files with no recognizable copyright holders (please report these to
- the boost mailing lists). - </li> -<li>- All the copyright holders and the files on which they hold copyright.
- </li> -<li>- File dependency information - indicates the reason for the inclusion of
- any particular file in the dependencies found. - </li> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem">+ All the licenses in effect, plus the files using each license, and the
+ copyright holders using each license. + </li> +<li class="listitem">+ Any files with no recognizable license (please report these to the boost
+ mailing lists). + </li> +<li class="listitem">+ Any files with no recognizable copyright holders (please report these
+ to the boost mailing lists). + </li> +<li class="listitem">+ All the copyright holders and the files on which they hold copyright.
+ </li> +<li class="listitem">+ File dependency information - indicates the reason for the inclusion
+ of any particular file in the dependencies found. + </li> </ul></div> </div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h3 class="title"><a name="bcp.syntax.options"></a><a class="link" href="index.html#bcp.syntax.options" title="Options"> Options</a>
</h3></div></div></div> @@ -209,7 +209,7 @@ Make sure that all copied files use Unix style line endings. </p> </div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h3 class="title"><a name="bcp.syntax.module"></a><a class="link" href="index.html#bcp.syntax.module" title="module-list"> module-list</a>
</h3></div></div></div> @@ -217,23 +217,23 @@When the --scan option is not used then a list of boost files or library
names to copy, this can be: </p> -<div class="orderedlist"><ol type="1"> -<li> - The name of a tool: for example "build" will find "tools/build". - </li> -<li> - The name of a library: for example "regex". - </li> -<li>- The title of a header: for example "scoped_ptr" will find "boost/scoped_ptr.hpp".
- </li> -<li> - The name of a header: for example "scoped_ptr.hpp" will find - "boost/scoped_ptr.hpp". - </li> -<li> - The name of a file: for example "boost/regex.hpp". - </li> +<div class="orderedlist"><ol class="orderedlist" type="1"> +<li class="listitem">+ The name of a tool: for example "build" will find "tools/build".
+ </li> +<li class="listitem"> + The name of a library: for example "regex". + </li> +<li class="listitem">+ The title of a header: for example "scoped_ptr" will find "boost/scoped_ptr.hpp".
+ </li> +<li class="listitem"> + The name of a header: for example "scoped_ptr.hpp" will find + "boost/scoped_ptr.hpp". + </li> +<li class="listitem"> + The name of a file: for example "boost/regex.hpp". + </li> </ol></div> <p>When the --scan option is used, then a list of (probably non-boost) files
@@ -241,7 +241,7 @@ copied/listed. </p> </div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h3 class="title"><a name="bcp.syntax.output"></a><a class="link" href="index.html#bcp.syntax.output" title="output-path"> output-path</a>
</h3></div></div></div> @@ -249,31 +249,32 @@ The path to which files will be copied (this path must exist). </p> </div> -<div class="section" lang="en"> +<div class="section"> <div class="titlepage"><div><div><h3 class="title"><a name="bcp.syntax.dependencies"></a><a class="link" href="index.html#bcp.syntax.dependencies" title="Dependencies">Dependencies</a>
</h3></div></div></div> <p> File dependencies are found as follows: </p> -<div class="itemizedlist"><ul type="disc"> -<li>- C++ source files are scanned for #includes, all #includes present in the - boost source tree will then be scanned for their dependencies and so on.
- </li> -<li>- C++ source files are associated with the name of a library, if that library - has source code (and possibly build data), then include that source in
- the dependencies. - </li> -<li>- C++ source files are checked for dependencies on Boost.test (for example
- to see if they use cpp_main as an entry point). - </li> -<li>- HTML files are scanned for immediate dependencies (images and style sheets,
- but not links). - </li> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem">+ C++ source files are scanned for #includes, all #includes present in + the boost source tree will then be scanned for their dependencies and
+ so on. + </li> +<li class="listitem">+ C++ source files are associated with the name of a library, if that library + has source code (and possibly build data), then include that source in
+ the dependencies. + </li> +<li class="listitem">+ C++ source files are checked for dependencies on Boost.test (for example
+ to see if they use cpp_main as an entry point). + </li> +<li class="listitem">+ HTML files are scanned for immediate dependencies (images and style sheets,
+ but not links). + </li> </ul></div> <p> It should be noted that in practice bcp can produce a rather "fat" @@ -297,28 +298,28 @@274 header dependencies for boost/shared_ptr.hpp: by running bcp in report mode we can see why all these headers have been found as dependencies:
</p> -<div class="itemizedlist"><ul type="disc"> -<li>- All of the Config library headers get included (52 headers, would be about
- 6 for one compiler only). - </li> -<li>- A lot of MPL and type traits code that includes workarounds for broken - compilers that you may or may not need. Tracing back through the code shows - that most of these aren't needed unless the user has defined BOOST_SP_USE_QUICK_ALLOCATOR, - however bcp isn't aware of whether that preprocessor path will be taken - or not, so the headers get included just in case. This adds about 48 headers
- (type traits), plus another 49 from MPL. - </li> -<li>- The Preprocessor library gets used heavily by MPL: this adds another 96
- headers. - </li> -<li>- The Shared Pointer library contains a lot of platform specific code, split - up into around 22 headers: normally your compiler would need only a couple
- of these files. - </li> +<div class="itemizedlist"><ul class="itemizedlist" type="disc"> +<li class="listitem">+ All of the Config library headers get included (52 headers, would be
+ about 6 for one compiler only). + </li> +<li class="listitem">+ A lot of MPL and type traits code that includes workarounds for broken + compilers that you may or may not need. Tracing back through the code + shows that most of these aren't needed unless the user has defined BOOST_SP_USE_QUICK_ALLOCATOR, + however bcp isn't aware of whether that preprocessor path will be taken + or not, so the headers get included just in case. This adds about 48
+ headers (type traits), plus another 49 from MPL. + </li> +<li class="listitem">+ The Preprocessor library gets used heavily by MPL: this adds another
+ 96 headers. + </li> +<li class="listitem">+ The Shared Pointer library contains a lot of platform specific code, + split up into around 22 headers: normally your compiler would need only
+ a couple of these files. + </li> </ul></div> <p>As you can see the number of dependencies found are much larger than those
@@ -335,7 +336,7 @@ </div> </div><table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"; width="100%"><tr> -<td align="left"><p><small>Last revised: December 28, 2009 at 13:24:19 GMT</small></p></td> +<td align="left"><p><small>Last revised: July 08, 2010 at 22:44:20 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td> </tr></table> <hr> ======================================= --- /trunk/tools/bcp/fileview.cpp Mon Feb 8 23:37:27 2010 +++ /trunk/tools/bcp/fileview.cpp Sun Sep 12 19:23:16 2010 @@ -73,7 +73,7 @@ // iterators: fileview::const_iterator fileview::begin() const { - return &(pimpl->m_data[0]); + return pimpl->m_data.size() ? &(pimpl->m_data[0]) : 0; } fileview::const_iterator fileview::end() const ======================================= --- /trunk/tools/boostbook/doc/Jamfile.v2 Mon Dec 28 23:05:14 2009 +++ /trunk/tools/boostbook/doc/Jamfile.v2 Sun Sep 12 19:23:16 2010 @@ -8,9 +8,6 @@ import boostbook : boostbook ; boostbook boostbook : boostbook.xml : - <xsl:param>html.stylesheet=../../../../doc/html/boostbook.css <xsl:param>boost.root=../../../.. - <xsl:param>boost.libraries=../../../../libs/libraries.htm - <xsl:param>navig.graphics=1 ; ======================================= --- /trunk/tools/boostbook/doc/boostbook.xml Mon Aug 16 23:44:54 2010 +++ /trunk/tools/boostbook/doc/boostbook.xml Sun Sep 12 19:23:16 2010 @@ -9,7 +9,7 @@ <!DOCTYPE part PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd";> <part xmlns:xi="http://www.w3.org/2001/XInclude"; id="boostbook" - last-revision="$Date: 2009-07-30 02:10:36 -0400 (Thu, 30 Jul 2009) $"> + last-revision="$Date: 2010-07-19 19:29:09 -0400 (Mon, 19 Jul 2010) $"> <partinfo> <author> <firstname>Douglas</firstname> @@ -267,11 +267,11 @@ documentation for libraries that do not require Doxygen. To test this, change into the directory <filename class="directory">$BOOST_ROOT/libs/function/doc</filename> and - run the command <code>bjam --v2</code>: it should produce HTML + run the command <code>bjam</code>: it should produce HTML documentation for the Boost.Function library in the <code>html</code> subdirectory.<sbr/>到此为止,你应该可以为各个不需要 Doxygen 的库构建 HTML 文档了。要测 试一下它,请转至 <filename - class="directory">$BOOST_ROOT/libs/function/doc</filename> 目录,运 行命令 <code>bjam --v2</code>: + class="directory">$BOOST_ROOT/libs/function/doc</filename> 目录,运 行命令 <code>bjam</code>: 它会为 Boost.Function 库生成 HTML 文档并保存在 <code>html</code> 子 目录下。</para>
</section> @@ -368,11 +368,11 @@ <para>To test PDF generation, switch to the directory <filename class="directory">$BOOST_ROOT/libs/function/doc</filename> and - execute the command <command>bjam --v2 pdf</command>. In the + execute the command <command>bjam pdf</command>. In the absence of any errors, Apache FOP will be executed to transform the XSL:FO output of DocBook into a PDF file.<sbr/> 要测试 PDF 的生成,请转至 <filename- class="directory">$BOOST_ROOT/libs/function/doc</filename> 目录并执行 命令 <command>bjam --v2 pdf</command>。 + class="directory">$BOOST_ROOT/libs/function/doc</filename> 目录并执行 命令 <command>bjam pdf</command>。 如果一切正常,Apache FOP 将会执行并将 DocBook 的 XSL:FO 输出转换为 PDF 文件。</para>
</section> </section> @@ -384,13 +384,13 @@ documentation. First, change to the directory <code>$BOOST_ROOT/doc</code> and remove (or make writable) the <code>.html</code> files in - <code>$BOOST_ROOT/doc/html</code>. Then, run <code>bjam - --v2</code> to build HTML documentation. You should see several + <code>$BOOST_ROOT/doc/html</code>. Then, run <code>bjam</code> + to build HTML documentation. You should see several warnings like these while DocBook documentation is being built from BoostBook documentation:<sbr/>一旦完成 BoostBook 的配置,我们就可以来构建一些文档了。首先,转至 <code>$BOOST_ROOT/doc</code> 目录并删除(或使之可写)在 <code>$BOOST_ROOT/doc/html</code> 中的 <code>.html</code> 文件。 - 然后,运行 <code>bjam --v2</code> 来构建 HTML 文档。在从 BoostBook 文档 构建 DocBook 文档过程中,你会看到如下一些警告:</para> + 然后,运行 <code>bjam</code> 来构建 HTML 文档。在从 BoostBook 文档构建 DocBook 文档过程中,你会看到如下一些警告:</para>
<programlisting>Cannot find function named 'checked_delete' Cannot find function named 'checked_array_delete' @@ -403,19 +403,19 @@ documentation for Boost will be available in <code>$BOOST_ROOT/doc/html</code>. You can also create HTML documentation in a single (large!) HTML file with the command line - <code>bjam --v2 onehtml</code>, or Unix man pages with the command - line <code>bjam --v2 man</code>. The complete list of output + <code>bjam onehtml</code>, or Unix man pages with the command + line <code>bjam man</code>. The complete list of output formats is listed in <xref linkend="boostbook.output.formats"/>. Several output formats can be passed to a single invocation of <code>bjam</code>, e.g., - <code>bjam --v2 html man docbook</code> would generate HTML + <code>bjam html man docbook</code> would generate HTML (multiple files), man pages, and DocBook documentation.<sbr/>这些警告是在 Boost 文档工具找不到源文件中某些函数、方法或类的文档时产生 的,它们没有什么危害。 当 Boost.Jam 完成执行后,Boost 的 HTML 文档将被放在 <code>$BOOST_ROOT/doc/html</code> 目录中。 - 你也可以用命令行 <code>bjam --v2 onehtml</code> 来生成单个(巨大的!) HTML 文件,或者用命令行 - <code>bjam --v2 man</code> 来生成 Unix man 页。完成的输出格式列表请见 <xref + 你也可以用命令行 <code>bjam onehtml</code> 来生成单个(巨大的!) HTML 文 件,或者用命令行
+ <code>bjam man</code> 来生成 Unix man 页。完成的输出格式列表请见 <xreflinkend="boostbook.output.formats"/>。可以在对 <code>bjam</code> 的一次 调用中生成多种输出格式,如 - <code>bjam --v2 html man docbook</code> 将同时生成 HTML (多文件), man 页和 DocBook 文档。</para> + <code>bjam html man docbook</code> 将同时生成 HTML (多文件), man 页和 DocBook 文档。</para>
<table id="boostbook.output.formats"> <title>BoostBook Output Formats</title> ======================================= --- /trunk/tools/boostbook/xsl/admon.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/admon.xsl Sun Sep 12 19:23:16 2010 @@ -10,7 +10,9 @@ version="1.0"><xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/admon.xsl"/>
-<xsl:import href="relative-href.xsl"/> + +<!-- Already included in the main style sheet --> +<!-- <xsl:import href="relative-href.xsl"/> --> <xsl:template name="admon.graphic"> <xsl:param name="node" select="."/> ======================================= --- /trunk/tools/boostbook/xsl/annotation.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/annotation.xsl Sun Sep 12 19:23:16 2010 @@ -374,6 +374,14 @@ </xsl:choose> </xsl:template> + <xsl:template match="programlisting" mode="annotation"> + <programlisting> + <xsl:apply-templates mode="annotation"> + <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> + </programlisting> + </xsl:template> + <xsl:template match="code" mode="annotation"> <computeroutput> <xsl:apply-templates mode="annotation"/> @@ -390,6 +398,10 @@ <xsl:apply-templates mode="annotation"/> </xsl:template> + <xsl:template match="type" mode="annotation"> + <xsl:apply-templates mode="annotation"/> + </xsl:template> + <xsl:template match="comment()" mode="annotation"> <xsl:copy/> </xsl:template> ======================================= --- /trunk/tools/boostbook/xsl/callout.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/callout.xsl Sun Sep 12 19:23:16 2010 @@ -10,7 +10,9 @@ version="1.0"><xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/callout.xsl"/>
-<xsl:import href="relative-href.xsl"/> + +<!-- Already included in the main style sheet --> +<!-- <xsl:import href="relative-href.xsl"/> --> <xsl:template name="callout-bug"> <xsl:param name="conum" select='1'/> ======================================= --- /trunk/tools/boostbook/xsl/chunk-common.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/chunk-common.xsl Sun Sep 12 19:23:16 2010 @@ -10,10 +10,14 @@ version="1.0"> <!-- Import the HTML chunking stylesheet --> + +<!-- Watch out that we don't override chunk.xsl --> +<!-- <xsl:import- href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/>
- -<xsl:import href="relative-href.xsl"/>+ href="http://docbook.sourceforge.net/release/xsl/current/html/chunk-common.xsl"/> -->
+ +<!-- Already included in the main stylesheet --> +<!-- <xsl:import href="relative-href.xsl"/> --><!-- ==================================================================== -->
@@ -64,6 +68,9 @@ </xsl:variable> <xsl:choose> + <xsl:when test="$navtext = 'xxx'"> + <xsl:value-of select="$direction"/> + </xsl:when> <xsl:when test="$navig.graphics != 0"> <img> <xsl:attribute name="src"> ======================================= --- /trunk/tools/boostbook/xsl/docbook.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/docbook.xsl Sun Sep 12 19:23:16 2010 @@ -98,14 +98,14 @@ <itemizedlist> <xsl:for-each select="concept"> - <listitem> + <listitem><simpara> <xsl:call-template name="internal-link"> <xsl:with-param name="to"> <xsl:call-template name="generate.id"/> </xsl:with-param> <xsl:with-param name="text" select="@name"/> </xsl:call-template> - </listitem> + </simpara></listitem> </xsl:for-each> </itemizedlist> </section> @@ -180,24 +180,6 @@ <xsl:copy-of select="."/> </xsl:template> - <!-- Syntax highlighting --> - <xsl:template name="highlight-keyword"> - <xsl:param name="keyword"/> - <xsl:choose> - <xsl:when test="$boost.syntax.highlight='1'"> - <emphasis role="bold"><xsl:value-of select="$keyword"/></emphasis> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$keyword"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <xsl:template name="highlight-comment"> - <xsl:param name="text"/> - <emphasis><xsl:copy-of select="$text"/></emphasis> - </xsl:template> - <xsl:template name="monospaced"> <xsl:param name="text"/> <computeroutput><xsl:value-of select="$text"/></computeroutput> =======================================--- /trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl Mon May 31 02:25:10 2010 +++ /trunk/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl Sun Sep 12 19:23:16 2010
@@ -204,8 +204,7 @@ <xsl:param name="in-file"/> <xsl:param name="with-namespace-refs"/> - <xsl:if test="contains(string(location/attribute::file), - concat('/', $in-file)) "> + <xsl:if test="string(location/attribute::file)=$in-file"> <!-- The short name of this class --> <xsl:variable name="name-with-spec"> @@ -261,7 +260,9 @@ <xsl:apply-templates select="briefdescription" mode="passthrough"/><xsl:apply-templates select="detaileddescription" mode="passthrough"/> <xsl:apply-templates select="inbodydescription" mode="passthrough"/>
- <xsl:apply-templates/> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> </xsl:element> </xsl:if> </xsl:template> @@ -269,8 +270,7 @@ <xsl:template name="enum"> <xsl:param name="in-file"/> - <xsl:if test="contains(string(location/attribute::file), - concat('/', $in-file))"> + <xsl:if test="string(location/attribute::file)=$in-file"> <xsl:variable name="name"> <xsl:call-template name="strip-qualifiers"> <xsl:with-param name="name" select="name"/> @@ -384,7 +384,7 @@ <xsl:apply-templates mode="toplevel"> <xsl:with-param name="with-namespace-refs" select="innernamespace"/> - <xsl:with-param name="in-file" select="string(compoundname)"/>+ <xsl:with-param name="in-file" select="location/attribute::file"/>
</xsl:apply-templates> </header> </xsl:if> @@ -498,11 +498,15 @@ </xsl:when> <xsl:when test="@kind='function'"> - <xsl:call-template name="function" /> + <xsl:call-template name="function"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> </xsl:when> <xsl:when test="@kind='typedef'"> - <xsl:call-template name="typedef" /> + <xsl:call-template name="typedef"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> </xsl:when> <xsl:when test="@kind='variable'"> @@ -664,6 +668,7 @@ <method-group name="public static functions"> <xsl:apply-templates> <xsl:with-param name="in-section" select="true()"/> + <xsl:with-param name="in-file" select="$in-file"/> </xsl:apply-templates> </method-group> </xsl:when> @@ -672,6 +677,7 @@ <method-group name="protected static functions"> <xsl:apply-templates> <xsl:with-param name="in-section" select="true()"/> + <xsl:with-param name="in-file" select="$in-file"/> </xsl:apply-templates> </method-group> </xsl:when> @@ -680,13 +686,14 @@ <method-group name="private static functions"> <xsl:apply-templates> <xsl:with-param name="in-section" select="true()"/> + <xsl:with-param name="in-file" select="$in-file"/> </xsl:apply-templates> </method-group> </xsl:when> <xsl:when test="@kind='public-func'"> <xsl:variable name="members" select="./memberdef"/> <xsl:variable name="num-internal-only"> - <xsl:value-of + <xsl:value-of select="count($members[contains(detaileddescription/para, 'INTERNAL ONLY')])"/> </xsl:variable> @@ -694,6 +701,7 @@ <method-group name="public member functions"> <xsl:apply-templates> <xsl:with-param name="in-section" select="true()"/> + <xsl:with-param name="in-file" select="$in-file"/> </xsl:apply-templates> </method-group> <xsl:apply-templates/> @@ -703,6 +711,7 @@ <method-group name="protected member functions"> <xsl:apply-templates> <xsl:with-param name="in-section" select="true()"/> + <xsl:with-param name="in-file" select="$in-file"/> </xsl:apply-templates> </method-group> <xsl:apply-templates/> @@ -718,6 +727,7 @@ <method-group name="private member functions"> <xsl:apply-templates> <xsl:with-param name="in-section" select="true()"/> + <xsl:with-param name="in-file" select="$in-file"/> </xsl:apply-templates> </method-group> </xsl:if> @@ -728,15 +738,20 @@ <method-group name="friend functions"> <xsl:apply-templates> <xsl:with-param name="in-section" select="true()"/> + <xsl:with-param name="in-file" select="$in-file"/> </xsl:apply-templates> </method-group> </xsl:if> </xsl:when><xsl:when test="@kind='public-static-attrib' or @kind='public-attrib'">
- <xsl:apply-templates/> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> </xsl:when> <xsl:when test="@kind='public-type'"> - <xsl:apply-templates/> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> </xsl:when> <xsl:when test="@kind='private-type'"> <!--skip private members--> @@ -765,7 +780,9 @@ </xsl:apply-templates> </xsl:when> <xsl:when test="@kind='user-defined'"> - <xsl:apply-templates/> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> </xsl:when> <xsl:when test="@kind=''"> <xsl:apply-templates select="memberdef[generate-id() = @@ -875,8 +892,7 @@ <xsl:template name="typedef"> <xsl:param name="in-file" select="''"/> - <xsl:if test="contains(string(location/attribute::file), - concat('/', $in-file))"> + <xsl:if test="string(location/attribute::file)=$in-file"> <!-- TBD: Handle public/protected/private --> <typedef> <!-- Name of the type --> @@ -1007,8 +1023,7 @@ <xsl:variable name="firstpara" select="normalize-space(detaileddescription/para[1])"/> - <xsl:if test="contains(string(location/attribute::file), - concat('/', $in-file)) + <xsl:if test="string(location/attribute::file)=$in-file andnot($firstpara=normalize-space($boost.doxygen.overload))">
@@ -1182,8 +1197,7 @@ <!-- Handle member variables --> <xsl:template name="variable"> <xsl:param name="in-file"/> - <xsl:if test="contains(string(location/attribute::file), - concat('/', $in-file))"> + <xsl:if test="string(location/attribute::file)=$in-file"> <data-member> <xsl:attribute name="name"> <xsl:value-of select="name/text()"/> ======================================= --- /trunk/tools/boostbook/xsl/fo.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/fo.xsl Sun Sep 12 19:23:16 2010 @@ -129,31 +129,58 @@ --> -<xsl:template match="//programlisting/phrase[@role='keyword']"> +<xsl:template match="//phrase[@role='keyword' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="#0000AA"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='special']"> +<xsl:template match="//phrase[@role='special' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="#707070"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='preprocessor']"> +<xsl:template match="//phrase[@role='preprocessor' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="#402080"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='char']"> +<xsl:template match="//phrase[@role='char' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="teal"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='comment']"> +<xsl:template match="//phrase[@role='comment' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="#800000"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='string']"> +<xsl:template match="//phrase[@role='string' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="teal"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='number']"> +<xsl:template match="//phrase[@role='number' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="teal"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='white_bkd']"> +<xsl:template match="//phrase[@role='white_bkd' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="#FFFFFF"><xsl:apply-templates/></fo:inline> </xsl:template> -<xsl:template match="//programlisting/phrase[@role='dk_grey_bkd']"> +<xsl:template match="//phrase[@role='dk_grey_bkd' and + (ancestor::programlisting or + ancestor::synopsis or + ancestor::literallayout)]"> <fo:inline color="#999999"><xsl:apply-templates/></fo:inline> </xsl:template> ======================================= --- /trunk/tools/boostbook/xsl/function.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/function.xsl Sun Sep 12 19:23:16 2010 @@ -161,7 +161,7 @@ <!-- Build the text that follows the declarator--> <xsl:variable name="postdeclarator"> - <xsl:if test="@cv"> + <xsl:if test="@cv and @cv != ''"> <xsl:text> </xsl:text> <xsl:value-of select="@cv"/> </xsl:if> @@ -246,7 +246,9 @@ <xsl:with-param name="highlight" select="true()"/> </xsl:call-template> - <xsl:text>(</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'('"/> + </xsl:call-template> <xsl:call-template name="function-parameters"> <xsl:with-param name="include-names" select="$include-names"/> <xsl:with-param name="indentation" @@ -254,12 +256,16 @@ + string-length($function-name) + 1"/> <xsl:with-param name="final" select="true()"/> </xsl:call-template> - <xsl:text>)</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="')'"/> + </xsl:call-template> <xsl:call-template name="source-highlight"> <xsl:with-param name="text" select="$postdeclarator"/> </xsl:call-template> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:when> <!-- This declaration will take multiple lines --> @@ -317,7 +323,9 @@ <xsl:with-param name="link-type" select="$link-type"/> <xsl:with-param name="highlight" select="true()"/> </xsl:call-template> - <xsl:text>(</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'('"/> + </xsl:call-template> <xsl:call-template name="function-parameters"> <xsl:with-param name="include-names" select="$include-names"/> <xsl:with-param name="indentation" @@ -325,11 +333,15 @@ + string-length($function-name) + 1"/> <xsl:with-param name="final" select="true()"/> </xsl:call-template> - <xsl:text>)</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="')'"/> + </xsl:call-template> <xsl:call-template name="source-highlight"> <xsl:with-param name="text" select="$postdeclarator"/> </xsl:call-template> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -364,7 +376,18 @@ <!-- Information for this parameter --> <xsl:variable name="parameter" select="$parameters[position()=1]"/> <xsl:variable name="pack"> - <xsl:if test="$parameter/@pack=1"><xsl:text>...</xsl:text></xsl:if> + <xsl:if test="$parameter/@pack=1"> + <xsl:choose> + <xsl:when test="$final"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'...'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>...</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> </xsl:variable> <xsl:variable name="name"> <xsl:if test="$include-names and $parameter/@name != ''"> @@ -377,18 +400,32 @@ <xsl:variable name="default"> <xsl:choose> <xsl:when test="$parameter/@default"> - <xsl:text> = </xsl:text> - <xsl:value-of select="$parameter/@default"/> + <xsl:choose> + <xsl:when test="$final"> + <xsl:call-template name="highlight-text">+ <xsl:with-param name="text" select="concat(' = ', $parameter/@default)"/>
+ </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text> = </xsl:text> + <xsl:value-of select="$parameter/@default"/> + </xsl:otherwise> + </xsl:choose> </xsl:when> <xsl:when test="$parameter/default"> - <xsl:text> = </xsl:text> <xsl:choose> <xsl:when test="$final"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' = '"/> + </xsl:call-template> <xsl:apply-templates select="$parameter/default/*|$parameter/default/text()" - mode="annotation"/> + mode="annotation"> + <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> </xsl:when> <xsl:otherwise> + <xsl:text> = </xsl:text> <xsl:value-of select="string($parameter/default)"/> </xsl:otherwise> </xsl:choose> @@ -407,13 +444,15 @@ or not($wrap)"> <xsl:choose> <xsl:when test="$final"> - <xsl:value-of select="$prefix"/> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="$prefix"/> + </xsl:call-template> <xsl:apply-templates select="$parameter/paramtype/*|$parameter/paramtype/text()" mode="annotation"> <xsl:with-param name="highlight" select="true()"/> </xsl:apply-templates> - <xsl:value-of select="$pack"/> + <xsl:copy-of select="$pack"/> <xsl:value-of select="$name"/> <xsl:copy-of select="$default"/> </xsl:when> @@ -437,7 +476,17 @@ <!-- Parameter goes on next line --> <xsl:otherwise> <!-- The comma goes on this line --> - <xsl:value-of select="$prefix"/><xsl:text> </xsl:text> + <xsl:choose> + <xsl:when test="$final"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="$prefix"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$prefix"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> <!-- Indent and print the parameter --> <xsl:call-template name="indent"> @@ -450,9 +499,9 @@ mode="annotation"> <xsl:with-param name="highlight" select="true()"/> </xsl:apply-templates> - <xsl:value-of select="$pack"/> + <xsl:copy-of select="$pack"/> <xsl:value-of select="$name"/> - <xsl:value-of select="$default"/> + <xsl:copy-of select="$default"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat($prefix, $text)"/> @@ -605,16 +654,18 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$indentation"/> </xsl:call-template> - <emphasis> - <xsl:text>// </xsl:text> - <xsl:call-template name="internal-link"> - <xsl:with-param name="to"> - <xsl:call-template name="generate.id"/> - <xsl:text>construct-copy-destruct</xsl:text> - </xsl:with-param> - <xsl:with-param name="text" select="'construct/copy/destruct'"/> - </xsl:call-template> - </emphasis> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + <xsl:text>construct-copy-destruct</xsl:text> + </xsl:with-param>+ <xsl:with-param name="text" select="'construct/copy/destruct'"/>
+ </xsl:call-template> + </xsl:with-param> + </xsl:call-template> <xsl:apply-templates select="constructor" mode="synopsis"> <xsl:with-param name="indentation" select="$indentation"/> </xsl:apply-templates> @@ -1034,15 +1085,17 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$indentation"/> </xsl:call-template> - <emphasis> - <xsl:text>// </xsl:text> - <xsl:call-template name="internal-link"> - <xsl:with-param name="to"> - <xsl:call-template name="generate.id"/> - </xsl:with-param> - <xsl:with-param name="text" select="string(@name)"/> - </xsl:call-template> - </emphasis> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="text" select="string(@name)"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> <xsl:apply-templates select="method|overloaded-method" mode="synopsis"> <xsl:with-param name="indentation" select="$indentation"/> @@ -1088,15 +1141,17 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$indentation"/> </xsl:call-template> - <emphasis> - <xsl:text>// </xsl:text> - <xsl:call-template name="internal-link"> - <xsl:with-param name="to"> - <xsl:call-template name="generate.id"/> - </xsl:with-param> - <xsl:with-param name="text" select="string(@name)"/> - </xsl:call-template> - </emphasis> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="text" select="string(@name)"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template><xsl:apply-templates select="function|overloaded-function" mode="synopsis">
<xsl:with-param name="indentation" select="$indentation"/> </xsl:apply-templates> ======================================= --- /trunk/tools/boostbook/xsl/global.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/global.xsl Sun Sep 12 19:23:16 2010 @@ -57,7 +57,9 @@ </xsl:call-template> <xsl:text> </xsl:text> </xsl:if> - <xsl:apply-templates select="type/*|type/text()" mode="annotation" /> + <xsl:apply-templates select="type/*|type/text()" mode="annotation"> + <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> <xsl:text> </xsl:text> <xsl:call-template name="link-or-anchor"> <xsl:with-param name="to"> @@ -66,7 +68,9 @@ <xsl:with-param name="text" select="@name" /> <xsl:with-param name="link-type" select="$link-type" /> </xsl:call-template> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:template> <xsl:template match="data-member" mode="generate.id"> <xsl:call-template name="fully-qualified-id"> ======================================= --- /trunk/tools/boostbook/xsl/html-single.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/html-single.xsl Sun Sep 12 19:23:16 2010 @@ -14,6 +14,7 @@ <xsl:importhref="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
<xsl:import href="admon.xsl"/> + <xsl:import href="relative-href.xsl"/> <xsl:param name="admon.style"/> <xsl:param name="admon.graphics">1</xsl:param> ======================================= --- /trunk/tools/boostbook/xsl/html.xsl Mon May 31 02:25:10 2010 +++ /trunk/tools/boostbook/xsl/html.xsl Sun Sep 12 19:23:16 2010 @@ -16,308 +16,22 @@ <xsl:importhref="http://docbook.sourceforge.net/release/xsl/current/html/math.xsl"/>
- <xsl:import href="chunk-common.xsl"/> - <xsl:import href="docbook-layout.xsl"/> - <xsl:import href="navbar.xsl"/> - <xsl:import href="admon.xsl"/> - <xsl:import href="xref.xsl"/> - <xsl:import href="relative-href.xsl"/> - <xsl:import href="callout.xsl"/> - - <xsl:param name="html.stylesheet"> - <xsl:choose> - <xsl:when test = "$boost.defaults = 'Boost'">- <xsl:value-of select = "concat($boost.root, '/doc/src/boostbook.css')"/>
- </xsl:when> - <xsl:otherwise> - boostbook.css - </xsl:otherwise> - </xsl:choose> - </xsl:param> - - <xsl:param name="admon.style"/> - <xsl:param name="admon.graphics">1</xsl:param> - <xsl:param name="boostbook.verbose" select="0"/> - <xsl:param name="navig.graphics" select="1"/> - <xsl:param name="navig.graphics.extension" select="'.png'"/> - <xsl:param name="chapter.autolabel" select="1"/> - <xsl:param name="use.id.as.filename" select="1"/> - <xsl:param name="refentry.generate.name" select="0"/> - <xsl:param name="refentry.generate.title" select="1"/> - <xsl:param name="make.year.ranges" select="1"/> - <xsl:param name="generate.manifest" select="1"/> - <xsl:param name="generate.section.toc.level" select="3"/> - <xsl:param name="doc.standalone">false</xsl:param> - <xsl:param name="chunker.output.indent">yes</xsl:param> - <xsl:param name="chunker.output.encoding">US-ASCII</xsl:param>- <xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
- <xsl:param name="toc.max.depth">2</xsl:param> - <xsl:param name="callout.graphics.number.limit">15</xsl:param> - <xsl:param name = "admon.graphics.path" - select = "concat($boost.root, '/doc/html/images/')"/> - <xsl:param name = "navig.graphics.path" - select = "concat($boost.root, '/doc/html/images/')"/> - <xsl:param name = "callout.graphics.path" - select = "concat($boost.root, '/doc/src/images/callouts/')"/> - - - <xsl:param name="admon.style"> - <!-- Remove the style. Let the CSS do the styling --> -</xsl:param> - -<!-- Always have graphics --> -<xsl:param name="admon.graphics" select="1"/> - - <xsl:param name="generate.toc"> -appendix toc,title -article/appendix nop -article toc,title -book toc,title -chapter toc,title -part toc,title -preface toc,title -qandadiv toc -qandaset toc -reference toc,title -sect1 toc -sect2 toc -sect3 toc -sect4 toc -sect5 toc -section toc -set toc,title - </xsl:param> - - - <xsl:template name="format.cvs.revision"> - <xsl:param name="text"/> - - <!-- Remove the "$Date: " --> - <xsl:variable name="text.noprefix" - select="substring-after($text, '$Date: ')"/> - - <!-- Grab the year -->- <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
- <xsl:variable name="text.noyear" - select="substring-after($text.noprefix, '/')"/> - - <!-- Grab the month -->- <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
- <xsl:variable name="text.nomonth" - select="substring-after($text.noyear, '/')"/> - - <!-- Grab the year -->- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday" - select="substring-after($text.nomonth, ' ')"/> - - <!-- Get the time --> - <xsl:variable name="time" select="substring-before($text.noday, ' ')"/> - - <xsl:variable name="month.name"> - <xsl:choose> - <xsl:when test="$month=1">January</xsl:when> - <xsl:when test="$month=2">February</xsl:when> - <xsl:when test="$month=3">March</xsl:when> - <xsl:when test="$month=4">April</xsl:when> - <xsl:when test="$month=5">May</xsl:when> - <xsl:when test="$month=6">June</xsl:when> - <xsl:when test="$month=7">July</xsl:when> - <xsl:when test="$month=8">August</xsl:when> - <xsl:when test="$month=9">September</xsl:when> - <xsl:when test="$month=10">October</xsl:when> - <xsl:when test="$month=11">November</xsl:when> - <xsl:when test="$month=12">December</xsl:when> - </xsl:choose> - </xsl:variable> -- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' GMT')"/> - </xsl:template> - - - <xsl:template name="format.svn.revision"> - <xsl:param name="text"/> - - <!-- Remove the "$Date: " --> - <xsl:variable name="text.noprefix" - select="substring-after($text, '$Date: ')"/> - - <!-- Grab the year -->- <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
- <xsl:variable name="text.noyear" - select="substring-after($text.noprefix, '-')"/> - - <!-- Grab the month -->- <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
- <xsl:variable name="text.nomonth" - select="substring-after($text.noyear, '-')"/> - - <!-- Grab the year -->- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday" - select="substring-after($text.nomonth, ' ')"/> - - <!-- Get the time --> - <xsl:variable name="time" select="substring-before($text.noday, ' ')"/> - <xsl:variable name="text.notime" - select="substring-after($text.noday, ' ')"/> - - <!-- Get the timezone -->- <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
- - <xsl:variable name="month.name"> - <xsl:choose> - <xsl:when test="$month=1">January</xsl:when> - <xsl:when test="$month=2">February</xsl:when> - <xsl:when test="$month=3">March</xsl:when> - <xsl:when test="$month=4">April</xsl:when> - <xsl:when test="$month=5">May</xsl:when> - <xsl:when test="$month=6">June</xsl:when> - <xsl:when test="$month=7">July</xsl:when> - <xsl:when test="$month=8">August</xsl:when> - <xsl:when test="$month=9">September</xsl:when> - <xsl:when test="$month=10">October</xsl:when> - <xsl:when test="$month=11">November</xsl:when> - <xsl:when test="$month=12">December</xsl:when> - </xsl:choose> - </xsl:variable> -- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' ', $timezone)"/> - </xsl:template> - - <!-- Footer Copyright --> - <xsl:template match="copyright" mode="boost.footer"> - <xsl:if test="position() > 1"> - <br/> - </xsl:if> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Copyright'"/> - </xsl:call-template> - <xsl:call-template name="gentext.space"/> - <xsl:call-template name="dingbat"> - <xsl:with-param name="dingbat">copyright</xsl:with-param> - </xsl:call-template> - <xsl:call-template name="gentext.space"/> - <xsl:call-template name="copyright.years"> - <xsl:with-param name="years" select="year"/> - <xsl:with-param name="print.ranges" select="$make.year.ranges"/> - <xsl:with-param name="single.year.ranges" - select="$make.single.year.ranges"/> - </xsl:call-template> - <xsl:call-template name="gentext.space"/> - <xsl:apply-templates select="holder" mode="titlepage.mode"/> - </xsl:template> - - <!-- Footer License --> - <xsl:template match="legalnotice" mode="boost.footer"> - <xsl:apply-templates select="para" mode="titlepage.mode" /> - </xsl:template> - - <xsl:template name="user.footer.content"> - <table width="100%"> - <tr> - <td align="left"> - <xsl:variable name="revision-nodes" - select="ancestor-or-self::* - [not (attribute::rev:last-revision='')]"/> - <xsl:if test="count($revision-nodes) > 0"> - <xsl:variable name="revision-node" - select="$revision-nodes[last()]"/> - <xsl:variable name="revision-text"> - <xsl:value-of- select="normalize-space($revision-node/attribute::rev:last-revision)"/>
- </xsl:variable> - <xsl:if test="string-length($revision-text) > 0"> - <p> - <small> - <xsl:text>Last revised: </xsl:text> - <xsl:choose> - <xsl:when test="contains($revision-text, '/')"> - <xsl:call-template name="format.cvs.revision">- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="format.svn.revision">- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </small> - </p> - </xsl:if> - </xsl:if> - </td> - <td align="right"> - <div class = "copyright-footer"> - <xsl:apply-templates select="ancestor::*/*/copyright" - mode="boost.footer"/> - <xsl:apply-templates select="ancestor::*/*/legalnotice" - mode="boost.footer"/> - </div> - </td> - </tr> - </table> - </xsl:template> - - <!-- We don't want refentry's to show up in the TOC because they - will merely be redundant with the synopsis. --> - <xsl:template match="refentry" mode="toc"/> - - <!-- override the behaviour of some DocBook elements for better - rendering facilities --> - - <xsl:template match = "programlisting[ancestor::informaltable]"> - <pre class = "table-{name(.)}"><xsl:apply-templates/></pre> - </xsl:template> - - <xsl:template match = "refsynopsisdiv"> - <h2 class = "{name(.)}-title">Synopsis</h2> - <div class = "{name(.)}"> - <xsl:apply-templates/> - </div> - </xsl:template> - -<!-- ============================================================ --> - -<xsl:template name="output.html.stylesheets"> - <xsl:param name="stylesheets" select="''"/> - - <xsl:choose> - <xsl:when test="contains($stylesheets, ' ')"> - <link rel="stylesheet"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target.relative">- <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
- </xsl:call-template> - </xsl:attribute> - <xsl:if test="$html.stylesheet.type != ''"> - <xsl:attribute name="type"> - <xsl:value-of select="$html.stylesheet.type"/> - </xsl:attribute> - </xsl:if> - </link> - <xsl:call-template name="output.html.stylesheets">- <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
- </xsl:call-template> - </xsl:when> - <xsl:when test="$stylesheets != ''"> - <link rel="stylesheet"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target.relative">- <xsl:with-param name="target" select="$stylesheets"/>
- </xsl:call-template> - </xsl:attribute> - <xsl:if test="$html.stylesheet.type != ''"> - <xsl:attribute name="type"> - <xsl:value-of select="$html.stylesheet.type"/> - </xsl:attribute> - </xsl:if> - </link> - </xsl:when> - </xsl:choose> -</xsl:template> + <!-- Bring in the fast chunking overrides. There's nothing + that we need to override, so include instead of importing it. --> + <xsl:include+ href="http://docbook.sourceforge.net/release/xsl/current/html/chunkfast.xsl"/>
+ + <!-- We have to make sure that our templates override all + docbook templates. Therefore, we include our own templates + instead of importing them. In order for this to work, + the stylesheets included here cannot also include each other --> + <xsl:include href="chunk-common.xsl"/> + <xsl:include href="docbook-layout.xsl"/> + <xsl:include href="navbar.xsl"/> + <xsl:include href="admon.xsl"/> + <xsl:include href="xref.xsl"/> + <xsl:include href="relative-href.xsl"/> + <xsl:include href="callout.xsl"/> + <xsl:include href="html-base.xsl"/> </xsl:stylesheet> ======================================= --- /trunk/tools/boostbook/xsl/lookup.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/lookup.xsl Sun Sep 12 19:23:16 2010 @@ -7,6 +7,7 @@ http://www.boost.org/LICENSE_1_0.txt) --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; + xmlns:exsl="http://exslt.org/common"; version="1.0"> <!-- Maximum length of directory and file names is 31 characters. @@ -154,40 +155,65 @@ <xsl:template name="build-fully-qualified-name"> <xsl:param name="is.id" select="false()" /> - <!-- The depth of qualified name element that we will print now--> - <xsl:param name="depth" select="1"/> - <!-- Determine the set of ancestor namespaces --> <xsl:variable name="ancestors" select="ancestor::namespace| ancestor::class|ancestor::struct|ancestor::union|ancestor::class-specialization| ancestor::struct-specialization|ancestor::union-specialization"/>
+ <xsl:for-each select="$ancestors"> + <xsl:apply-templates select="." mode="fast-print-id-part"> + <xsl:with-param name="is.id" select="$is.id"/> + </xsl:apply-templates> + <xsl:choose> + <xsl:when test="$is.id"><xsl:text>.</xsl:text></xsl:when> + <xsl:otherwise><xsl:text>::</xsl:text></xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <xsl:apply-templates select="." mode="fast-print-id-part"> + <xsl:with-param name="is.id" select="$is.id"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:variable name="elements-with-ids">+ <xsl:apply-templates select="namespace|class|struct|union| class-specialization|struct-specialization|union-specialization"
+ mode="preprocess-ids"/> + </xsl:variable> ++ <xsl:variable name="fast-elements" select="exsl:node-set($elements-with-ids)"/>
+ + <xsl:template match="*" mode="preprocess-ids"> + <element> + <xsl:attribute name="id"> + <xsl:value-of select="generate-id()"/> + </xsl:attribute> + <xsl:attribute name="part-id"> + <xsl:call-template name="print-id-part"/> + </xsl:attribute> + </element> + </xsl:template> + + <xsl:template name="print-id-part"> + <xsl:apply-templates select="." mode="print-id-part"/> + </xsl:template> + + <xsl:template match="*" mode="fast-print-id-part"> + <xsl:param name="is.id"/> <xsl:choose> - <xsl:when test="$depth > count($ancestors)"> - <xsl:apply-templates select="." mode="print-id-part"> - <xsl:with-param name="is.id" select="$is.id"/> - </xsl:apply-templates> + <xsl:when test="not($is.id)"> + <xsl:apply-templates select="." mode="print-name"/> + </xsl:when> + <xsl:when test="$fast-elements[@id=generate-id()]"> + <xsl:value-of select="$fast-elements[@id=generate-id()]/@part-id"/> </xsl:when> <xsl:otherwise> - <xsl:if test="name($ancestors[$depth])='namespace' or - count(ancestor::free-function-group)=0">- <xsl:apply-templates select="$ancestors[$depth]" mode="print-id-part">
- <xsl:with-param name="is.id" select="$is.id"/> - </xsl:apply-templates> - <xsl:choose> - <xsl:when test="$is.id"><xsl:text>.</xsl:text></xsl:when> - <xsl:otherwise><xsl:text>::</xsl:text></xsl:otherwise> - </xsl:choose> - </xsl:if> - <xsl:call-template name="build-fully-qualified-name"> + <xsl:apply-templates select="." mode="print-id-part"> <xsl:with-param name="is.id" select="$is.id"/> - <xsl:with-param name="depth" select="$depth + 1"/> - </xsl:call-template> + </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> - + <!-- Print the part of a fully qualified name for a single element --> <xsl:template match="*" mode="print-id-part"> <xsl:param name="is.id"/> @@ -252,167 +278,81 @@<xsl:apply-templates select="specialization/template-arg" mode="print-name"/>
<xsl:text>></xsl:text> </xsl:template> - - <xsl:template name="name-matches-node"> + + <xsl:template name="concat-directives"> + <xsl:param name="directives"/> + <xsl:for-each select="$directives"> + <xsl:apply-templates select="." mode="print-name"/> + <xsl:text>::</xsl:text> + </xsl:for-each> + </xsl:template> + + <xsl:template name="find-nodes-matching-name"> <!-- The name we are looking for --> <xsl:param name="name"/> - <!-- The name to display --> - <xsl:param name="display-name" select="$name"/> - <!-- The context in which this name occurs --> <xsl:param name="context"/> <!-- The node that we are checking against --> - <xsl:param name="node"/> - - <!-- The mode we are in. Can be one of: - matches: emits the matches as they are found (for debugging) - link: link to the node that was found - --> - <xsl:param name="mode" select="'matches'"/> -- <!-- The index into the list of using directives for the context node -->
- <xsl:param name="index" select="1"/> -- <!-- The prefix we should append to the name when checking this node -->
- <xsl:param name="prefix" select="''"/> - - <xsl:choose> - <xsl:when test="count($node) > 1"> - <xsl:variable name="matches"> - <xsl:call-template name="count-matches"> - <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="context" select="$context"/> - <xsl:with-param name="nodes" select="$node[position() = 1]"/> - </xsl:call-template> - </xsl:variable> - - <xsl:choose> - <xsl:when test="$matches = 0"> - <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="display-name" select="$display-name"/> - <xsl:with-param name="context" select="$context"/>- <xsl:with-param name="node" select="$node[position() > 1]"/>
- <xsl:with-param name="mode" select="$mode"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="display-name" select="$display-name"/> - <xsl:with-param name="context" select="$context"/> - <xsl:with-param name="node" select="$node[position() = 1]"/> - <xsl:with-param name="mode" select="$mode"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsl:when> - <xsl:when test="count($node) = 1">- <!-- The fully-qualified name of the node we are checking against -->
- <xsl:variable name="fully-qualified-name"> - <xsl:call-template name="fully-qualified-name"> - <xsl:with-param name="node" select="$node"/> - </xsl:call-template> - </xsl:variable> - - <!-- The set of using directives for this context node --> - <xsl:variable name="directives" - select="$context/ancestor::*/using-namespace | + <xsl:param name="nodes"/> + + <!-- The set of using directives for this context node --> + <xsl:variable name="directives" + select="$context/ancestor::*/using-namespace | $context/ancestor::namespace | $context/ancestor::*/using-class | $context/ancestor::class | $context/ancestor::struct"/> - <!-- The name of the current directive --> - <xsl:variable name="this-context">- <xsl:apply-templates select="$directives[$index]" mode="print-name"/>
- </xsl:variable> - - <!-- Check if we have a match --> - <xsl:variable name="have-match" - select="$fully-qualified-name = concat($prefix, $name)"/> - - <xsl:if test="$have-match"> - <xsl:choose> - <xsl:when test="$mode='matches'"> - Match in namespace ::<xsl:value-of select="$prefix"/> - </xsl:when> - <xsl:when test="$mode='link'"> - <xsl:call-template name="internal-link"> - <xsl:with-param name="to"> - <xsl:call-template name="generate.id"> - <xsl:with-param name="node" select="$node"/> - </xsl:call-template> - </xsl:with-param> - <xsl:with-param name="text" select="$display-name"/> - </xsl:call-template> - </xsl:when> - </xsl:choose> - </xsl:if> - - <xsl:if test="(not($index > count($directives))) and - (not($have-match) or ($mode = 'matches'))"> - <xsl:variable name="first-branch"> - <xsl:if test="not ($prefix = '')">- <!-- Recurse and append the current context node to the prefix -->
- <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/>- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$context"/> - <xsl:with-param name="node" select="$node"/> - <xsl:with-param name="mode" select="$mode"/> - <xsl:with-param name="index" select="$index + 1"/> - <xsl:with-param name="prefix" - select="concat($prefix, $this-context, '::')"/> - </xsl:call-template> - </xsl:if> - </xsl:variable> - - <xsl:choose> - <xsl:when test="string($first-branch) != ''"> - <xsl:copy-of select="$first-branch"/> - </xsl:when> - <xsl:otherwise> - <!-- Recurse with just the current context node --> - <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/>- <xsl:with-param name="display-name" select="$display-name"/>
- <xsl:with-param name="context" select="$context"/> - <xsl:with-param name="node" select="$node"/> - <xsl:with-param name="mode" select="$mode"/> - <xsl:with-param name="index" select="$index + 1"/> - <xsl:with-param name="prefix" - select="concat($this-context, '::')"/> - </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </xsl:if> - </xsl:when> - </xsl:choose> + <xsl:variable name="directives-str"> + <xsl:call-template name="concat-directives"> + <xsl:with-param name="directives" select="$directives"/> + </xsl:call-template> + </xsl:variable> + + <xsl:apply-templates select="$nodes" mode="generate-cxx-links"> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="directives-str" select="$directives-str"/> + </xsl:apply-templates> </xsl:template> - - <!-- Count the number of nodes in the set that match the given name and - lookup context --> - <xsl:template name="count-matches"> + + <xsl:template match="*" mode="generate-cxx-links"> <xsl:param name="name"/> - <xsl:param name="context"/> - <xsl:param name="nodes"/> - - <xsl:variable name="match-string"> - <xsl:for-each select="$nodes"> - <xsl:variable name="does-match"> - <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="context" select="$context"/> + <xsl:param name="directives-str"/> + + <xsl:variable name="node-name"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="leading-chars"+ select="string-length($node-name) - string-length($name)"/>
+ + <!-- Check if this node matches any visible namespace --> + <xsl:if test="string-length($node-name) >= string-length($name) and + substring($node-name, $leading-chars + 1, + string-length($name)) = $name"> + <xsl:variable name="qualifiers" + select="substring($node-name, 1, $leading-chars)"/> + <xsl:if test="contains($directives-str, $qualifiers)"> + <xsl:variable name="myid"> + <xsl:call-template name="generate.id"> <xsl:with-param name="node" select="."/> </xsl:call-template> </xsl:variable> - <xsl:if test="not($does-match='')">X</xsl:if> - </xsl:for-each> - </xsl:variable> - <xsl:value-of select="string-length($match-string)"/> + <cxx-link-helper> + <xsl:attribute name="id"> + <xsl:value-of select="$myid"/> + </xsl:attribute> + <xsl:attribute name="namespace"> + <xsl:value-of select="$qualifiers"/> + </xsl:attribute> + <xsl:text>random text</xsl:text> + </cxx-link-helper> + </xsl:if> + </xsl:if> </xsl:template> <xsl:template name="cxx-link-name"> @@ -433,18 +373,20 @@<!-- The list of nodes that match the lookup node in both name and type -->
<xsl:param name="nodes"/> - - <!-- Count the number of nodes that match --> - <xsl:variable name="matches"> - <xsl:call-template name="count-matches"> + + <!-- Filter the nodes to leave only the ones that are in scope. --> + <xsl:variable name="matches1"> + <xsl:call-template name="find-nodes-matching-name"> <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="context" select="$lookup"/> <xsl:with-param name="nodes" select="$nodes"/> + <xsl:with-param name="context" select="$lookup"/> </xsl:call-template> </xsl:variable> ++ <xsl:variable name="matches" select="exsl:node-set($matches1)//cxx-link-helper"/>
<xsl:choose> - <xsl:when test="$matches = 0"> + <xsl:when test="count($matches) = 0"> <xsl:message> <xsl:text>Cannot find </xsl:text> <xsl:value-of select="$type"/> @@ -454,39 +396,27 @@ </xsl:message> <xsl:value-of select="$display-name"/> </xsl:when> - <xsl:when test="$matches = 1"> - <xsl:for-each select="$nodes"> - <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="display-name" select="$display-name"/> - <xsl:with-param name="context" select="$lookup"/> - <xsl:with-param name="node" select="."/> - <xsl:with-param name="mode" select="'link'"/> - </xsl:call-template> - </xsl:for-each> - </xsl:when> <xsl:otherwise> - <xsl:message> - <xsl:text>Reference to </xsl:text> - <xsl:value-of select="$type"/> - <xsl:text> '</xsl:text> - <xsl:value-of select="$name"/> - <xsl:text>' is ambiguous. Found:</xsl:text> - <xsl:for-each select="$nodes"> - <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="context" select="$lookup"/> - <xsl:with-param name="node" select="."/> - <xsl:with-param name="mode" select="'matches'"/> - </xsl:call-template> - </xsl:for-each> - </xsl:message> - <xsl:call-template name="name-matches-node"> - <xsl:with-param name="name" select="$name"/> - <xsl:with-param name="display-name" select="$display-name"/> - <xsl:with-param name="context" select="$lookup"/> - <xsl:with-param name="node" select="$nodes"/> - <xsl:with-param name="mode" select="'link'"/>+ <!-- If we found more than one, print a message and take the first -->
+ <xsl:if test="count($matches) > 1"> + <xsl:message> + <xsl:text>Reference to </xsl:text> + <xsl:value-of select="$type"/> + <xsl:text> '</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>' is ambiguous. Found:</xsl:text> + <xsl:for-each select="$matches"> + <xsl:text> + Match in namespace ::</xsl:text> + <xsl:value-of select="@namespace"/> + </xsl:for-each> + </xsl:message> + </xsl:if> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:value-of select="$matches[position() = 1]/@id"/> + </xsl:with-param> + <xsl:with-param name="text" select="$display-name"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> ======================================= --- /trunk/tools/boostbook/xsl/navbar.xsl Mon May 31 02:25:10 2010 +++ /trunk/tools/boostbook/xsl/navbar.xsl Sun Sep 12 19:23:16 2010 @@ -9,8 +9,9 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"> -<xsl:import href="relative-href.xsl"/> - +<!-- Already included in the main style sheet --> +<!-- <xsl:import href="relative-href.xsl"/> --> + <!-- boost.defaults: *custom - only use explicitly set parameters @@ -369,7 +370,7 @@ </xsl:call-template> </a></xsl:if> <!-- home --> - <xsl:if test = "$home != . or $nav.context = 'toc'">+ <xsl:if test = "generate-id($home) != generate-id(.) or $nav.context = 'toc'">
<a accesskey = "h"><xsl:attribute name = "href"><xsl:call-template name = "href.target">
<xsl:with-param name = "object" select = "$home"/> ======================================= --- /trunk/tools/boostbook/xsl/reference.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/reference.xsl Sun Sep 12 19:23:16 2010 @@ -29,9 +29,8 @@ <xsl:with-param name="indentation" select="$indentation"/> </xsl:call-template> <xsl:call-template name="source-highlight"> - <xsl:with-param name="text" select="concat('namespace ',@name)"/>+ <xsl:with-param name="text" select="concat('namespace ',@name, ' {')"/>
</xsl:call-template> - <xsl:text> {</xsl:text> <!-- Emit namespace types --> <xsl:apply-templates select="class|class-specialization| @@ -58,7 +57,9 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$indentation"/> </xsl:call-template> - <xsl:text>}</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'}'"/> + </xsl:call-template> </xsl:template> <!-- Emit namespace synopsis --> @@ -97,9 +98,71 @@ <xsl:template match="para|section" mode="synopsis"/> <xsl:template match="para|section" mode="reference"/> + <xsl:template name="find-wrap-point"> + <xsl:param name="text"/> + <xsl:param name="prefix"/> + <xsl:param name="result" select="0"/>+ <xsl:param name="default" select="$max-columns - string-length($prefix)"/>
+ <xsl:variable name="s" select="substring($text, 2)"/> + <xsl:variable name="candidate"> + <xsl:choose> + <xsl:when test="contains($s, ' ')">+ <xsl:value-of select="string-length(substring-before($s, ' ')) + 1"/>
+ </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($text)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose>+ <xsl:when test="string-length($prefix) + $result + $candidate <= $max-columns">
+ <xsl:call-template name="find-wrap-point">+ <xsl:with-param name="text" select="substring($text, $candidate + 1)"/>
+ <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="result" select="$result + $candidate"/> + <xsl:with-param name="default" select="$result + $candidate"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$default"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="wrap-comment"> + <xsl:param name="prefix"/> + <xsl:param name="text"/> + <xsl:choose>+ <xsl:when test="string-length($prefix) + string-length($text) <= $max-columns">
+ <xsl:value-of select="$text"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="size"> + <xsl:call-template name="find-wrap-point"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:variable> + <xsl:value-of select="substring($text, 1, $size)"/> + <xsl:text> </xsl:text> + <xsl:value-of select="$prefix"/> + <xsl:call-template name="wrap-comment"> + <xsl:with-param name="prefix" select="$prefix"/>+ <xsl:with-param name="text" select="normalize-space(substring($text, $size + 1))"/>
+ </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- Comment mode tries to wipe out any extra spacing in the output --> <xsl:template match="purpose" mode="comment"> - <xsl:apply-templates mode="comment"/> + <xsl:param name="wrap" select="false()"/> + <xsl:param name="prefix"/> + <xsl:apply-templates mode="comment"> + <xsl:with-param name="wrap"+ select="$wrap and count(*) = 0 and count(text()) = 1"/>
+ <xsl:with-param name="prefix" select="$prefix"/> + </xsl:apply-templates> </xsl:template> <xsl:template match="simpara|para" mode="comment"> @@ -107,7 +170,20 @@ </xsl:template> <xsl:template match="text()" mode="comment"> - <xsl:value-of select="."/> + <xsl:param name="wrap" select="false()"/> + <xsl:param name="prefix"/> + <xsl:variable name="stripped" select="normalize-space(.)"/> + <xsl:choose> + <xsl:when test="$wrap"> + <xsl:call-template name="wrap-comment"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="text" select="$stripped"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="."/> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="*" mode="comment"> ======================================= --- /trunk/tools/boostbook/xsl/source-highlight.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/source-highlight.xsl Sun Sep 12 19:23:16 2010 @@ -24,110 +24,405 @@ </xsl:choose> </xsl:template> - <!-- Perform C++ keyword highlighting on the given text --> - <xsl:template name="highlight-text"> - <xsl:param name="text" select="."/> - <xsl:param name="keywords"- select="'asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while'"/>
- <xsl:param name="best-match" select="''"/> - - <!-- Determine the current keyword --> - <xsl:variable name="keyword"> - <xsl:choose> - <xsl:when test="contains($keywords, ' ')"> - <xsl:value-of select="substring-before($keywords, ' ')"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$keywords"/> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - - <!-- Determine the set of keywords that are left --> - <xsl:variable name="keywords-left"> - <xsl:if test="contains($keywords, ' ')"> - <xsl:value-of select="substring-after($keywords, ' ')"/> - </xsl:if> - </xsl:variable> - - <!-- The set of characters that can be identifiers -->- <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'"/>
-- <xsl:variable name="X" select="'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'"/>
-+ <xsl:variable name="id-start-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_'"/> + <xsl:variable name="id-chars" select="'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_'"/>
+ <xsl:variable name="digits" select="'1234567890'"/> + <xsl:variable name="number-chars" select="'1234567890abcdefABCDEFxX.'"/> + <xsl:variable name="keywords"+ select="' asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while '"/>
+ <xsl:variable name="operators4" select="'%:%:'"/>+ <xsl:variable name="operators3" select="'>>= <<= ->* ...'"/> + <xsl:variable name="operators2" select="'.* :: ## <: :> <% %> %: += -= *= /= %= ^= &= |= << >> == != <= >= && || ++ -- ->'"/> + <xsl:variable name="operators1" select="'. ? { } [ ] # ( ) ; : + - * / % ^ & | ~ ! = < > ,'"/>
+ <xsl:variable name="single-quote">'</xsl:variable> + + <!-- Syntax highlighting --> + <xsl:template name="highlight-keyword"> + <xsl:param name="keyword"/> + <xsl:choose> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="keyword"> + <xsl:value-of select="$keyword"/> + </phrase> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$keyword"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-identifier"> + <xsl:param name="identifier"/> + <xsl:choose> + <xsl:when test="contains($keywords, concat(' ', $identifier, ' '))"> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="$identifier"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="identifier"> + <xsl:value-of select="$identifier"/> + </phrase> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$identifier"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-comment"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="comment"> + <xsl:copy-of select="$text"/> + </phrase> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-special"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="special"> + <xsl:value-of select="$text"/> + </phrase> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-number"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="number"> + <xsl:value-of select="$text"/> + </phrase> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-string"> + <xsl:param name="text"/> <xsl:choose>- <!-- Have we exhausted all keywords without finding any to highlight? -->
- <xsl:when test="$keyword='' and $best-match=''"> - <!-- Just copy the text --> - <xsl:copy-of select="$text"/> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="string"> + <xsl:value-of select="$text"/> + </phrase> </xsl:when> -- <!-- Have we exhausted all keywords, but have one to highlight? If so,
- make sure we didn't just find part of an identifier. --> - <xsl:when - test="$keyword='' and- not (starts-with(translate(substring-after($text, $best-match),
- $id-chars, $X), 'X')) and- not (substring(translate(substring-before($text, $best-match),
- $id-chars, $X), - string-length(substring-before($text, - $best-match)), - 1) = 'X')"> - <!-- Copy text before this keyword --> - <xsl:value-of select="substring-before($text, $best-match)"/> - - <!-- Highlight the keyword --> - <xsl:call-template name="highlight-keyword"> - <xsl:with-param name="keyword" select="$best-match"/> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-char"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="char"> + <xsl:value-of select="$text"/> + </phrase> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-pp-directive"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="preprocessor"> + <xsl:value-of select="$text"/> + </phrase> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-text-ident-length"> + <xsl:param name="text"/> + <xsl:param name="pos" select="1"/> + <xsl:choose> + <xsl:when test="string-length($text) + 1 = $pos"> + <xsl:value-of select="$pos - 1"/> + </xsl:when> + <xsl:when test="contains($id-chars, substring($text, $pos, 1))"> + <xsl:call-template name ="highlight-text-ident-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="pos" select="$pos + 1"/> </xsl:call-template> - - <!-- Recurse on the rest of the text --> - <xsl:call-template name="highlight-text"> - <xsl:with-param name="text" - select="substring-after($text, $best-match)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$pos - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-text-number-length"> + <xsl:param name="text"/> + <xsl:param name="pos" select="1"/> + <xsl:choose> + <xsl:when test="string-length($text) + 1 = $pos"> + <xsl:value-of select="$pos - 1"/> + </xsl:when> + <xsl:when test="contains($number-chars, substring($text, $pos, 1))"> + <xsl:call-template name ="highlight-text-ident-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="pos" select="$pos + 1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$pos - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-text-string-length"> + <xsl:param name="text"/> + <xsl:param name="terminator"/> + <xsl:param name="pos" select="2"/> + <xsl:choose> + <xsl:when test="string-length($text) + 1 = $pos"> + <xsl:value-of select="$pos - 1"/> + </xsl:when> + <xsl:when test="substring($text, $pos, 1) = $terminator"> + <xsl:value-of select="$pos"/> + </xsl:when> + <xsl:when test="substring($text, $pos, 1) = '\' and + string-length($text) != $pos"> + <xsl:call-template name="highlight-text-string-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="terminator" select="$terminator"/> + <xsl:with-param name="pos" select="$pos + 2"/> </xsl:call-template> </xsl:when> - - <!-- We thought we had a keyword to highlight, but it was part of an - identifier. So output all of the text up to (but not including!) - the last letter of the identifier, and try again to - highlight. --> - <xsl:when test="$keyword=''"> - <xsl:value-of select="substring-before($text, $best-match)"/> - <xsl:value-of- select="substring($best-match, 1, string-length($best-match)-1)"/>
- <xsl:call-template name="highlight-text"> - <xsl:with-param name="text"- select="concat(substring($best-match, string-length($best-match),
- 1), substring-after($text, $best-match))"/> + <xsl:otherwise> + <xsl:call-template name="highlight-text-string-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="terminator" select="$terminator"/> + <xsl:with-param name="pos" select="$pos + 1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-text-operator-length"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="string-length($text) >= 4 and + not(contains(substring($text, 1, 4), ' ')) and + contains($operators4, substring($text, 1, 4))"> + <xsl:value-of select="4"/> + </xsl:when> + <xsl:when test="string-length($text) >= 3 and + not(contains(substring($text, 1, 3), ' ')) and + contains($operators3, substring($text, 1, 3))"> + <xsl:value-of select="3"/> + </xsl:when> + <xsl:when test="string-length($text) >= 2 and + not(contains(substring($text, 1, 2), ' ')) and + contains($operators2, substring($text, 1, 2))"> + <xsl:value-of select="2"/> + </xsl:when> + <xsl:when test="string-length($text) >= 1 and + not(contains(substring($text, 1, 1), ' ')) and + contains($operators1, substring($text, 1, 1))"> + <xsl:value-of select="1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="0"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-text-pp-directive-length"> + <xsl:param name="text"/> + <!-- Assume that the first character is a # --> + <xsl:param name="pos" select="2"/> + <xsl:choose> + <xsl:when test="contains($id-chars, substring($text, $pos, 1))"> + <xsl:call-template name="highlight-text-ident-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="pos" select="$pos + 1"/> </xsl:call-template> </xsl:when> - - <!-- Does the text contain this keyword with a better match than we - previously had? --> - <xsl:when - test="contains($text, $keyword) and - (($best-match = '') or - (string-length(substring-before($text, $keyword)) < - string-length(substring-before($text, $best-match))))"> - <!-- Recurse with the current keyword as the new best match --> - <xsl:call-template name="highlight-text"> + <xsl:when test="contains(' 	', substring($text, $pos, 1))"> + <xsl:call-template name="highlight-text-pp-directive-length"> <xsl:with-param name="text" select="$text"/> - <xsl:with-param name="keywords" select="$keywords-left"/> - <xsl:with-param name="best-match" select="$keyword"/> + <xsl:with-param name="pos" select="$pos + 1"/> </xsl:call-template> </xsl:when> - - <!-- Text does not contain this keyword. Just recurse normally --> + <xsl:otherwise> + <xsl:value-of select="$pos - 1"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-text-impl-leading-whitespace"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="string-length($text) = 0"/>+ <xsl:when test="contains(' 

	', substring($text, 1, 1))">
+ <xsl:value-of select="substring($text, 1, 1)"/> + <xsl:call-template name="highlight-text-impl-leading-whitespace"> + <xsl:with-param name="text" select="substring($text, 2)"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="'#' = substring($text, 1, 1)"> + <xsl:variable name="pp-length"> + <xsl:call-template name="highlight-text-pp-directive-length"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="highlight-pp-directive">+ <xsl:with-param name="text" select="substring($text, 1, $pp-length)"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="substring($text, $pp-length + 1)"/>
+ </xsl:call-template> + </xsl:when> <xsl:otherwise> - <xsl:call-template name="highlight-text"> + <xsl:call-template name="highlight-text-impl-root"> <xsl:with-param name="text" select="$text"/> - <xsl:with-param name="keywords" select="$keywords-left"/> - <xsl:with-param name="best-match" select="$best-match"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> + + <xsl:template name="highlight-text-impl-root"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="string-length($text) = 0"/> + <xsl:when test="contains($id-start-chars, substring($text, 1, 1))"> + <xsl:variable name="ident-length"> + <xsl:call-template name="highlight-text-ident-length"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="highlight-identifier">+ <xsl:with-param name="identifier" select="substring($text, 1, $ident-length)"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="substring($text, $ident-length + 1)"/>
+ </xsl:call-template> + </xsl:when> + <xsl:when test="contains($digits, substring($text, 1, 1))"> + <xsl:variable name="number-length"> + <xsl:call-template name="highlight-text-number-length"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="highlight-number">+ <xsl:with-param name="text" select="substring($text, 1, $number-length)"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="substring($text, $number-length + 1)"/>
+ </xsl:call-template> + </xsl:when> + <xsl:when test="substring($text, 1, 1) = '"'"> + <xsl:variable name="string-length"> + <xsl:call-template name="highlight-text-string-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="terminator" select="'"'"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="highlight-string">+ <xsl:with-param name="text" select="substring($text, 1, $string-length)"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="substring($text, $string-length + 1)"/>
+ </xsl:call-template> + </xsl:when> + <xsl:when test="substring($text, 1, 1) = $single-quote"> + <xsl:variable name="char-length"> + <xsl:call-template name="highlight-text-string-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="terminator" select="$single-quote"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="highlight-char">+ <xsl:with-param name="text" select="substring($text, 1, $char-length)"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="substring($text, $char-length + 1)"/>
+ </xsl:call-template> + </xsl:when> + <xsl:when test="substring($text, 1, 2) = '//'"> + <xsl:call-template name="highlight-comment">+ <xsl:with-param name="text" select="substring-before($text, '
')"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="concat('
', substring-after($text, '
'))"/>
+ </xsl:call-template> + </xsl:when> + <xsl:when test="substring($text, 1, 2) = '/*'"> + <xsl:call-template name="highlight-comment">+ <xsl:with-param name="text" select="concat(substring-before($text, '*/'), '*/')"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="substring-after($text, '*/')"/>
+ </xsl:call-template> + </xsl:when> + <xsl:when test="contains('

', substring($text, 1, 1))"> + <xsl:value-of select="substring($text, 1, 1)"/> + <xsl:call-template name="highlight-text-impl-leading-whitespace"> + <xsl:with-param name="text" select="substring($text, 2)"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains(' 	', substring($text, 1, 1))"> + <xsl:value-of select="substring($text, 1, 1)"/> + <xsl:call-template name="highlight-text-impl-root"> + <xsl:with-param name="text" select="substring($text, 2)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="operator-length"> + <xsl:call-template name="highlight-text-operator-length"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$operator-length = 0"> + <xsl:value-of select="substring($text, 1, 1)"/> + <xsl:call-template name="highlight-text-impl-root"> + <xsl:with-param name="text" select="substring($text, 2)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="highlight-special">+ <xsl:with-param name="text" select="substring($text, 1, $operator-length)"/>
+ </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root">+ <xsl:with-param name="text" select="substring($text, $operator-length + 1)"/>
+ </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Perform C++ syntax highlighting on the given text --> + <xsl:template name="highlight-text"> + <xsl:param name="text" select="."/> + <xsl:call-template name="highlight-text-impl-leading-whitespace"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:template> <xsl:template match="*" mode="highlight"> <xsl:element name="{name(.)}"> @@ -162,4 +457,9 @@ conceptname|macroname|globalname" mode="highlight"> <xsl:apply-templates select="." mode="annotation"/> </xsl:template> + + <xsl:template match="type" mode="highlight"> + <xsl:apply-templates mode="highlight"/> + </xsl:template> + </xsl:stylesheet> ======================================= --- /trunk/tools/boostbook/xsl/template.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/template.xsl Sun Sep 12 19:23:16 2010 @@ -72,18 +72,31 @@ <xsl:call-template name="highlight-keyword"> <xsl:with-param name="keyword" select="'template'"/> </xsl:call-template> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="'<'"/> + </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:text>template</xsl:text> + <xsl:text><</xsl:text> </xsl:otherwise> </xsl:choose> - <xsl:text><</xsl:text> <xsl:call-template name="template.synopsis.parameters"> <xsl:with-param name="indentation" select="$indentation + 9"/> <xsl:with-param name="wrap" select="$wrap"/> <xsl:with-param name="highlight" select="$highlight"/> </xsl:call-template> - <xsl:text>> </xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="'>'"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>> </xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:template><!-- Display a list of template parameters for a synopsis (no comments) -->
@@ -100,7 +113,16 @@ <xsl:if test="$parameters"> <!-- Emit the prefix (either a comma-space, or empty if this is the first parameter) --> - <xsl:value-of select="$prefix"/> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="$prefix"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$prefix"/> + </xsl:otherwise> + </xsl:choose> <!-- Get the actual parameter and its attributes --> <xsl:variable name="parameter" select="$parameters[position()=1]"/> @@ -179,17 +201,30 @@ <xsl:call-template name="highlight-keyword"> <xsl:with-param name="keyword" select="'template'"/> </xsl:call-template> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="'<'"/> + </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:text>template</xsl:text> + <xsl:text><</xsl:text> </xsl:otherwise> </xsl:choose> - <xsl:text><</xsl:text> <xsl:call-template name="template.reference.parameters"> <xsl:with-param name="indentation" select="$indentation + 9"/> <xsl:with-param name="highlight" select="$highlight"/> </xsl:call-template> - <xsl:text>> </xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="'>'"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>> </xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:if> </xsl:template> @@ -236,7 +271,16 @@ </xsl:call-template> <xsl:if test="$rest"> - <xsl:text>, </xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="', '"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>, </xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:if> <!-- Display the comment --> @@ -314,7 +358,18 @@ <xsl:text>typename</xsl:text> </xsl:otherwise> </xsl:choose> - <xsl:if test="$parameter/@pack=1"><xsl:text>...</xsl:text></xsl:if> + <xsl:if test="$parameter/@pack=1"> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'...'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>...</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> <xsl:text> </xsl:text> <xsl:call-template name="template.parameter.name"> @@ -358,7 +413,16 @@ </xsl:variable> <xsl:if test="not($def='')"> - <xsl:text> = </xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' = '"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text> = </xsl:text> + </xsl:otherwise> + </xsl:choose> <xsl:copy-of select="$def"/> @@ -389,7 +453,18 @@ <xsl:value-of select="$parameter/type/*|$parameter/type/text()"/> </xsl:otherwise> </xsl:choose> - <xsl:if test="$parameter/@pack=1"><xsl:text>...</xsl:text></xsl:if> + <xsl:if test="$parameter/@pack=1"> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'...'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>...</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:if> <xsl:text> </xsl:text> <xsl:call-template name="template.parameter.name"> @@ -402,7 +477,16 @@ </xsl:variable> <xsl:if test="not($def='')"> - <xsl:text> = </xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' = '"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text> = </xsl:text> + </xsl:otherwise> + </xsl:choose> <xsl:choose> <xsl:when test="$highlight"> @@ -423,25 +507,72 @@ </xsl:template> <xsl:template match="template-varargs" mode="print.parameter"> - <xsl:text>...</xsl:text> + <xsl:param name="highlight" select="true()"/> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'...'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>...</xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="specialization"> <xsl:param name="highlight" select="true()"/> - <xsl:text><</xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'<'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text><</xsl:text> + </xsl:otherwise> + </xsl:choose> <xsl:apply-templates select="template-arg"> <xsl:with-param name="highlight" select="$highlight"/> </xsl:apply-templates> - <xsl:text>></xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'>'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>></xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="template-arg"> + <xsl:param name="highlight" select="true()"/> <xsl:if test="position() > 1"> - <xsl:text>, </xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="', '"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>, </xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:if> <xsl:apply-templates mode="highlight"/> <xsl:if test="@pack=1"> - <xsl:text>...</xsl:text> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'...'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>...</xsl:text> + </xsl:otherwise> + </xsl:choose> </xsl:if> </xsl:template> </xsl:stylesheet> ======================================= --- /trunk/tools/boostbook/xsl/type.xsl Mon Feb 8 23:37:27 2010 +++ /trunk/tools/boostbook/xsl/type.xsl Sun Sep 12 19:23:16 2010 @@ -134,7 +134,9 @@ <xsl:text> </xsl:text> <xsl:value-of select="@name"/> <xsl:apply-templates select="specialization"/> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:variable> <xsl:choose> @@ -160,7 +162,9 @@ </xsl:with-param> </xsl:call-template> <xsl:apply-templates select="specialization"/> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:when> <xsl:otherwise> @@ -195,7 +199,9 @@ <xsl:with-param name="text" select="string(@name)"/> </xsl:call-template> <xsl:apply-templates select="specialization"/> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> @@ -327,8 +333,10 @@ <xsl:with-param name="link-type" select="$link-type"/> <xsl:with-param name="highlight" select="true()"/> </xsl:call-template> - <xsl:value-of select="substring(concat(';', $name-padding),- 1, $max-name-length - string-length($truncated-typedef-name))"/>
+ <xsl:call-template name="highlight-text">+ <xsl:with-param name="text" select="substring(concat(';', $name-padding), + 1, $max-name-length - string-length($truncated-typedef-name))"/>
+ </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> @@ -338,7 +346,9 @@ <xsl:with-param name="link-type" select="$link-type"/> <xsl:with-param name="highlight" select="true()"/> </xsl:call-template> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> @@ -461,7 +471,9 @@ <xsl:if test="not(@name = '')"> <xsl:text> </xsl:text> - <xsl:value-of select="@name"/> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> </xsl:if> <xsl:text> = </xsl:text> @@ -471,7 +483,9 @@ <xsl:apply-templates select="default/*|default/text()"/> </xsl:with-param> </xsl:call-template> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> <xsl:if test="purpose"> <xsl:text> </xsl:text> @@ -523,7 +537,9 @@ <!-- Output the type --> <xsl:choose> <xsl:when test="type">- <xsl:apply-templates select="type/*|type/text()" mode="annotation"/> + <xsl:apply-templates select="type/*|type/text()" mode="annotation">
+ <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> </xsl:when> <xsl:otherwise> <xsl:message> @@ -581,14 +597,20 @@ <xsl:when test="$single-line-candidate and (string-length($single-line) + $indentation + 3 < $max-columns)"> - <xsl:text> : </xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' : '"/> + </xsl:call-template> <xsl:call-template name="print.base.classes.single"/> - <xsl:text> {</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' {'"/> + </xsl:call-template> </xsl:when> <xsl:when test="$single-line-candidate and (string-length($single-line) + $base-indentation + 2 < $max-columns)"> - <xsl:text> : </xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' : '"/> + </xsl:call-template> <xsl:call-template name="indent"><xsl:with-param name="indentation" select="$base-indentation + 2"/>
</xsl:call-template> @@ -597,10 +619,14 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$base-indentation"/> </xsl:call-template> - <xsl:text>{</xsl:text> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="'{'"/> + </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:text> : </xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' : '"/> + </xsl:call-template> <xsl:call-template name="print.base.classes.multi"> <xsl:with-param name="indentation" select="$indentation + 3"/> </xsl:call-template> @@ -608,7 +634,9 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$base-indentation"/> </xsl:call-template> - <xsl:text>{</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'{'"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> @@ -736,26 +764,28 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$indentation + 2"/> </xsl:call-template> - <emphasis> - <xsl:text>// </xsl:text> - <!-- True if there are any non-compacted typedefs --> - <xsl:variable name="have-typedef-references"- select="typedef and ((typedef/para|typedef/description) or ($boost.compact.typedef='0'))"/>
- <xsl:choose> - <xsl:when test="$have-typedef-references"> - <xsl:call-template name="internal-link"> - <xsl:with-param name="to"> - <xsl:call-template name="generate.id"/> - <xsl:text>types</xsl:text> - </xsl:with-param> - <xsl:with-param name="text" select="'types'"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:text>types</xsl:text> - </xsl:otherwise> - </xsl:choose> - </emphasis> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <!-- True if there are any non-compacted typedefs --> + <xsl:variable name="have-typedef-references"+ select="typedef and ((typedef/para|typedef/description) or ($boost.compact.typedef='0'))"/>
+ <xsl:choose> + <xsl:when test="$have-typedef-references"> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + <xsl:text>types</xsl:text> + </xsl:with-param> + <xsl:with-param name="text" select="'types'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>types</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> <xsl:variable name="max-type-length"> <xsl:call-template name="find-max-type-length"/> @@ -846,7 +876,9 @@ <xsl:call-template name="highlight-keyword"> <xsl:with-param name="keyword" select="$specification"/> </xsl:call-template> - <xsl:text>:</xsl:text> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="':'"/> + </xsl:call-template> </xsl:template> <xsl:template match="access" mode="synopsis"> @@ -882,15 +914,22 @@ comment. --> <xsl:if test="purpose"> <xsl:text> </xsl:text> - <xsl:call-template name="indent"> - <xsl:with-param name="indentation" select="$indentation"/> - </xsl:call-template> + <xsl:variable name="spaces"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:variable> + <xsl:copy-of select="$spaces"/> <xsl:call-template name="highlight-comment"> <xsl:with-param name="text"> <xsl:text>// </xsl:text> - <xsl:apply-templates select="purpose" mode="comment"/> + <xsl:apply-templates select="purpose" mode="comment"> + <xsl:with-param name="wrap" select="true()"/>+ <xsl:with-param name="prefix" select="concat($spaces, '// ')"/>
+ </xsl:apply-templates> </xsl:with-param> </xsl:call-template> + <xsl:text> </xsl:text> </xsl:if> </xsl:if> @@ -940,7 +979,9 @@ </xsl:when> <xsl:otherwise> <!-- Opening brace --> - <xsl:text> {</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' {'"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> @@ -973,7 +1014,9 @@ <xsl:call-template name="indent"> <xsl:with-param name="indentation" select="$indentation"/> </xsl:call-template> - <xsl:text>};</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'};'"/> + </xsl:call-template> </xsl:template> <!-- Emit nested class reference documentation --> @@ -1169,7 +1212,9 @@ <xsl:apply-templates select="type" mode="highlight"/> <xsl:text> </xsl:text> <xsl:value-of select="@name"/> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:when> <xsl:otherwise> @@ -1283,16 +1328,22 @@ <xsl:with-param name="higlhight" select="false()"/> </xsl:call-template> - <xsl:text> { </xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' { '"/> + </xsl:call-template> <xsl:call-template name="type.enum.list.compact"> <xsl:with-param name="indentation" select="$indentation + string-length(@name) + 8"/> <xsl:with-param name="compact" select="true()"/> </xsl:call-template> - <xsl:text> }</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' }'"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> - <xsl:text>;</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> </xsl:template> <!-- Enumeration reference at namespace level --> @@ -1354,14 +1405,18 @@ <!-- Header --> <xsl:variable name="header" select="concat(' ', @name, ' { ')"/> - <xsl:value-of select="$header"/> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="$header"/> + </xsl:call-template> <!-- Print the enumeration values --> <xsl:call-template name="type.enum.list.compact"><xsl:with-param name="indentation" select="4 + string-length($header)"/>
</xsl:call-template> - <xsl:text> };</xsl:text> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' };'"/> + </xsl:call-template> </xsl:template> <!-- List enumeration values in a compact form e.g., ======================================= --- /trunk/tools/boostbook/xsl/xhtml.xsl Mon May 31 02:25:10 2010 +++ /trunk/tools/boostbook/xsl/xhtml.xsl Sun Sep 12 19:23:16 2010 @@ -16,307 +16,22 @@ <xsl:importhref="http://docbook.sourceforge.net/release/xsl/current/xhtml/math.xsl"/>
- <xsl:import href="chunk-common.xsl"/> - <xsl:import href="docbook-layout.xsl"/> - <xsl:import href="navbar.xsl"/> - <xsl:import href="admon.xsl"/> - <xsl:import href="xref.xsl"/> - <xsl:import href="relative-href.xsl"/> - <xsl:import href="callout.xsl"/> - - <xsl:param name="html.stylesheet"> - <xsl:choose> - <xsl:when test = "$boost.defaults = 'Boost'">- <xsl:value-of select = "concat($boost.root, '/doc/src/boostbook.css')"/>
- </xsl:when> - <xsl:otherwise> - boostbook.css - </xsl:otherwise> - </xsl:choose> - </xsl:param> - - <xsl:param name="admon.style"/> - <xsl:param name="admon.graphics">1</xsl:param> - <xsl:param name="boostbook.verbose" select="0"/> - <xsl:param name="navig.graphics" select="1"/> - <xsl:param name="navig.graphics.extension" select="'.png'"/> - <xsl:param name="chapter.autolabel" select="1"/> - <xsl:param name="use.id.as.filename" select="1"/> - <xsl:param name="refentry.generate.name" select="0"/> - <xsl:param name="refentry.generate.title" select="1"/> - <xsl:param name="make.year.ranges" select="1"/> - <xsl:param name="generate.manifest" select="1"/> - <xsl:param name="generate.section.toc.level" select="3"/> - <xsl:param name="doc.standalone">false</xsl:param> - <xsl:param name="chunker.output.indent">yes</xsl:param>- <xsl:param name="chunk.quietly" select="not(number($boostbook.verbose))"/>
- <xsl:param name="toc.max.depth">2</xsl:param> - <xsl:param name="callout.graphics.number.limit">15</xsl:param> - <xsl:param name = "admon.graphics.path" - select = "concat($boost.root, '/doc/xhtml/images/')"/> - <xsl:param name = "navig.graphics.path" - select = "concat($boost.root, '/doc/xhtml/images/')"/> - <xsl:param name = "callout.graphics.path" - select = "concat($boost.root, '/doc/src/images/callouts/')"/> - - - <xsl:param name="admon.style"> - <!-- Remove the style. Let the CSS do the styling --> -</xsl:param> - -<!-- Always have graphics --> -<xsl:param name="admon.graphics" select="1"/> - - <xsl:param name="generate.toc"> -appendix toc,title -article/appendix nop -article toc,title -book toc,title -chapter toc,title -part toc,title -preface toc,title -qandadiv toc -qandaset toc -reference toc,title -sect1 toc -sect2 toc -sect3 toc -sect4 toc -sect5 toc -section toc -set toc,title - </xsl:param> - - - <xsl:template name="format.cvs.revision"> - <xsl:param name="text"/> - - <!-- Remove the "$Date: " --> - <xsl:variable name="text.noprefix" - select="substring-after($text, '$Date: ')"/> - - <!-- Grab the year -->- <xsl:variable name="year" select="substring-before($text.noprefix, '/')"/>
- <xsl:variable name="text.noyear" - select="substring-after($text.noprefix, '/')"/> - - <!-- Grab the month -->- <xsl:variable name="month" select="substring-before($text.noyear, '/')"/>
- <xsl:variable name="text.nomonth" - select="substring-after($text.noyear, '/')"/> - - <!-- Grab the year -->- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday" - select="substring-after($text.nomonth, ' ')"/> - - <!-- Get the time --> - <xsl:variable name="time" select="substring-before($text.noday, ' ')"/> - - <xsl:variable name="month.name"> - <xsl:choose> - <xsl:when test="$month=1">January</xsl:when> - <xsl:when test="$month=2">February</xsl:when> - <xsl:when test="$month=3">March</xsl:when> - <xsl:when test="$month=4">April</xsl:when> - <xsl:when test="$month=5">May</xsl:when> - <xsl:when test="$month=6">June</xsl:when> - <xsl:when test="$month=7">July</xsl:when> - <xsl:when test="$month=8">August</xsl:when> - <xsl:when test="$month=9">September</xsl:when> - <xsl:when test="$month=10">October</xsl:when> - <xsl:when test="$month=11">November</xsl:when> - <xsl:when test="$month=12">December</xsl:when> - </xsl:choose> - </xsl:variable> -- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' GMT')"/> - </xsl:template> - - - <xsl:template name="format.svn.revision"> - <xsl:param name="text"/> - - <!-- Remove the "$Date: " --> - <xsl:variable name="text.noprefix" - select="substring-after($text, '$Date: ')"/> - - <!-- Grab the year -->- <xsl:variable name="year" select="substring-before($text.noprefix, '-')"/>
- <xsl:variable name="text.noyear" - select="substring-after($text.noprefix, '-')"/> - - <!-- Grab the month -->- <xsl:variable name="month" select="substring-before($text.noyear, '-')"/>
- <xsl:variable name="text.nomonth" - select="substring-after($text.noyear, '-')"/> - - <!-- Grab the year -->- <xsl:variable name="day" select="substring-before($text.nomonth, ' ')"/>
- <xsl:variable name="text.noday" - select="substring-after($text.nomonth, ' ')"/> - - <!-- Get the time --> - <xsl:variable name="time" select="substring-before($text.noday, ' ')"/> - <xsl:variable name="text.notime" - select="substring-after($text.noday, ' ')"/> - - <!-- Get the timezone -->- <xsl:variable name="timezone" select="substring-before($text.notime, ' ')"/>
- - <xsl:variable name="month.name"> - <xsl:choose> - <xsl:when test="$month=1">January</xsl:when> - <xsl:when test="$month=2">February</xsl:when> - <xsl:when test="$month=3">March</xsl:when> - <xsl:when test="$month=4">April</xsl:when> - <xsl:when test="$month=5">May</xsl:when> - <xsl:when test="$month=6">June</xsl:when> - <xsl:when test="$month=7">July</xsl:when> - <xsl:when test="$month=8">August</xsl:when> - <xsl:when test="$month=9">September</xsl:when> - <xsl:when test="$month=10">October</xsl:when> - <xsl:when test="$month=11">November</xsl:when> - <xsl:when test="$month=12">December</xsl:when> - </xsl:choose> - </xsl:variable> -- <xsl:value-of select="concat($month.name, ' ', $day, ', ', $year, ' at ',
- $time, ' ', $timezone)"/> - </xsl:template> - - <!-- Footer Copyright --> - <xsl:template match="copyright" mode="boost.footer"> - <xsl:if test="position() > 1"> - <br/> - </xsl:if> - <xsl:call-template name="gentext"> - <xsl:with-param name="key" select="'Copyright'"/> - </xsl:call-template> - <xsl:call-template name="gentext.space"/> - <xsl:call-template name="dingbat"> - <xsl:with-param name="dingbat">copyright</xsl:with-param> - </xsl:call-template> - <xsl:call-template name="gentext.space"/> - <xsl:call-template name="copyright.years"> - <xsl:with-param name="years" select="year"/> - <xsl:with-param name="print.ranges" select="$make.year.ranges"/> - <xsl:with-param name="single.year.ranges" - select="$make.single.year.ranges"/> - </xsl:call-template> - <xsl:call-template name="gentext.space"/> - <xsl:apply-templates select="holder" mode="titlepage.mode"/> - </xsl:template> - - <!-- Footer License --> - <xsl:template match="legalnotice" mode="boost.footer"> - <xsl:apply-templates select="para" mode="titlepage.mode" /> - </xsl:template> - - <xsl:template name="user.footer.content"> - <table width="100%"> - <tr> - <td align="left"> - <xsl:variable name="revision-nodes" - select="ancestor-or-self::* - [not (attribute::rev:last-revision='')]"/> - <xsl:if test="count($revision-nodes) > 0"> - <xsl:variable name="revision-node" - select="$revision-nodes[last()]"/> - <xsl:variable name="revision-text"> - <xsl:value-of- select="normalize-space($revision-node/attribute::rev:last-revision)"/>
- </xsl:variable> - <xsl:if test="string-length($revision-text) > 0"> - <p> - <small> - <xsl:text>Last revised: </xsl:text> - <xsl:choose> - <xsl:when test="contains($revision-text, '/')"> - <xsl:call-template name="format.cvs.revision">- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:call-template name="format.svn.revision">- <xsl:with-param name="text" select="$revision-text"/>
- </xsl:call-template> - </xsl:otherwise> - </xsl:choose> - </small> - </p> - </xsl:if> - </xsl:if> - </td> - <td align="right"> - <div class = "copyright-footer"> - <xsl:apply-templates select="ancestor::*/*/copyright" - mode="boost.footer"/> - <xsl:apply-templates select="ancestor::*/*/legalnotice" - mode="boost.footer"/> - </div> - </td> - </tr> - </table> - </xsl:template> - - <!-- We don't want refentry's to show up in the TOC because they - will merely be redundant with the synopsis. --> - <xsl:template match="refentry" mode="toc"/> - - <!-- override the behaviour of some DocBook elements for better - rendering facilities --> - - <xsl:template match = "programlisting[ancestor::informaltable]"> - <pre class = "table-{name(.)}"><xsl:apply-templates/></pre> - </xsl:template> - - <xsl:template match = "refsynopsisdiv"> - <h2 class = "{name(.)}-title">Synopsis</h2> - <div class = "{name(.)}"> - <xsl:apply-templates/> - </div> - </xsl:template> - -<!-- ============================================================ --> - -<xsl:template name="output.html.stylesheets"> - <xsl:param name="stylesheets" select="''"/> - - <xsl:choose> - <xsl:when test="contains($stylesheets, ' ')"> - <link rel="stylesheet"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target.relative">- <xsl:with-param name="target" select="substring-before($stylesheets, ' ')"/>
- </xsl:call-template> - </xsl:attribute> - <xsl:if test="$html.stylesheet.type != ''"> - <xsl:attribute name="type"> - <xsl:value-of select="$html.stylesheet.type"/> - </xsl:attribute> - </xsl:if> - </link> - <xsl:call-template name="output.html.stylesheets">- <xsl:with-param name="stylesheets" select="substring-after($stylesheets, ' ')"/>
- </xsl:call-template> - </xsl:when> - <xsl:when test="$stylesheets != ''"> - <link rel="stylesheet"> - <xsl:attribute name="href"> - <xsl:call-template name="href.target.relative">- <xsl:with-param name="target" select="$stylesheets"/>
- </xsl:call-template> - </xsl:attribute> - <xsl:if test="$html.stylesheet.type != ''"> - <xsl:attribute name="type"> - <xsl:value-of select="$html.stylesheet.type"/> - </xsl:attribute> - </xsl:if> - </link> - </xsl:when> - </xsl:choose> -</xsl:template> + <!-- Bring in the fast chunking overrides. There's nothing + that we need to override, so include instead of importing it. --> + <xsl:include+ href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunkfast.xsl"/>
+ + <!-- We have to make sure that our templates override all + docbook templates. Therefore, we include our own templates + instead of importing them. In order for this to work, + the stylesheets included here cannot also include each other --> + <xsl:include href="chunk-common.xsl"/> + <xsl:include href="docbook-layout.xsl"/> + <xsl:include href="navbar.xsl"/> + <xsl:include href="admon.xsl"/> + <xsl:include href="xref.xsl"/> + <xsl:include href="relative-href.xsl"/> + <xsl:include href="callout.xsl"/> + <xsl:include href="html-base.xsl"/> </xsl:stylesheet> ======================================= --- /trunk/tools/build/v2/doc/jamfile.jam Mon Dec 28 23:05:14 2009 +++ /trunk/tools/build/v2/doc/jamfile.jam Sun Sep 12 19:23:16 2010 @@ -13,7 +13,8 @@ <xsl:param>doc.standalone=true <xsl:param>nav.layout=none <implicit-dependency>jam_docs - <dependency>jam_docs + <dependency>jam_docs + <xsl:param>boost.root=../../../../.. ; xml jam_docs : ../../../jam/doc/bjam.qbk ; @@ -22,8 +23,3 @@ { BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; } - -# Copy stylesheet and images from 'official' docs location -stage html : $(BOOST_ROOT)/doc/html/boostbook.css ; -stage html/images - : [ path.glob $(BOOST_ROOT)/doc/html/images : *.png ] ; ======================================= --- /trunk/tools/build/v2/doc/src/standalone.xml Mon Dec 28 23:05:14 2009 +++ /trunk/tools/build/v2/doc/src/standalone.xml Sun Sep 12 19:23:16 2010 @@ -3,7 +3,24 @@ "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd";> <book xmlns:xi="http://www.w3.org/2001/XInclude";- id="bbv2" last-revision="$Date: 2009-10-28 03:47:51 -0400 (Wed, 28 Oct 2009) $"> + id="bbv2" last-revision="$Date: 2010-07-12 03:37:43 -0400 (Mon, 12 Jul 2010) $">
+ <bookinfo> + <copyright> + <year>2006</year> + <year>2007</year> + <year>2008</year> + <year>2009</year> + <holder>Vladimir Prus</holder> + </copyright> + + <legalnotice> + <para>Distributed under the Boost Software License, Version 1.0.+ (See accompanying file <filename>LICENSE_1_0.txt</filename> or copy at
+ <ulink+ url="http://www.boost.org/LICENSE_1_0.txt";>http://www.boost.org/LICENSE_1_0.txt</ulink>)
+ </para> + </legalnotice> + </bookinfo> <title>Boost.Build V2 User Manual</title> ======================================= --- /trunk/tools/build/v2/doc/src/userman.xml Mon Dec 28 23:05:14 2009 +++ /trunk/tools/build/v2/doc/src/userman.xml Sun Sep 12 19:23:16 2010 @@ -3,7 +3,24 @@ "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd";> <part xmlns:xi="http://www.w3.org/2001/XInclude";- id="bbv2" last-revision="$Date: 2009-10-28 03:47:51 -0400 (Wed, 28 Oct 2009) $"> + id="bbv2" last-revision="$Date: 2010-07-12 03:37:43 -0400 (Mon, 12 Jul 2010) $">
+ <partinfo> + <copyright> + <year>2006</year> + <year>2007</year> + <year>2008</year> + <year>2009</year> + <holder>Vladimir Prus</holder> + </copyright> + + <legalnotice> + <para>Distributed under the Boost Software License, Version 1.0.+ (See accompanying file <filename>LICENSE_1_0.txt</filename> or copy at
+ <ulink+ url="http://www.boost.org/LICENSE_1_0.txt";>http://www.boost.org/LICENSE_1_0.txt</ulink>)
+ </para> + </legalnotice> + </partinfo> <title>Boost.Build V2 User Manual</title> ======================================= --- /trunk/tools/build/v2/index.html Sat Apr 4 19:41:09 2009 +++ /trunk/tools/build/v2/index.html Sun Sep 12 19:23:16 2010 @@ -121,8 +121,8 @@ of Boost.Build reimplemented in Python, to make extendingBoost.Build even easier for end users (see <a href="http://zigzag.cs.msu.su/boost.build/wiki/PythonPort";>PythonPort</a>).
The specific issues planned for each release can be found on the- <a href="https://zigzag.cs.msu.su:7813/boost.build/roadmap";>roadmap</a>.<br>Milestone 13 计划是一个缺陷修复发布。Milestone 14 则会着重于改进用户文档。Milestone 15 会看到 Boost.Build 的大部分用 Python 重新实现,好让最终用户更容易地扩展 Boost.Build(见 <a href="http://zigzag.cs.msu.su/boost.build/wiki/PythonPort";>PythonPort</a>)。 每个版本关注的特定问题可以在 - <a href="https://zigzag.cs.msu.su:7813/boost.build/roadmap";>路标图</a> 中找到。 + <a href="https://trac.lvk.cs.msu.su/boost.build/roadmap";>roadmap</a>.<br>Milestone 13 计划是一个缺陷修复发布。Milestone 14 则会着重于改进用户文档。Milestone 15 会看到 Boost.Build 的大部分用 Python 重新实现,好让最终用户更容易地扩展 Boost.Build(见 <a href="http://zigzag.cs.msu.su/boost.build/wiki/PythonPort";>PythonPort</a>)。 每个版本关注的特定问题可以在 + <a href="https://trac.lvk.cs.msu.su/boost.build/roadmap";>路标图</a> 中 找到。
======================================= --- /trunk/tools/index.html Mon May 31 02:25:10 2010 +++ /trunk/tools/index.html Sun Sep 12 19:23:16 2010 @@ -5,7 +5,7 @@ <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">- <link rel="stylesheet" href="../doc/html/boostbook.css" type="text/css"></head> + <link rel="stylesheet" href="../doc/src/boostbook.css" type="text/css"></head>
<body bgcolor="#ffffff"><table style="border-collapse: collapse;" border="0" bordercolor="#111111" cellpadding="5" cellspacing="0">
======================================= --- /trunk/tools/inspect/ascii_check.cpp Mon Nov 24 07:20:31 2008 +++ /trunk/tools/inspect/ascii_check.cpp Sun Sep 12 19:23:16 2010 @@ -91,8 +91,9 @@ if ( bad_char != contents.end ()) { ++m_files_with_errors; + int ln = std::count( contents.begin(), bad_char, '\n' ) + 1; string the_line = find_line ( contents, bad_char );- error( library_name, full_path, string ( name()) + " non-ASCII: " + the_line );
+ error( library_name, full_path, "Non-ASCII: " + the_line, ln ); } } } // namespace inspect ======================================= --- /trunk/tools/inspect/crlf_check.cpp Mon Nov 24 07:20:31 2008 +++ /trunk/tools/inspect/crlf_check.cpp Sun Sep 12 19:23:16 2010 @@ -58,7 +58,7 @@ if (!failed && full_path.leaf() == test_file_name) { ++m_files_with_errors;- error( library_name, full_path, "should have cr-only line endings" ); + error( library_name, full_path, string(name()) + " should have cr-only line endings" );
} /* ======================================= --- /trunk/tools/inspect/doc/build.jam Mon Feb 8 23:37:27 2010 +++ /trunk/tools/inspect/doc/build.jam Sun Sep 12 19:23:16 2010 @@ -9,28 +9,11 @@ inspect.qbk ; -stage html - : - ../../../LICENSE_1_0.txt - ../../../boost.png - ../../../doc/html/boostbook.css - ; - -stage html/images - : - [ path.glob ../../../doc/html/images : *.png ] - ; - boostbook standalone : inspect : - <format>html - <name>html - <dependency>html - <dependency>html/images - <xsl:param>boost.root=. - <xsl:param>nav.layout=none + <xsl:param>boost.root=../../../.. ; #~ Copyright Rene Rivera 2006. ======================================= --- /trunk/tools/inspect/inspect.cpp Mon Nov 24 07:20:31 2008 +++ /trunk/tools/inspect/inspect.cpp Sun Sep 12 19:23:16 2010 @@ -22,6 +22,7 @@ #include <cstring> #include "boost/shared_ptr.hpp" +#include "boost/lexical_cast.hpp" #include "boost/filesystem/operations.hpp" #include "boost/filesystem/fstream.hpp" @@ -32,11 +33,13 @@ // the inspectors #include "copyright_check.hpp" #include "crlf_check.hpp" +#include "end_check.hpp" #include "license_check.hpp" #include "link_check.hpp" #include "path_name_check.hpp" #include "tab_check.hpp" #include "ascii_check.hpp" +#include "apple_macro_check.hpp" #include "minmax_check.hpp" #include "unnamed_namespace_check.hpp" @@ -74,6 +77,7 @@ string library; string rel_path; string msg; + int line_number; bool operator<( const error_msg & rhs ) const { @@ -81,6 +85,8 @@ if ( library > rhs.library ) return false; if ( rel_path < rhs.rel_path ) return true; if ( rel_path > rhs.rel_path ) return false; + if ( line_number < rhs.line_number ) return true; + if ( line_number > rhs.line_number ) return false; return msg < rhs.msg; } }; @@ -104,13 +110,7 @@// get info (as a string) if inspect_root is svn working copy --------------//
- string info( const fs::path & inspect_root ) - { - string rev; - string repos; - fs::path entries( inspect_root / ".svn" / "entries" ); - fs::ifstream entries_file( entries ); - if ( entries_file )+ void extract_info( fs::ifstream & entries_file, string & rev, string & repos )
{ std::getline( entries_file, rev ); std::getline( entries_file, rev ); @@ -118,6 +118,22 @@ std::getline( entries_file, rev ); // revision number as a string std::getline( entries_file, repos ); // repository as a string } + + string info( const fs::path & inspect_root ) + { + string rev( "?" ); + string repos( "unknown" ); + fs::path entries( inspect_root / ".svn" / "entries" ); + fs::ifstream entries_file( entries ); + if ( entries_file ) + extract_info( entries_file, rev, repos ); + else + { + entries = inspect_root / ".." / "svn_info" / ".svn" / "entries"; + fs::ifstream entries_file( entries ); + if ( entries_file ) + extract_info( entries_file, rev, repos ); + } return repos + " at revision " + rev; } @@ -146,6 +162,11 @@ && leaf != ".htaccess" // ignore svn files: && leaf != ".svn" + // ignore other version control files + && leaf != ".git" + && leaf != ".bzr" + // ignore OS X directory info files: + && leaf != ".DS_Store" ; } @@ -383,11 +404,11 @@ } std::cout << "\n"; } - else + else // html { // display error messages with group indication error_msg current; - string sep; + bool first_sep = true; bool first = true; for ( error_msg_vector::iterator itr ( msgs.begin() ); itr != msgs.end(); ++itr ) @@ -403,14 +424,26 @@ { std::cout << "\n"; std::cout << itr->rel_path; - sep = ": "; + first_sep = true; } if ( current.library != itr->library || current.rel_path != itr->rel_path || current.msg != itr->msg ) { - std::cout << sep << itr->msg; - sep = ", "; + std::string sep; + if (first_sep) + if (itr->line_number) sep = ":<br> "; + else sep = ": "; + else + if (itr->line_number) sep = "<br> "; + else sep = ", "; + + // print the message + if (itr->line_number)+ std::cout << sep << "(line " << itr->line_number << ") " << itr->msg;
+ else std::cout << sep << itr->msg; + + first_sep = false; } current.library = itr->library; current.rel_path = itr->rel_path; @@ -435,6 +468,10 @@ void worst_offenders_count() { + if ( msgs.empty() ) + { + return; + } string current_library( msgs.begin()->library ); int err_count = 0; for ( error_msg_vector::iterator itr ( msgs.begin() ); @@ -504,10 +541,12 @@ " -license\n" " -copyright\n" " -crlf\n" + " -end\n" " -link\n" " -path_name\n" " -tab\n" " -ascii\n" + " -apple_macro\n" " -minmax\n" " -unnamed\n"" default is all checks on; otherwise options specify desired checks"
@@ -558,13 +597,14 @@// error -------------------------------------------------------------------//
void inspector::error( const string & library_name, - const path & full_path, const string & msg ) + const path & full_path, const string & msg, int line_number ) { ++error_count; error_msg err_msg; err_msg.library = library_name; err_msg.rel_path = relative_to( full_path, fs::initial_path() ); err_msg.msg = msg; + err_msg.line_number = line_number; msgs.push_back( err_msg ); // std::cout << library_name << ": " @@ -673,10 +713,12 @@ bool license_ck = true; bool copyright_ck = true; bool crlf_ck = true; + bool end_ck = true; bool link_ck = true; bool path_name_ck = true; bool tab_ck = true; bool ascii_ck = true; + bool apple_ok = true; bool minmax_ck = true; bool unnamed_ck = true; bool cvs = false; @@ -704,10 +746,12 @@ license_ck = false; copyright_ck = false; crlf_ck = false; + end_ck = false; link_ck = false; path_name_ck = false; tab_ck = false; ascii_ck = false; + apple_ok = false; minmax_ck = false; unnamed_ck = false; } @@ -721,6 +765,8 @@ copyright_ck = true; else if ( std::strcmp( argv[1], "-crlf" ) == 0 ) crlf_ck = true; + else if ( std::strcmp( argv[1], "-end" ) == 0 ) + end_ck = true; else if ( std::strcmp( argv[1], "-link" ) == 0 ) link_ck = true; else if ( std::strcmp( argv[1], "-path_name" ) == 0 ) @@ -729,6 +775,8 @@ tab_ck = true; else if ( std::strcmp( argv[1], "-ascii" ) == 0 ) ascii_ck = true; + else if ( std::strcmp( argv[1], "-apple_macro" ) == 0 ) + apple_ok = true; else if ( std::strcmp( argv[1], "-minmax" ) == 0 ) minmax_ck = true; else if ( std::strcmp( argv[1], "-unnamed" ) == 0 ) @@ -762,6 +810,8 @@inspectors.push_back( inspector_element( new boost::inspect::copyright_check ) );
if ( crlf_ck )inspectors.push_back( inspector_element( new boost::inspect::crlf_check ) );
+ if ( end_ck )+ inspectors.push_back( inspector_element( new boost::inspect::end_check ) );
if ( link_ck )inspectors.push_back( inspector_element( new boost::inspect::link_check ) );
if ( path_name_ck ) @@ -770,6 +820,8 @@inspectors.push_back( inspector_element( new boost::inspect::tab_check ) );
if ( ascii_ck )inspectors.push_back( inspector_element( new boost::inspect::ascii_check ) );
+ if ( apple_ok )+ inspectors.push_back( inspector_element( new boost::inspect::apple_macro_check ) );
if ( minmax_ck )inspectors.push_back( inspector_element( new boost::inspect::minmax_check ) );
if ( unnamed_ck ) ======================================= --- /trunk/tools/inspect/inspector.hpp Mon Nov 24 07:20:31 2008 +++ /trunk/tools/inspect/inspector.hpp Sun Sep 12 19:23:16 2010 @@ -64,7 +64,8 @@ void error( const string & library_name, const path & full_path, - const string & msg ); + const string & msg, + int line_number =0 ); // 0 if not available or not applicable private: string_set m_signatures; ======================================= --- /trunk/tools/inspect/link_check.cpp Mon Nov 24 07:20:31 2008 +++ /trunk/tools/inspect/link_check.cpp Sun Sep 12 19:23:16 2010 @@ -9,16 +9,29 @@ #include "link_check.hpp" #include "boost/regex.hpp" #include "boost/filesystem/operations.hpp" +#include <boost/algorithm/string/case_conv.hpp> #include <cstdlib> +#include <set> + +// #include <iostream> namespace fs = boost::filesystem; namespace { - boost::regex url_regex( - "<\\s*[^>]*\\s+(?:HREF|SRC)" // HREF or SRC - "\\s*=\\s*(['\"])(.*?)\\1", + boost::regex html_bookmark_regex( + "<([^\\s<>]*)\\s*[^<>]*\\s+(NAME|ID)\\s*=\\s*(['\"])(.*?)\\3" + "|<!--.*?-->", boost::regbase::normal | boost::regbase::icase); + boost::regex html_url_regex( + "<([^\\s<>]*)\\s*[^<>]*\\s+(?:HREF|SRC)" // HREF or SRC + "\\s*=\\s*(['\"])\\s*(.*?)\\s*\\2" + "|<!--.*?-->", + boost::regbase::normal | boost::regbase::icase); + boost::regex css_url_regex( + "(\\@import\\s*[\"']|url\\s*\\(\\s*[\"']?)([^\"')]*)" + "|/\\*.*?\\*/", + boost::regbase::normal | boost::regbase::icase); // Regular expression for parsing URLS from: // http://tools.ietf.org/html/rfc3986#appendix-B @@ -26,17 +39,42 @@ "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$", boost::regbase::normal); - // Decode percent encoded characters and html escapsed ampersands, - // returns an empty string if there's an error. - // The urls should really be fully HTML decoded at the beginning. - std::string decode_url(std::string const& url_path) { + typedef std::set<std::string> bookmark_set; + bookmark_set bookmarks;+ bookmark_set bookmarks_lowercase; // duplicate check needs case insensitive
++ // Decode html escapsed ampersands, returns an empty string if there's an error.
+ std::string decode_ampersands(std::string const& url_path) { std::string::size_type pos = 0, next; std::string result; result.reserve(url_path.length());- while((next = url_path.find_first_of("&%", pos)) != std::string::npos) {
+ while((next = url_path.find('&', pos)) != std::string::npos) { result.append(url_path, pos, next - pos); pos = next; + if(url_path.substr(pos, 5) == "&") { + result += '&'; pos += 5; + } + else { + result += '&'; pos += 1; + } + break; + } + + result.append(url_path, pos, url_path.length()); + + return result; + } ++ // Decode percent encoded characters, returns an empty string if there's an error.
+ std::string decode_percents(std::string const& url_path) { + std::string::size_type pos = 0, next; + std::string result; + result.reserve(url_path.length()); + + while((next = url_path.find('%', pos)) != std::string::npos) { + result.append(url_path, pos, next - pos); + pos = next; switch(url_path[pos]) { case '%': { if(url_path.length() - next < 3) return ""; @@ -47,15 +85,6 @@ pos = next + 3; break; } - case '&': { - if(url_path.substr(pos, 5) == "&") { - result += '&'; pos += 5; - } - else { - result += '&'; pos += 1; - } - break; - } } } @@ -63,6 +92,10 @@ return result; } + + bool is_css(const path & p) { + return p.extension() == ".css"; + } } // unnamed namespace @@ -75,8 +108,11 @@ link_check::link_check() : m_broken_errors(0), m_unlinked_errors(0), m_invalid_errors(0), - m_bookmark_errors(0) - { + m_bookmark_errors(0), m_duplicate_bookmark_errors(0) + { + // HTML signatures are already registered by the base class, + // 'hypertext_inspector' + register_signature(".css"); }// inspect (all) -----------------------------------------------------------//
@@ -90,7 +126,7 @@m_paths[ relative_to( full_path, fs::initial_path() ) ] |= m_present;
}-// inspect ( .htm, .html ) -------------------------------------------------// +// inspect ( .htm, .html, .shtml, .css ) -----------------------------------//
void link_check::inspect( const string & library_name, @@ -103,17 +139,106 @@ bool no_link_errors = (contents.find( "boostinspect:" "nolink" ) != string::npos); + // build bookmarks databases + bookmarks.clear(); + bookmarks_lowercase.clear(); + string::const_iterator a_start( contents.begin() ); + string::const_iterator a_end( contents.end() ); + boost::match_results< string::const_iterator > a_what; + boost::match_flag_type a_flags = boost::match_default; + + if(!is_css(full_path)) + { + string previous_id; ++ while( boost::regex_search( a_start, a_end, a_what, html_bookmark_regex, a_flags) )
+ { + // a_what[0] contains the whole string iterators. + // a_what[1] contains the tag iterators. + // a_what[2] contains the attribute name. + // a_what[4] contains the bookmark iterators. + + if (a_what[4].matched) + { + string tag( a_what[1].first, a_what[1].second ); + boost::algorithm::to_lower(tag); + string attribute( a_what[2].first, a_what[2].second ); + boost::algorithm::to_lower(attribute); + string bookmark( a_what[4].first, a_what[4].second ); ++ bool name_following_id = ( attribute == "name" && previous_id == bookmark ); + if ( tag != "meta" && attribute == "id" ) previous_id = bookmark;
+ else previous_id.clear(); + + if ( tag != "meta" && !name_following_id ) + { + bookmarks.insert( bookmark ); +// std::cout << "******************* " << bookmark << '\n'; ++ // w3.org recommends case-insensitive checking for duplicate bookmarks
+ // since some browsers do a case-insensitive match. + string bookmark_lowercase( bookmark ); + boost::algorithm::to_lower(bookmark_lowercase); + + std::pair<bookmark_set::iterator, bool> result + = bookmarks_lowercase.insert( bookmark_lowercase ); + if (!result.second) + { + ++m_duplicate_bookmark_errors;+ int ln = std::count( contents.begin(), a_what[3].first, '\n' ) + 1; + error( library_name, full_path, "Duplicate bookmark: " + bookmark, ln );
+ } + } + } + + a_start = a_what[0].second; // update search position + a_flags |= boost::match_prev_avail; // update flags + a_flags |= boost::match_not_bob; + } + } + + // process urls string::const_iterator start( contents.begin() ); string::const_iterator end( contents.end() ); boost::match_results< string::const_iterator > what; boost::match_flag_type flags = boost::match_default; - while( boost::regex_search( start, end, what, url_regex, flags) ) + if(!is_css(full_path)) + {+ while( boost::regex_search( start, end, what, html_url_regex, flags) )
+ { + // what[0] contains the whole string iterators. + // what[1] contains the element type iterators. + // what[3] contains the URL iterators. + + if(what[3].matched) + { + string type( what[1].first, what[1].second ); + boost::algorithm::to_lower(type); + + // TODO: Complain if 'link' tags use external stylesheets. + do_url( string( what[3].first, what[3].second ), + library_name, full_path, no_link_errors,+ type == "a" || type == "link", contents.begin(), what[3].first );
+ } + + start = what[0].second; // update search position + flags |= boost::match_prev_avail; // update flags + flags |= boost::match_not_bob; + } + } + + while( boost::regex_search( start, end, what, css_url_regex, flags) ) { // what[0] contains the whole string iterators. // what[2] contains the URL iterators. - do_url( string( what[2].first, what[2].second ), - library_name, full_path, no_link_errors ); + + if(what[2].matched) + { + do_url( string( what[2].first, what[2].second ), + library_name, full_path, no_link_errors, false, + contents.begin(), what[3].first ); + } start = what[0].second; // update search position flags |= boost::match_prev_avail; // update flags @@ -124,14 +249,35 @@// do_url ------------------------------------------------------------------//
void link_check::do_url( const string & url, const string & library_name,
- const path & source_path, bool no_link_errors )+ const path & source_path, bool no_link_errors, bool allow_external_content, + std::string::const_iterator contents_begin, std::string::const_iterator url_start )
// precondition: source_path.is_complete() { + if(!no_link_errors && url.empty()) { + ++m_invalid_errors; + int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path, "Empty URL.", ln ); + return; + } + + // Decode ampersand encoded characters.+ string decoded_url = is_css(source_path) ? url : decode_ampersands(url);
+ if(decoded_url.empty()) { + if(!no_link_errors) { + ++m_invalid_errors; + int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path, + "Invalid URL (invalid ampersand encodings): " + url, ln ); + } + return; + } + boost::smatch m; - if(!boost::regex_match(url, m, url_decompose_regex)) { + if(!boost::regex_match(decoded_url, m, url_decompose_regex)) { if(!no_link_errors) { ++m_invalid_errors;- error( library_name, source_path, string(name()) + " invalid URL: " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1;+ error( library_name, source_path, "Invalid URL: " + decoded_url, ln );
} return; } @@ -146,6 +292,15 @@ url_path(m[5]), //query(m[7]), fragment(m[9]); + + // Check for external content+ if(!allow_external_content && (authority_matched || scheme_matched)) {
+ if(!no_link_errors) { + ++m_invalid_errors; + int ln = std::count( contents_begin, url_start, '\n' ) + 1;+ error( library_name, source_path, "External content: " + decoded_url, ln );
+ } + } // Protocol checks if(scheme_matched) { @@ -156,7 +311,8 @@ if(!authority_matched) { if(!no_link_errors) { ++m_invalid_errors;- error( library_name, source_path, string(name()) + " no hostname: " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1;+ error( library_name, source_path, "No hostname: " + decoded_url, ln );
} } @@ -165,13 +321,24 @@ else if(scheme == "file") { if(!no_link_errors) { ++m_invalid_errors;- error( library_name, source_path, string(name()) + " invalid URL (hardwired file): " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path, + "Invalid URL (hardwired file): " + decoded_url, ln ); } }- else if(!(scheme == "mailto" || scheme == "ftp" || scheme == "news" || scheme == "javascript")) { + else if(scheme == "mailto" || scheme == "ftp" || scheme == "news" | | scheme == "javascript") {
+ if ( !no_link_errors && is_css(source_path) ) { + ++m_invalid_errors; + int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path, + "Invalid protocol for css: " + decoded_url, ln ); + } + } + else { if(!no_link_errors) { ++m_invalid_errors;- error( library_name, source_path, string(name()) + " unknown protocol: " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1;+ error( library_name, source_path, "Unknown protocol: '" + scheme + "' in url: " + decoded_url, ln );
} } @@ -182,16 +349,38 @@ if(authority_matched) { if(!no_link_errors) { ++m_invalid_errors;- error( library_name, source_path, string(name()) + " invalid URL (hostname without protocol): " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path,+ "Invalid URL (hostname without protocol): " + decoded_url, ln );
} } // Check the fragment identifier - if(fragment_matched) { - if ( !no_link_errors && fragment.find( '#' ) != string::npos ) - { - ++m_bookmark_errors;- error( library_name, source_path, string(name()) + " invalid bookmark: " + url );
+ if ( fragment_matched ) { + if ( is_css(source_path) ) { + if ( !no_link_errors ) { + ++m_invalid_errors; + int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path, + "Fragment link in CSS: " + decoded_url, ln ); + } + } + else { + if ( !no_link_errors && fragment.find( '#' ) != string::npos ) + { + ++m_bookmark_errors; + int ln = std::count( contents_begin, url_start, '\n' ) + 1;+ error( library_name, source_path, "Invalid bookmark: " + decoded_url, ln );
+ }+ else if ( !no_link_errors && url_path.empty() && !fragment.empty()
+ // w3.org recommends case-sensitive broken bookmark checking + // since some browsers do a case-sensitive match.+ && bookmarks.find(decode_percents(fragment)) == bookmarks.end() )
+ { + ++m_broken_errors; + int ln = std::count( contents_begin, url_start, '\n' ) + 1;+ error( library_name, source_path, "Unknown bookmark: " + decoded_url, ln );
+ } } // No more to do if it's just a fragment identifier @@ -199,26 +388,32 @@ } // Detect characters banned by RFC2396:- if ( !no_link_errors && url.find_first_of( " <>\"{}|\\^[]'" ) != string::npos ) + if ( !no_link_errors && decoded_url.find_first_of( " <>\"{}|\\^[]'" ) != string::npos )
{ ++m_invalid_errors;- error( library_name, source_path, string(name()) + " invalid character in URL: " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path, + "Invalid character in URL: " + decoded_url, ln ); } // Check that we actually have a path. if(url_path.empty()) { if(!no_link_errors) { ++m_invalid_errors;- error( library_name, source_path, string(name()) + " invalid URL (empty path in relative url): " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path,+ "Invalid URL (empty path in relative url): " + decoded_url, ln );
} } - // Decode percent and ampersand encoded characters. - string decoded_path = decode_url(url_path); + // Decode percent encoded characters. + string decoded_path = decode_percents(url_path); if(decoded_path.empty()) { if(!no_link_errors) { ++m_invalid_errors;- error( library_name, source_path, string(name()) + " invalid URL (invalid character encodings): " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1; + error( library_name, source_path,+ "Invalid URL (invalid character encodings): " + decoded_url, ln );
} return; } @@ -233,8 +428,10 @@ catch ( const fs::filesystem_error & ) { if(!no_link_errors) { + int ln = std::count( contents_begin, url_start, '\n' ) + 1; ++m_invalid_errors;- error( library_name, source_path, string(name()) + " invalid URL (error resolving path): " + url );
+ error( library_name, source_path, + "Invalid URL (error resolving path): " + decoded_url, ln ); } return; } @@ -256,7 +453,8 @@ if ( !no_link_errors && (itr->second & m_present) == 0 ) { ++m_broken_errors;- error( library_name, source_path, string(name()) + " broken link: " + url );
+ int ln = std::count( contents_begin, url_start, '\n' ) + 1;+ error( library_name, source_path, "Broken link: " + decoded_url, ln );
} } @@ -271,14 +469,15 @@ if ( (itr->second & m_linked_to) != m_linked_to && (itr->second & m_nounlinked_errors) != m_nounlinked_errors && (itr->first.rfind( ".html" ) == itr->first.size()-5 - || itr->first.rfind( ".htm" ) == itr->first.size()-4) + || itr->first.rfind( ".htm" ) == itr->first.size()-4 + || itr->first.rfind( ".css" ) == itr->first.size()-4)// because they may be redirectors, it is OK if these are unlinked:
&& itr->first.rfind( "index.html" ) == string::npos && itr->first.rfind( "index.htm" ) == string::npos ) { ++m_unlinked_errors;path full_path( fs::initial_path() / path(itr->first, fs::no_check) ); - error( impute_library( full_path ), full_path, string(name()) + " unlinked file" );
+ error( impute_library( full_path ), full_path, "Unlinked file" ); } } } ======================================= --- /trunk/tools/inspect/link_check.hpp Mon Nov 24 07:20:31 2008 +++ /trunk/tools/inspect/link_check.hpp Sun Sep 12 19:23:16 2010 @@ -27,17 +27,22 @@ long m_unlinked_errors; long m_invalid_errors; long m_bookmark_errors; + long m_duplicate_bookmark_errors; typedef std::map< string, int > m_path_map; m_path_map m_paths; // first() is relative initial_path() void do_url( const string & url, const string & library_name, - const path & full_source_path, bool no_link_errors ); + const path & full_source_path, bool no_link_errors, + bool allow_external_links,+ std::string::const_iterator contents_begin, std::string::const_iterator url_start);
public: link_check(); - virtual const char * name() const { return "*HTML*"; }- virtual const char * desc() const { return "invalid bookmarks, invalid urls, broken links, unlinked files"; }
+ virtual const char * name() const { return "*LINK*"; } + virtual const char * desc() const + { return "invalid bookmarks, duplicate bookmarks," + " invalid urls, broken links, unlinked files"; } virtual void inspect( const std::string & library_name, @@ -52,7 +57,10 @@ virtual ~link_check() {- std::cout << " " << m_bookmark_errors << " bookmarks with invalid characters" << line_break();
+ std::cout << " " << m_bookmark_errors+ << " bookmarks with invalid characters" << line_break();
+ std::cout << " " << m_duplicate_bookmark_errors + << " duplicate bookmarks" << line_break();std::cout << " " << m_invalid_errors << " invalid urls" << line_break(); std::cout << " " << m_broken_errors << " broken links" << line_break(); std::cout << " " << m_unlinked_errors << " unlinked files" << line_break();
======================================= ***Additional files exist in this changeset.***