diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/tools/boostbook | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/boostbook')
49 files changed, 14537 insertions, 0 deletions
diff --git a/src/boost/tools/boostbook/dtd/1.1/boost-no-inspect b/src/boost/tools/boostbook/dtd/1.1/boost-no-inspect new file mode 100644 index 000000000..37dfd21c3 --- /dev/null +++ b/src/boost/tools/boostbook/dtd/1.1/boost-no-inspect @@ -0,0 +1,4 @@ +Inspect complains that this directory is called '1.1', but that's the +standard naming style for DTDs, and this needs to match the url of the +DTD on the website. Any platform which has problems with this domain +name probably won't be able to build the documentation anyway.
\ No newline at end of file diff --git a/src/boost/tools/boostbook/dtd/1.1/boostbook.dtd b/src/boost/tools/boostbook/dtd/1.1/boostbook.dtd new file mode 100644 index 000000000..9805ec706 --- /dev/null +++ b/src/boost/tools/boostbook/dtd/1.1/boostbook.dtd @@ -0,0 +1,435 @@ +<!-- + BoostBook DTD version 1.1 + + For further information, see: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Boost_Documentation_Format + + Copyright (c) 2002 by Peter Simons <simons@cryp.to> + Copyright (c) 2003-2004 by Douglas Gregor <doug.gregor -at- gmail.com> + Copyright (c) 2007 by Frank Mori Hess <fmhess@users.sourceforge.net> + + 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) + + This DTD module is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//Boost//DTD BoostBook XML V1.1//EN" + SYSTEM "http://www.boost.org/tools/boostbook/dtd/1.1/boostbook.dtd" + + $Revision$ + $Date$ +--> + +<!--========== Define XInclude features. ==========--> +<!-- This is not really integrated into the DTD yet. Needs more + research. --> +<!-- +<!ELEMENT xi:include (xi:fallback)?> +<!ATTLIST xi:include + xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" + href CDATA #REQUIRED + parse (xml|text) "xml" + encoding CDATA #IMPLIED> + +<!ELEMENT xi:fallback ANY> +<!ATTLIST xi:fallback + xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"> + --> + +<!ENTITY % local.common.attrib "last-revision CDATA #IMPLIED"> + +<!--========== Define the BoostBook extensions ==========--> +<!ENTITY % boost.common.attrib "%local.common.attrib; + id CDATA #IMPLIED"> + +<!ENTITY % boost.namespace.mix + "class|class-specialization|struct|struct-specialization| + union|union-specialization|typedef|enum| + free-function-group|function|overloaded-function| + namespace"> + +<!ENTITY % boost.template.mix + "template-type-parameter|template-nontype-parameter|template-varargs"> + +<!ENTITY % boost.class.members + "static-constant|typedef|enum| + copy-assignment|constructor|destructor|method-group| + method|overloaded-method|data-member|class|class-specialization|struct| + struct-specialization|union|union-specialization"> + +<!ENTITY % boost.class.mix + "%boost.class.members;|free-function-group|function|overloaded-function"> + +<!ENTITY % boost.class.content + "template?, inherit*, purpose?, description?, + (%boost.class.mix;|access)*"> + +<!ENTITY % boost.class-specialization.content + "template?, specialization?, inherit?, purpose?, description?, + (%boost.class.mix;|access)*"> + +<!ENTITY % boost.function.semantics + "purpose?, description?, requires?, effects?, postconditions?, + returns?, throws?, complexity?, notes?, rationale?"> + +<!ENTITY % library.content + "libraryinfo, (title, ((section|library-reference|testsuite))+)?"> + +<!ELEMENT library (%library.content;)> +<!ATTLIST library + name CDATA #REQUIRED + dirname CDATA #REQUIRED + html-only CDATA #IMPLIED + url CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT boostbook (title, (chapter|library)*)> +<!ATTLIST boostbook %boost.common.attrib;> + +<!ELEMENT libraryinfo (author+, copyright*, legalnotice*, librarypurpose, librarycategory*)> +<!ATTLIST libraryinfo %boost.common.attrib;> + +<!ELEMENT librarypurpose (#PCDATA|code|ulink|functionname|methodname|classname|macroname|headername|enumname|globalname)*> +<!ATTLIST librarypurpose %boost.common.attrib;> + +<!ELEMENT librarycategory (#PCDATA)> +<!ATTLIST librarycategory + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT libraryname (#PCDATA)> +<!ATTLIST libraryname %boost.common.attrib;> + +<!ELEMENT library-reference ANY> +<!ATTLIST library-reference + %boost.common.attrib;> + +<!ELEMENT librarylist EMPTY> +<!ATTLIST librarylist %boost.common.attrib;> + +<!ELEMENT librarycategorylist (librarycategorydef)*> +<!ATTLIST librarycategorylist %boost.common.attrib;> + +<!ELEMENT librarycategorydef (#PCDATA)> +<!ATTLIST librarycategorydef + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT header ANY> +<!ATTLIST header + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT namespace (%boost.namespace.mix;)*> +<!ATTLIST namespace + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT class (%boost.class.content;)> +<!ATTLIST class + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT struct (%boost.class.content;)> +<!ATTLIST struct + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT union (%boost.class.content;)> +<!ATTLIST union + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT class-specialization (%boost.class-specialization.content;)> +<!ATTLIST class-specialization + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT struct-specialization (%boost.class-specialization.content;)> +<!ATTLIST struct-specialization + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT union-specialization (%boost.class-specialization.content;)> +<!ATTLIST union-specialization + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT access (%boost.class.members;)+> +<!ATTLIST access + name CDATA #REQUIRED + %boost.common.attrib;> + +<!--========= C++ Templates =========--> +<!ELEMENT template (%boost.template.mix;)*> +<!ATTLIST template %boost.common.attrib;> + +<!ELEMENT template-type-parameter (default?, purpose?)> +<!ATTLIST template-type-parameter + name CDATA #REQUIRED + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT template-nontype-parameter (type, default?, purpose?)> +<!ATTLIST template-nontype-parameter + name CDATA #REQUIRED + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT template-varargs EMPTY> +<!ATTLIST template-varargs %boost.common.attrib;> + +<!ELEMENT specialization (template-arg)*> +<!ATTLIST specialization %boost.common.attrib;> + +<!ELEMENT template-arg ANY> +<!ATTLIST template-arg + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT default ANY> +<!ATTLIST default %boost.common.attrib;> + +<!ELEMENT inherit (type, purpose?)> +<!ATTLIST inherit + access CDATA #IMPLIED + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT purpose ANY> +<!ATTLIST purpose %boost.common.attrib;> + +<!ELEMENT description ANY> +<!ATTLIST description %boost.common.attrib;> + +<!ELEMENT type ANY> +<!ATTLIST type %boost.common.attrib;> + +<!ELEMENT typedef (type, purpose?, description?)> +<!ATTLIST typedef + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT enum (enumvalue*, purpose?, description?)> +<!ATTLIST enum + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT enumvalue (default?, purpose?, description?)> +<!ATTLIST enumvalue + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT static-constant (type, default, purpose?, description?)> +<!ATTLIST static-constant + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT data-member (type, purpose?, description?)> +<!ATTLIST data-member + name CDATA #REQUIRED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT paramtype ANY> +<!ATTLIST paramtype %boost.common.attrib;> + +<!ELEMENT effects ANY> +<!ATTLIST effects %boost.common.attrib;> + +<!ELEMENT postconditions ANY> +<!ATTLIST postconditions %boost.common.attrib;> + +<!ELEMENT method-group (method|overloaded-method)*> +<!ATTLIST method-group + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT constructor (template?, parameter*, %boost.function.semantics;)> +<!ATTLIST constructor + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT destructor (%boost.function.semantics;)> +<!ATTLIST destructor + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT method (template?, type, parameter*, %boost.function.semantics;)> +<!ATTLIST method + name CDATA #REQUIRED + cv CDATA #IMPLIED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT function (template?, type, parameter*, %boost.function.semantics;)> +<!ATTLIST function + name CDATA #REQUIRED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT overloaded-method (signature*, %boost.function.semantics;)> +<!ATTLIST overloaded-method + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT overloaded-function (signature*, %boost.function.semantics;)> +<!ATTLIST overloaded-function + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT signature (template?, type, parameter*)> +<!ATTLIST signature + cv CDATA #IMPLIED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT requires ANY> +<!ATTLIST requires %boost.common.attrib;> + +<!ELEMENT returns ANY> +<!ATTLIST returns %boost.common.attrib;> + +<!ELEMENT throws ANY> +<!ATTLIST throws %boost.common.attrib;> + +<!ELEMENT complexity ANY> +<!ATTLIST complexity %boost.common.attrib;> + +<!ELEMENT notes ANY> +<!ATTLIST notes %boost.common.attrib;> + +<!ELEMENT rationale ANY> +<!ATTLIST rationale %boost.common.attrib;> + +<!ELEMENT functionname (#PCDATA)> +<!ATTLIST functionname + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT enumname (#PCDATA)> +<!ATTLIST enumname + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT macroname (#PCDATA)> +<!ATTLIST macroname %boost.common.attrib;> + +<!ELEMENT headername (#PCDATA)> +<!ATTLIST headername %boost.common.attrib;> + +<!ELEMENT globalname (#PCDATA)> +<!ATTLIST globalname + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT copy-assignment + (template?, type?, parameter*, %boost.function.semantics;)> +<!ATTLIST copy-assignment + cv CDATA #IMPLIED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT free-function-group (function|overloaded-function)*> +<!ATTLIST free-function-group + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT precondition ANY> +<!ATTLIST precondition %boost.common.attrib;> + +<!ELEMENT code ANY> +<!ATTLIST code %boost.common.attrib;> + +<!ELEMENT using-namespace EMPTY> +<!ATTLIST using-namespace + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT using-class EMPTY> +<!ATTLIST using-class + name CDATA #REQUIRED + %boost.common.attrib;> + +<!--========== Boost Testsuite Extensions ==========--> +<!ENTITY % boost.testsuite.tests + "compile-test|link-test|run-test| + compile-fail-test|link-fail-test|run-fail-test"> +<!ENTITY % boost.testsuite.test.content + "source*, lib*, requirement*, purpose, if-fails?"> + +<!ELEMENT testsuite ((%boost.testsuite.tests;)+)> +<!ATTLIST testsuite %boost.common.attrib;> + +<!ELEMENT compile-test (%boost.testsuite.test.content;)> +<!ATTLIST compile-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT link-test (%boost.testsuite.test.content;)> +<!ATTLIST link-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT run-test (%boost.testsuite.test.content;)> +<!ATTLIST run-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT compile-fail-test (%boost.testsuite.test.content;)> +<!ATTLIST compile-fail-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT link-fail-test (%boost.testsuite.test.content;)> +<!ATTLIST link-fail-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT run-fail-test (%boost.testsuite.test.content;)> +<!ATTLIST run-fail-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT source (#PCDATA|snippet)*> + +<!ELEMENT snippet EMPTY> +<!ATTLIST snippet + name CDATA #REQUIRED> + +<!ELEMENT lib (#PCDATA)> + +<!ELEMENT requirement (#PCDATA)> +<!ATTLIST requirement + name CDATA #REQUIRED> + +<!ELEMENT if-fails ANY> + +<!ELEMENT parameter (paramtype, default?, description?)> +<!ATTLIST parameter + name CDATA #IMPLIED + pack CDATA #IMPLIED> + +<!ELEMENT programlisting ANY> +<!ATTLIST programlisting + name CDATA #IMPLIED> + +<!--========== Customize the DocBook DTD ==========--> +<!ENTITY % local.tech.char.class "|functionname|libraryname|enumname|code"> +<!ENTITY % local.para.class + "|using-namespace|using-class|librarylist|librarycategorylist"> +<!ENTITY % local.descobj.class "|libraryinfo"> +<!ENTITY % local.classname.attrib "alt CDATA #IMPLIED"> +<!ENTITY % local.methodname.attrib "alt CDATA #IMPLIED"> +<!ENTITY % local.refentry.class "|library-reference|testsuite"> +<!ENTITY % local.title.char.mix ""> +<!ENTITY % programlisting.module "IGNORE"> +<!ENTITY % parameter.module "IGNORE"> +<!ENTITY % function.module "IGNORE"> +<!ENTITY % type.module "IGNORE"> + +<!--========== Import DocBook DTD ==========--> +<!ENTITY % DocBook PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> + +%DocBook; diff --git a/src/boost/tools/boostbook/dtd/boostbook.dtd b/src/boost/tools/boostbook/dtd/boostbook.dtd new file mode 100644 index 000000000..bd4c3f871 --- /dev/null +++ b/src/boost/tools/boostbook/dtd/boostbook.dtd @@ -0,0 +1,439 @@ +<!-- + BoostBook DTD - development version + + For further information, see: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Boost_Documentation_Format + + Copyright (c) 2002 by Peter Simons <simons@cryp.to> + Copyright (c) 2003-2004 by Douglas Gregor <doug.gregor -at- gmail.com> + Copyright (c) 2007 by Frank Mori Hess <fmhess@users.sourceforge.net> + + 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) + + The latest stable DTD module is identified by the PUBLIC and SYSTEM identifiers: + + PUBLIC "-//Boost//DTD BoostBook XML V1.1//EN" + SYSTEM "http://www.boost.org/tools/boostbook/dtd/1.1/boostbook.dtd" + + $Revision$ + $Date$ +--> + +<!--========== Define XInclude features. ==========--> +<!-- This is not really integrated into the DTD yet. Needs more + research. --> +<!-- +<!ELEMENT xi:include (xi:fallback)?> +<!ATTLIST xi:include + xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude" + href CDATA #REQUIRED + parse (xml|text) "xml" + encoding CDATA #IMPLIED> + +<!ELEMENT xi:fallback ANY> +<!ATTLIST xi:fallback + xmlns:xi CDATA #FIXED "http://www.w3.org/2001/XInclude"> + --> + +<!ENTITY % local.common.attrib "last-revision CDATA #IMPLIED"> + +<!--========== Define the BoostBook extensions ==========--> +<!ENTITY % boost.common.attrib "%local.common.attrib; + id CDATA #IMPLIED"> + +<!ENTITY % boost.namespace.mix + "class|class-specialization|struct|struct-specialization| + union|union-specialization|typedef|enum| + free-function-group|function|overloaded-function| + namespace"> + +<!ENTITY % boost.template.mix + "template-type-parameter|template-nontype-parameter|template-varargs"> + +<!ENTITY % boost.class.members + "static-constant|typedef|enum| + copy-assignment|constructor|destructor|method-group| + method|overloaded-method|data-member|class|class-specialization|struct| + struct-specialization|union|union-specialization"> + +<!ENTITY % boost.class.mix + "%boost.class.members;|free-function-group|function|overloaded-function"> + +<!ENTITY % boost.class.content + "template?, inherit*, purpose?, description?, + (%boost.class.mix;|access)*"> + +<!ENTITY % boost.class-specialization.content + "template?, specialization?, inherit?, purpose?, description?, + (%boost.class.mix;|access)*"> + +<!ENTITY % boost.function.semantics + "purpose?, description?, requires?, effects?, postconditions?, + returns?, throws?, complexity?, notes?, rationale?"> + +<!ENTITY % library.content + "libraryinfo, (title, ((section|library-reference|testsuite))+)?"> + +<!ELEMENT library (%library.content;)> +<!ATTLIST library + name CDATA #REQUIRED + dirname CDATA #REQUIRED + html-only CDATA #IMPLIED + url CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT boostbook (title, (chapter|library)*)> +<!ATTLIST boostbook %boost.common.attrib;> + +<!ELEMENT libraryinfo (author+, copyright*, legalnotice*, librarypurpose, librarycategory*)> +<!ATTLIST libraryinfo %boost.common.attrib;> + +<!ELEMENT librarypurpose (#PCDATA|code|ulink|functionname|methodname|classname|macroname|headername|enumname|globalname)*> +<!ATTLIST librarypurpose %boost.common.attrib;> + +<!ELEMENT librarycategory (#PCDATA)> +<!ATTLIST librarycategory + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT libraryname (#PCDATA)> +<!ATTLIST libraryname %boost.common.attrib;> + +<!ELEMENT library-reference ANY> +<!ATTLIST library-reference + %boost.common.attrib;> + +<!ELEMENT librarylist EMPTY> +<!ATTLIST librarylist %boost.common.attrib;> + +<!ELEMENT librarycategorylist (librarycategorydef)*> +<!ATTLIST librarycategorylist %boost.common.attrib;> + +<!ELEMENT librarycategorydef (#PCDATA)> +<!ATTLIST librarycategorydef + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT header ANY> +<!ATTLIST header + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT namespace (%boost.namespace.mix;)*> +<!ATTLIST namespace + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT class (%boost.class.content;)> +<!ATTLIST class + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT struct (%boost.class.content;)> +<!ATTLIST struct + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT union (%boost.class.content;)> +<!ATTLIST union + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT class-specialization (%boost.class-specialization.content;)> +<!ATTLIST class-specialization + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT struct-specialization (%boost.class-specialization.content;)> +<!ATTLIST struct-specialization + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT union-specialization (%boost.class-specialization.content;)> +<!ATTLIST union-specialization + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT access (%boost.class.members;)+> +<!ATTLIST access + name CDATA #REQUIRED + %boost.common.attrib;> + +<!--========= C++ Templates =========--> +<!ELEMENT template (%boost.template.mix;)*> +<!ATTLIST template %boost.common.attrib;> + +<!ELEMENT template-type-parameter (default?, purpose?)> +<!ATTLIST template-type-parameter + name CDATA #REQUIRED + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT template-nontype-parameter (type, default?, purpose?)> +<!ATTLIST template-nontype-parameter + name CDATA #REQUIRED + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT template-varargs EMPTY> +<!ATTLIST template-varargs %boost.common.attrib;> + +<!ELEMENT specialization (template-arg)*> +<!ATTLIST specialization %boost.common.attrib;> + +<!ELEMENT template-arg ANY> +<!ATTLIST template-arg + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT default ANY> +<!ATTLIST default %boost.common.attrib;> + +<!ELEMENT inherit (type, purpose?)> +<!ATTLIST inherit + access CDATA #IMPLIED + pack CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT purpose ANY> +<!ATTLIST purpose %boost.common.attrib;> + +<!ELEMENT description ANY> +<!ATTLIST description %boost.common.attrib;> + +<!ELEMENT type ANY> +<!ATTLIST type %boost.common.attrib;> + +<!ELEMENT typedef (type, purpose?, description?)> +<!ATTLIST typedef + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT enum (enumvalue*, purpose?, description?)> +<!ATTLIST enum + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT enumvalue (default?, purpose?, description?)> +<!ATTLIST enumvalue + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT static-constant (type, default, purpose?, description?)> +<!ATTLIST static-constant + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT data-member (type, purpose?, description?)> +<!ATTLIST data-member + name CDATA #REQUIRED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT paramtype ANY> +<!ATTLIST paramtype %boost.common.attrib;> + +<!ELEMENT effects ANY> +<!ATTLIST effects %boost.common.attrib;> + +<!ELEMENT postconditions ANY> +<!ATTLIST postconditions %boost.common.attrib;> + +<!ELEMENT method-group (method|overloaded-method)*> +<!ATTLIST method-group + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT constructor (template?, parameter*, %boost.function.semantics;)> +<!ATTLIST constructor + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT destructor (%boost.function.semantics;)> +<!ATTLIST destructor + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT method (template?, type, parameter*, %boost.function.semantics;)> +<!ATTLIST method + name CDATA #REQUIRED + cv CDATA #IMPLIED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT function (template?, type, parameter*, %boost.function.semantics;)> +<!ATTLIST function + name CDATA #REQUIRED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT overloaded-method (signature*, %boost.function.semantics;)> +<!ATTLIST overloaded-method + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT overloaded-function (signature*, %boost.function.semantics;)> +<!ATTLIST overloaded-function + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT signature (template?, type, parameter*)> +<!ATTLIST signature + cv CDATA #IMPLIED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT requires ANY> +<!ATTLIST requires %boost.common.attrib;> + +<!ELEMENT returns ANY> +<!ATTLIST returns %boost.common.attrib;> + +<!ELEMENT throws ANY> +<!ATTLIST throws %boost.common.attrib;> + +<!ELEMENT complexity ANY> +<!ATTLIST complexity %boost.common.attrib;> + +<!ELEMENT notes ANY> +<!ATTLIST notes %boost.common.attrib;> + +<!ELEMENT rationale ANY> +<!ATTLIST rationale %boost.common.attrib;> + +<!ELEMENT functionname (#PCDATA)> +<!ATTLIST functionname + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT enumname (#PCDATA)> +<!ATTLIST enumname + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT macroname (#PCDATA)> +<!ATTLIST macroname + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT headername (#PCDATA)> +<!ATTLIST headername + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT globalname (#PCDATA)> +<!ATTLIST globalname + alt CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT copy-assignment + (template?, type?, parameter*, %boost.function.semantics;)> +<!ATTLIST copy-assignment + cv CDATA #IMPLIED + specifiers CDATA #IMPLIED + %boost.common.attrib;> + +<!ELEMENT free-function-group (function|overloaded-function)*> +<!ATTLIST free-function-group + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT precondition ANY> +<!ATTLIST precondition %boost.common.attrib;> + +<!ELEMENT code ANY> +<!ATTLIST code %boost.common.attrib;> + +<!ELEMENT using-namespace EMPTY> +<!ATTLIST using-namespace + name CDATA #REQUIRED + %boost.common.attrib;> + +<!ELEMENT using-class EMPTY> +<!ATTLIST using-class + name CDATA #REQUIRED + %boost.common.attrib;> + +<!--========== Boost Testsuite Extensions ==========--> +<!ENTITY % boost.testsuite.tests + "compile-test|link-test|run-test| + compile-fail-test|link-fail-test|run-fail-test"> +<!ENTITY % boost.testsuite.test.content + "source*, lib*, requirement*, purpose, if-fails?"> + +<!ELEMENT testsuite ((%boost.testsuite.tests;)+)> +<!ATTLIST testsuite %boost.common.attrib;> + +<!ELEMENT compile-test (%boost.testsuite.test.content;)> +<!ATTLIST compile-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT link-test (%boost.testsuite.test.content;)> +<!ATTLIST link-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT run-test (%boost.testsuite.test.content;)> +<!ATTLIST run-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT compile-fail-test (%boost.testsuite.test.content;)> +<!ATTLIST compile-fail-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT link-fail-test (%boost.testsuite.test.content;)> +<!ATTLIST link-fail-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT run-fail-test (%boost.testsuite.test.content;)> +<!ATTLIST run-fail-test + filename CDATA #REQUIRED + name CDATA #IMPLIED> + +<!ELEMENT source (#PCDATA|snippet)*> + +<!ELEMENT snippet EMPTY> +<!ATTLIST snippet + name CDATA #REQUIRED> + +<!ELEMENT lib (#PCDATA)> + +<!ELEMENT requirement (#PCDATA)> +<!ATTLIST requirement + name CDATA #REQUIRED> + +<!ELEMENT if-fails ANY> + +<!ELEMENT parameter (paramtype, default?, description?)> +<!ATTLIST parameter + name CDATA #IMPLIED + pack CDATA #IMPLIED> + +<!ELEMENT programlisting ANY> +<!ATTLIST programlisting + name CDATA #IMPLIED> + +<!--========== Customize the DocBook DTD ==========--> +<!ENTITY % local.tech.char.class "|functionname|libraryname|enumname|headername|macroname|code"> +<!ENTITY % local.para.class + "|using-namespace|using-class|librarylist|librarycategorylist"> +<!ENTITY % local.descobj.class "|libraryinfo"> +<!ENTITY % local.classname.attrib "alt CDATA #IMPLIED"> +<!ENTITY % local.methodname.attrib "alt CDATA #IMPLIED"> +<!ENTITY % local.refentry.class "|library-reference|testsuite"> +<!ENTITY % local.title.char.mix ""> +<!ENTITY % programlisting.module "IGNORE"> +<!ENTITY % parameter.module "IGNORE"> +<!ENTITY % function.module "IGNORE"> +<!ENTITY % type.module "IGNORE"> + +<!--========== Import DocBook DTD ==========--> +<!ENTITY % DocBook PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> + +%DocBook; diff --git a/src/boost/tools/boostbook/index.html b/src/boost/tools/boostbook/index.html new file mode 100644 index 000000000..5444113a7 --- /dev/null +++ b/src/boost/tools/boostbook/index.html @@ -0,0 +1,21 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="refresh" content= + "0; URL=../../doc/html/boostbook.html" /><!-- boostinspect:nolink --> + <!-- + Copyright 2006 Rene Rivera. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + --> + + <title></title> +</head> + +<body> + Automatic redirection failed, please go to <a href= + "../../doc/html/boostbook.html">../../doc/html/boostbook.html</a> +</body> +</html> diff --git a/src/boost/tools/boostbook/setup_boostbook.py b/src/boost/tools/boostbook/setup_boostbook.py new file mode 100644 index 000000000..032587d8a --- /dev/null +++ b/src/boost/tools/boostbook/setup_boostbook.py @@ -0,0 +1,300 @@ +# 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) + +# This is a rewrite of setup_boostbook.sh in Python +# It will work on Posix and Windows systems +# The rewrite is not finished yet, so please don't use it +# right now it is used only be release scripts + +# User configuration +# (MAINTANERS: please, keep in synch with setup_boostbook.sh) +DOCBOOK_XSL_VERSION = "1.75.2" +DOCBOOK_DTD_VERSION = "4.2" +FOP_VERSION = "0.94" +FOP_JDK_VERSION="1.4" +# FOP_MIRROR = "http://mirrors.ibiblio.org/pub/mirrors/apache/xmlgraphics/fop/binaries" +FOP_MIRROR = "http://archive.apache.org/dist/xmlgraphics/fop/binaries/" +SOURCEFORGE_DOWNLOAD = "http://sourceforge.net/projects/docbook/files" + +# No user configuration below this point------------------------------------- + +import os +import re +import sys +import optparse +import shutil + +sys.path.append( os.path.join( os.path.dirname( sys.modules[ __name__ ].__file__ ) + , "../regression/xsl_reports/utils" ) ) + +import checked_system +import urllib2 +import tarfile +import zipfile + +def accept_args( args ): + parser = optparse.OptionParser() + parser.add_option( "-t", "--tools", dest="tools", help="directory downloaded tools will be installed into. Optional. Used by release scripts to put the tools separately from the tree to be archived." ) + parser.usage = "setup_boostbook [options]" + + ( options, args ) = parser.parse_args( args ) + if options.tools is None: + options.tools = os.getcwd() + + + return options.tools + +def to_posix( path ): + return path.replace( "\\", "/" ) + +def unzip( archive_path, result_dir ): + z = zipfile.ZipFile( archive_path, 'r', zipfile.ZIP_DEFLATED ) + for f in z.infolist(): + print f.filename + if not os.path.exists( os.path.join( result_dir, os.path.dirname( f.filename ) ) ): + os.makedirs( os.path.join( result_dir, os.path.dirname( f.filename ) ) ) + result = open( os.path.join( result_dir, f.filename ), 'wb' ) + result.write( z.read( f.filename ) ) + result.close() + + z.close() + +def gunzip( archive_path, result_dir ): + tar = tarfile.open( archive_path, 'r:gz' ) + for tarinfo in tar: + tar.extract( tarinfo, result_dir ) + tar.close() + +def http_get( file, url ): + f = open( file, "wb" ) + f.write( urllib2.urlopen( url ).read() ) + f.close() + +def find_executable( executable_name, env_variable, test_args, error_message ): + print "Looking for %s ..." % executable_name + if os.environ.has_key( env_variable ): + specified = os.environ[ env_variable ] + print " Trying %s specified in env. variable %s" % ( specified, env_variable ) + if os.path.exists( specified ): + return specified.replace( "\\", "/" ) + else: + print "Cannot find %s specified in env. variable %s" % ( specified, env_variable ) + + rc = checked_system.system( [ "%s %s" % ( executable_name, test_args ) ] ) + print "" + if rc != 0: + print error_message + return None + else: + return executable_name.replace( "\\", "/" ) + +def adjust_user_config( config_file + , docbook_xsl_dir + , docbook_dtd_dir + , xsltproc + , doxygen + , fop + , java + ): + print "Modifying user-config.jam ..." + r = [] + using_boostbook = 0 + eaten=0 + lines = open( config_file, "r" ).readlines() + for line in lines: + if re.match( "^\s*using boostbook", line ): + using_boostbook = 1 + r.append( "using boostbook\n" ) + r.append( " : %s\n" % docbook_xsl_dir ) + r.append( " : %s\n" % docbook_dtd_dir ) + r.append( " ; \n" ) + eaten = 1 + + elif using_boostbook == 1 and re.match( ";", line ): + using_boostbook = 2 + elif using_boostbook == 1: + eaten=1 + elif re.match( "^\s*using xsltproc.*$", line ): + eaten=1 + elif re.match( "^\s*using doxygen.*$", line ): + eaten=1 + elif re.match( "^\s*using fop.*$", line ): + eaten=1 + else: + if eaten == 0: + r.append( line ) + eaten=0 + + if using_boostbook==0: + r.append( "using boostbook\n" ) + r.append( " : %s\n" % docbook_xsl_dir ) + r.append( " : %s\n" % docbook_dtd_dir ) + r.append( " ;\n" ) + + r.append( "using xsltproc : %s ;\n" % xsltproc ) + if doxygen is not None: + r.append( "using doxygen : %s ;\n" % doxygen ) + if fop is not None: + print r.append( "using fop : %s : : %s ;\n" % ( fop, java ) ) + + open( config_file + ".tmp", "w" ).writelines( r ) + try: + os.rename( config_file + ".tmp", config_file ) + except OSError, e: + os.unlink( config_file ) + os.rename( config_file + ".tmp", config_file ) + + +def setup_docbook_xsl( tools_directory ): + print "DocBook XSLT Stylesheets ..." + DOCBOOK_XSL_TARBALL = os.path.join( tools_directory, "docbook-xsl-%s.tar.gz" % DOCBOOK_XSL_VERSION ) + DOCBOOK_XSL_URL = "%s/docbook-xsl/%s/%s/download" % (SOURCEFORGE_DOWNLOAD, DOCBOOK_XSL_VERSION, os.path.basename( DOCBOOK_XSL_TARBALL ) ) + + if os.path.exists( DOCBOOK_XSL_TARBALL ): + print " Using existing DocBook XSLT Stylesheets (version %s)." % DOCBOOK_XSL_VERSION + else: + print " Downloading DocBook XSLT Stylesheets version %s..." % DOCBOOK_XSL_VERSION + print " from %s" % DOCBOOK_XSL_URL + http_get( DOCBOOK_XSL_TARBALL, DOCBOOK_XSL_URL ) + + DOCBOOK_XSL_DIR = to_posix( os.path.join( tools_directory, "docbook-xsl-%s" % DOCBOOK_XSL_VERSION ) ) + + if not os.path.exists( DOCBOOK_XSL_DIR ): + print " Expanding DocBook XSLT Stylesheets into %s..." % DOCBOOK_XSL_DIR + gunzip( DOCBOOK_XSL_TARBALL, tools_directory ) + print " done." + + return DOCBOOK_XSL_DIR + +def setup_docbook_dtd( tools_directory ): + print "DocBook DTD ..." + DOCBOOK_DTD_ZIP = to_posix( os.path.join( tools_directory, "docbook-xml-%s.zip" % DOCBOOK_DTD_VERSION ) ) + DOCBOOK_DTD_URL = "http://www.oasis-open.org/docbook/xml/%s/%s" % ( DOCBOOK_DTD_VERSION, os.path.basename( DOCBOOK_DTD_ZIP ) ) + if os.path.exists( DOCBOOK_DTD_ZIP ): + print " Using existing DocBook XML DTD (version %s)." % DOCBOOK_DTD_VERSION + else: + print " Downloading DocBook XML DTD version %s..." % DOCBOOK_DTD_VERSION + http_get( DOCBOOK_DTD_ZIP, DOCBOOK_DTD_URL ) + + DOCBOOK_DTD_DIR = to_posix( os.path.join( tools_directory, "docbook-dtd-%s" % DOCBOOK_DTD_VERSION ) ) + if not os.path.exists( DOCBOOK_DTD_DIR ): + print "Expanding DocBook XML DTD into %s... " % DOCBOOK_DTD_DIR + unzip( DOCBOOK_DTD_ZIP, DOCBOOK_DTD_DIR ) + print "done." + + return DOCBOOK_DTD_DIR + +def find_xsltproc(): + return to_posix( find_executable( "xsltproc", "XSLTPROC", "--version" + , "If you have already installed xsltproc, please set the environment\n" + + "variable XSLTPROC to the xsltproc executable. If you do not have\n" + + "xsltproc, you may download it from http://xmlsoft.org/XSLT/." ) ) + +def find_doxygen(): + return to_posix( find_executable( "doxygen", "DOXYGEN", "--version" + , "Warning: unable to find Doxygen executable. You will not be able to\n" + + " use Doxygen to generate BoostBook documentation. If you have Doxygen,\n" + + " please set the DOXYGEN environment variable to the path of the doxygen\n" + + " executable." ) ) + + +def find_java(): + return to_posix( find_executable( "java", "JAVA", "-version" + , "Warning: unable to find Java executable. You will not be able to\n" + + " generate PDF documentation. If you have Java, please set the JAVA\n" + + " environment variable to the path of the java executable." ) ) + +def setup_fop( tools_directory ): + print "FOP ..." + FOP_TARBALL = os.path.join( tools_directory, "fop-%s-bin-jdk%s.tar.gz" % ( FOP_VERSION, FOP_JDK_VERSION ) ) + FOP_URL = "%s/%s" % ( FOP_MIRROR, os.path.basename( FOP_TARBALL ) ) + FOP_DIR = to_posix( "%s/fop-%s" % ( tools_directory, FOP_VERSION ) ) + if sys.platform == 'win32': + fop_driver = "fop.bat" + else: + fop_driver = "fop" + + FOP = to_posix( os.path.join( FOP_DIR, fop_driver ) ) + + if os.path.exists( FOP_TARBALL ) : + print " Using existing FOP distribution (version %s)." % FOP_VERSION + else: + print " Downloading FOP distribution version %s..." % FOP_VERSION + http_get( FOP_TARBALL, FOP_URL ) + + if not os.path.exists( FOP_DIR ): + print " Expanding FOP distribution into %s... " % FOP_DIR + gunzip( FOP_TARBALL, tools_directory ) + print " done." + + return FOP + +def find_user_config(): + print "Looking for user-config.jam ..." + JAM_CONFIG_OUT = os.path.join( os.environ[ "HOME" ], "user-config.jam" ) + if os.path.exists( JAM_CONFIG_OUT ): + JAM_CONFIG_IN ="user-config-backup.jam" + print " Found user-config.jam in HOME directory (%s)" % JAM_CONFIG_IN + shutil.copyfile( JAM_CONFIG_OUT, os.path.join( os.environ[ "HOME" ], "user-config-backup.jam" ) ) + JAM_CONFIG_IN_TEMP="yes" + print " Updating Boost.Jam configuration in %s... " % JAM_CONFIG_OUT + return JAM_CONFIG_OUT + elif os.environ.has_key( "BOOST_ROOT" ) and os.path.exists( os.path.join( os.environ[ "BOOST_ROOT" ], "tools/build/user-config.jam" ) ): + JAM_CONFIG_IN=os.path.join( os.environ[ "BOOST_ROOT" ], "tools/build/user-config.jam" ) + print " Found user-config.jam in BOOST_ROOT directory (%s)" % JAM_CONFIG_IN + JAM_CONFIG_IN_TEMP="no" + print " Writing Boost.Jam configuration to %s... " % JAM_CONFIG_OUT + return JAM_CONFIG_IN + return None + +def setup_boostbook( tools_directory ): + print "Setting up boostbook tools..." + print "-----------------------------" + print "" + + DOCBOOK_XSL_DIR = setup_docbook_xsl( tools_directory ) + DOCBOOK_DTD_DIR = setup_docbook_dtd( tools_directory ) + XSLTPROC = find_xsltproc() + DOXYGEN = find_doxygen() + JAVA = find_java() + + FOP = None + if JAVA is not None: + print "Java is present." + FOP = setup_fop( tools_directory ) + + user_config = find_user_config() + + # Find the input jamfile to configure + + if user_config is None: + print "ERROR: Please set the BOOST_ROOT environment variable to refer to your" + print "Boost installation or copy user-config.jam into your home directory." + sys.exit() + + adjust_user_config( config_file = user_config + , docbook_xsl_dir = DOCBOOK_XSL_DIR + , docbook_dtd_dir = DOCBOOK_DTD_DIR + , xsltproc = XSLTPROC + , doxygen = DOXYGEN + , fop = FOP + , java = JAVA + ) + + print "done." + + print "Done! Execute \"b2\" in a documentation directory to generate" + print "documentation with BoostBook. If you have not already, you will need" + print "to compile Boost.Jam." + +def main(): + ( tools_directory ) = accept_args( sys.argv[ 1: ] ) + setup_boostbook( tools_directory ) + +if __name__ == "__main__": + main() + + diff --git a/src/boost/tools/boostbook/setup_boostbook.sh b/src/boost/tools/boostbook/setup_boostbook.sh new file mode 100755 index 000000000..54348361f --- /dev/null +++ b/src/boost/tools/boostbook/setup_boostbook.sh @@ -0,0 +1,181 @@ +#!/bin/sh +# 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) + +# User configuration +# (MAINTANERS: please, keep in synch with setup_boostbook.py) +DOCBOOK_XSL_VERSION=1.75.2 +DOCBOOK_DTD_VERSION=4.2 +FOP_VERSION=0.94 +FOP_JDK_VERSION=1.4 +# FOP_MIRROR=http://mirrors.ibiblio.org/pub/mirrors/apache/xmlgraphics/fop/binaries +FOP_MIRROR=http://archive.apache.org/dist/xmlgraphics/fop/binaries/ +SOURCEFORGE_DOWNLOAD=http://sourceforge.net/projects/docbook/files/ +HTTP_GET_CMD="curl -O -L" + +# No user configuration below this point------------------------------------- + +# Get the DocBook XSLT Stylesheets +DOCBOOK_XSL_TARBALL=docbook-xsl-$DOCBOOK_XSL_VERSION.tar.gz +DOCBOOK_XSL_URL=$SOURCEFORGE_DOWNLOAD/docbook-xsl/$DOCBOOK_XSL_VERSION/$DOCBOOK_XSL_TARBALL +if test -f $DOCBOOK_XSL_TARBALL; then + echo "Using existing DocBook XSLT Stylesheets (version $DOCBOOK_XSL_VERSION)." +else + echo "Downloading DocBook XSLT Stylesheets version $DOCBOOK_XSL_VERSION..." + $HTTP_GET_CMD $DOCBOOK_XSL_URL +fi + +DOCBOOK_XSL_DIR="$PWD/docbook-xsl-$DOCBOOK_XSL_VERSION" +if test ! -d docbook-xsl-$DOCBOOK_XSL_VERSION; then + echo -n "Expanding DocBook XSLT Stylesheets into $DOCBOOK_XSL_DIR..." + gunzip -cd $DOCBOOK_XSL_TARBALL | tar xf - + echo "done." +fi + +# Get the DocBook DTD +DOCBOOK_DTD_ZIP=docbook-xml-$DOCBOOK_DTD_VERSION.zip +DOCBOOK_DTD_URL=http://www.oasis-open.org/docbook/xml/$DOCBOOK_DTD_VERSION/$DOCBOOK_DTD_ZIP +if test -f $DOCBOOK_DTD_ZIP; then + echo "Using existing DocBook XML DTD (version $DOCBOOK_DTD_VERSION)." +else + echo "Downloading DocBook XML DTD version $DOCBOOK_DTD_VERSION..." + $HTTP_GET_CMD $DOCBOOK_DTD_URL +fi + +DOCBOOK_DTD_DIR="$PWD/docbook-dtd-$DOCBOOK_DTD_VERSION" +if test ! -d docbook-dtd-$DOCBOOK_DTD_VERSION; then + echo -n "Expanding DocBook XML DTD into $DOCBOOK_DTD_DIR... " + unzip -q $DOCBOOK_DTD_ZIP -d $DOCBOOK_DTD_DIR + echo "done." +fi + +# Find xsltproc, doxygen, and java +OLD_IFS=$IFS +IFS=: +for dir in $PATH; do + if test -f $dir/xsltproc && test -x $dir/xsltproc; then + XSLTPROC="$dir/xsltproc" + fi + if test -f $dir/doxygen && test -x $dir/doxygen; then + DOXYGEN="$dir/doxygen" + fi + if test -f $dir/java && test -x $dir/java; then + JAVA="$dir/java" + fi +done +IFS=$OLD_IFS + +# Make sure we have xsltproc +if test ! -f "$XSLTPROC" && test ! -x "$XSLTPROC"; then + echo "Searching for xsltproc... NOT FOUND."; + echo "ERROR: Unable to find xsltproc executable." + echo "If you have already installed xsltproc, please set the environment" + echo "variable XSLTPROC to the xsltproc executable. If you do not have" + echo "xsltproc, you may download it from http://xmlsoft.org/XSLT/." + exit 0; +else + echo "Searching for xsltproc... $XSLTPROC."; +fi + +# Just notify the user if we haven't found doxygen. +if test ! -f "$DOXYGEN" && test ! -x "$DOXYGEN"; then + echo "Searching for Doxygen... not found."; + echo "Warning: unable to find Doxygen executable. You will not be able to" + echo " use Doxygen to generate BoostBook documentation. If you have Doxygen," + echo " please set the DOXYGEN environment variable to the path of the doxygen" + echo " executable." + HAVE_DOXYGEN="no" +else + echo "Searching for Doxygen... $DOXYGEN."; + HAVE_DOXYGEN="yes" +fi + +# Just notify the user if we haven't found Java. Otherwise, go get FOP. +if test ! -f "$JAVA" && test ! -x "$JAVA"; then + echo "Searching for Java... not found."; + echo "Warning: unable to find Java executable. You will not be able to" + echo " generate PDF documentation. If you have Java, please set the JAVA" + echo " environment variable to the path of the java executable." + HAVE_FOP="no" +else + echo "Searching for Java... $JAVA."; + FOP_TARBALL="fop-$FOP_VERSION-bin-jdk$FOP_JDK_VERSION.tar.gz" + FOP_URL="$FOP_MIRROR/$FOP_TARBALL" + FOP_DIR="$PWD/fop-$FOP_VERSION" + FOP="$FOP_DIR/fop" + if test -f $FOP_TARBALL; then + echo "Using existing FOP distribution (version $FOP_VERSION)." + else + echo "Downloading FOP distribution version $FOP_VERSION..." + $HTTP_GET_CMD $FOP_URL + fi + + if test ! -d $FOP_DIR; then + echo -n "Expanding FOP distribution into $FOP_DIR... "; + gunzip -cd $FOP_TARBALL | tar xf - + echo "done."; + fi + HAVE_FOP="yes" +fi + +# Find the input jamfile to configure +JAM_CONFIG_OUT="$HOME/user-config.jam" +if test -r "$HOME/user-config.jam"; then + JAM_CONFIG_IN="user-config-backup.jam" + cp $JAM_CONFIG_OUT user-config-backup.jam + JAM_CONFIG_IN_TEMP="yes" + echo -n "Updating Boost.Jam configuration in $JAM_CONFIG_OUT... " + +elif test -r "$BOOST_ROOT/tools/build/user-config.jam"; then + JAM_CONFIG_IN="$BOOST_ROOT/tools/build/user-config.jam"; + JAM_CONFIG_IN_TEMP="no" + echo -n "Writing Boost.Jam configuration to $JAM_CONFIG_OUT... " +else + echo "ERROR: Please set the BOOST_ROOT environment variable to refer to your" + echo "Boost installation or copy user-config.jam into your home directory." + exit 0 +fi + +cat > setup_boostbook.awk <<EOF +BEGIN { using_boostbook = 0; eaten=0 } + +/^\s*using boostbook/ { + using_boostbook = 1; + print "using boostbook"; + print " : $DOCBOOK_XSL_DIR"; + print " : $DOCBOOK_DTD_DIR"; + eaten=1 +} + +using_boostbook==1 && /;/ { using_boostbook = 2 } +using_boostbook==1 { eaten=1 } + +/^\s*using xsltproc.*$/ { eaten=1 } +/^\s*using doxygen.*$/ { eaten=1 } +/^\s*using fop.*$/ { eaten=1 } + +/^.*$/ { if (eaten == 0) print; eaten=0 } + +END { + if (using_boostbook==0) { + print "using boostbook"; + print " : $DOCBOOK_XSL_DIR"; + print " : $DOCBOOK_DTD_DIR"; + print " ;" + } + print "using xsltproc : $XSLTPROC ;" + if ("$HAVE_DOXYGEN" == "yes") print "using doxygen : $DOXYGEN ;"; + if ("$HAVE_FOP" == "yes") print "using fop : $FOP : : $JAVA ;"; +} +EOF + +awk -f setup_boostbook.awk $JAM_CONFIG_IN > $JAM_CONFIG_OUT +rm -f setup_boostbook.awk +echo "done." + +echo "Done! Execute \"b2\" in a documentation directory to generate" +echo "documentation with BoostBook. If you have not already, you will need" +echo "to compile Boost.Jam." diff --git a/src/boost/tools/boostbook/test/Jamfile.v2 b/src/boost/tools/boostbook/test/Jamfile.v2 new file mode 100644 index 000000000..fc72f13bb --- /dev/null +++ b/src/boost/tools/boostbook/test/Jamfile.v2 @@ -0,0 +1,13 @@ +# Copyright (c) 2009 Daniel James +# +# 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) + +project /boost/boostbook/test ; +using boostbook ; + +boostbook alt : alt.xml : + <xsl:param>boost.root=../../../.. + ; + diff --git a/src/boost/tools/boostbook/test/alt.xml b/src/boost/tools/boostbook/test/alt.xml new file mode 100644 index 000000000..aed8a75f1 --- /dev/null +++ b/src/boost/tools/boostbook/test/alt.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- +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) +--> + +<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML//EN" + "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> + +<!-- + xmllint: + + XML_CATALOG_FILES=../../../bin.v2/boostbook_catalog.xml xmllint -noout -valid alt.xml + +--> + +<library name="Example" id="test.alt" dirname="test/alt"> + <libraryinfo> + <author> + <firstname>Daniel</firstname> + <surname>James</surname> + </author> + <librarypurpose>Fictional example</librarypurpose> + </libraryinfo> + + <title>Fictional example library, for testing</title> + + <section id="test.alt.tests"> + <title>Alt Tests</title> + + <para><headername alt="example.hpp">Example header</headername></para> + <para>Example header: <headername>example.hpp</headername></para> + + <para><macroname alt="EXAMPLE">Example macro</macroname></para> + <para>Example macro: <macroname>EXAMPLE</macroname></para> + </section> + + <library-reference> + <header name="example.hpp"> + <macro name="EXAMPLE" kind="functionlike"> + <purpose>Example macro</purpose> + </macro> + </header> + </library-reference> +</library> diff --git a/src/boost/tools/boostbook/test/doxygen/Jamfile.v2 b/src/boost/tools/boostbook/test/doxygen/Jamfile.v2 new file mode 100644 index 000000000..d9f34f046 --- /dev/null +++ b/src/boost/tools/boostbook/test/doxygen/Jamfile.v2 @@ -0,0 +1,41 @@ + +# Copyright 2009 Daniel James. +# 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) + +using boostbook ; +using doxygen ; +import os ; + +doxygen autodoc + : + [ glob boost/*.hpp ] + : + <xsl:param>"boost.doxygen.reftitle=Example Reference" + ; + +if [ os.name ] = NT +{ + actions compare + { + comp /A $(>[1]) $(>[2]) && echo "Stamped" >$(<) + } + +} +else +{ + actions compare + { + diff -u -w $(>[1]) $(>[2]) && echo "Stamped" >$(<) + } +} + +make check : autodoc.xml autodoc.gold : @compare ; + +boostbook standalone + : + example.xml + : + <xsl:param>boost.root=../../../../.. + <dependency>autodoc + ; diff --git a/src/boost/tools/boostbook/test/doxygen/autodoc.gold b/src/boost/tools/boostbook/test/doxygen/autodoc.gold new file mode 100644 index 000000000..58434b12f --- /dev/null +++ b/src/boost/tools/boostbook/test/doxygen/autodoc.gold @@ -0,0 +1,113 @@ +<?xml version="1.0" standalone="yes"?> +<library-reference id="example_reference"><title>Example Reference</title><header name="boost/example.hpp"> +<namespace name="example"> +<class name="example"><purpose>Documentation for class example. </purpose><description><para>Detailed documentation</para><para><programlisting language="c++">void class_code_sample(); +</programlisting> </para></description><class name="inner_class"><data-member name="x"><type>int</type></data-member> +</class><enum name="class_enum"><enumvalue name="enumerator"/></enum> +<typedef name="documented_type1"><description><para>This type has documentation. </para></description><type>int</type></typedef> +<typedef name="documented_type2"><purpose>This type has documentation. </purpose><type>long</type></typedef> +<typedef name="documented_type3"><description><para>This type has documentation. </para></description><type>long double</type></typedef> +<typedef name="undocumented_type1"><type>short</type></typedef> +<typedef name="undocumented_type2"><type>double</type></typedef> +<data-member name="integer"><type>int</type></data-member> +<data-member name="mutable_integer" specifiers="mutable"><type>int</type></data-member> +<data-member name="const_integer"><type>const int</type></data-member> +<data-member name="static_integer" specifiers="static"><type>int</type></data-member> +<data-member name="static_const_integer" specifiers="static"><type>const int</type></data-member> +<method-group name="public member functions"> +<method name="virtual_method" specifiers="virtual"><type>int</type></method> +<method name="virtual_abstract_method" cv="= 0" specifiers="virtual"><type>int</type></method> +<method name="virtual_const_method" cv="const" specifiers="virtual"><type>int</type></method> +<method name="method_with_default_value"><type>int</type><parameter name=""><paramtype>int</paramtype><default>default_value</default></parameter></method> +<method name="method_with_fp"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="method_with_string_default1"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="method_with_string_default2"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="method_with_char_default1"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="method_with_char_default2"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="volatile_method_with_fp" cv="volatile"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="volatile_method_with_string_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="volatile_method_with_string_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="volatile_method_with_char_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="volatile_method_with_char_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method> +<method name="const_method" cv="const"><type>void</type></method> +<method name="volatile_method" cv="volatile"><type>void</type></method> +<method name="trad_noexcept" cv="noexcept"><type>void</type></method> +<method name="trad_noexcept_if" cv="noexcept(a==b &&(c||d)))"><type>void</type></method> +<method name="boost_noexcept" cv="noexcept"><type>void</type></method> +<method name="boost_noexcept_if" cv="noexcept(condition)"><type>void</type></method> +<method name="trad_constexpr" cv="constexpr"><type>void</type></method> +<method name="boost_constexpr" cv="constexpr"><type>void</type></method> +<method name="boost_constexpr_or_const" cv="constexpr"><type>void</type></method> +<method name="constexpr_noexcept" cv="constexpr noexcept"><type>void</type></method> +<method name="conversion-operator" specifiers="explicit"><type>int</type></method> +</method-group> +<constructor cv="= default"><parameter name=""><paramtype><classname>example</classname> const &</paramtype></parameter></constructor> +<copy-assignment cv="= delete"><type><classname>example</classname> &</type><parameter name=""><paramtype><classname>example</classname> const &</paramtype></parameter></copy-assignment> +<method-group name="public static functions"> +<method name="static_method" specifiers="static"><type>int</type></method> +<method name="static_constexpr" cv="constexpr" specifiers="static"><type>int</type></method> +</method-group> +</class><struct name="example_template"><template> + <template-type-parameter name="TypeParameter"><purpose><para>A template parameter </para></purpose></template-type-parameter> + <template-nontype-parameter name="NonTypeParameter"><type>int</type><purpose><para>This is a non-type template parameter </para></purpose></template-nontype-parameter> + <template-type-parameter name="TypeParameterWithDefault"><default>int</default><purpose><para>This is a template parameter with a default argument </para></purpose></template-type-parameter> + </template><description><para>Test some doxygen markup</para><para><warning><para>This is just an example.</para></warning> +Embedded docbook list:</para><para> +<orderedlist><listitem><simpara>1</simpara></listitem><listitem><simpara>2</simpara></listitem></orderedlist> +</para><para><emphasis>Special</emphasis> <emphasis role="bold">Bold</emphasis> <computeroutput>Typewriter</computeroutput> <emphasis>Italics</emphasis> <emphasis>emphasis</emphasis> <computeroutput>parameter</computeroutput> </para><para><itemizedlist> +<listitem><para>Arg1 first argument. </para></listitem> +<listitem><para>Arg2 second argument.</para></listitem> +</itemizedlist> +<itemizedlist> +<listitem><para>First list item. </para></listitem> +<listitem><para>Second list item</para></listitem> +</itemizedlist> +Line 1<sbr/> +Line 2</para><para><programlisting language="c++">void foo() {} +void foo2() {} +</programlisting></para><para><programlisting language="c++">void bar() {} + +void bar2() {} +</programlisting></para><para>Alternative way of writing code, has a complicated workaround because doxygen treats the empty line as a paragraph separator:</para><programlisting> +int bar(); + +int bar2(); +</programlisting><para>Unfortunately the workaround will merge consecutive blocks, like this:</para><programlisting> +int foo(); + + + +int foo2(); +</programlisting><para> +</para></description></struct><struct name="specialization_test"><template> + <template-type-parameter name="T"/> + </template></struct><struct-specialization name="specialization_test"><template> + <template-type-parameter name="T"/> + </template><specialization><template-arg>T *</template-arg></specialization><method-group name="public member functions"> +</method-group> +<constructor><description><para>A constructor. </para></description></constructor> +<destructor><description><para>A destructor. </para></description></destructor> +<copy-assignment><type><emphasis>unspecified</emphasis></type><parameter name=""><paramtype>const <classname>specialization_test</classname> &</paramtype></parameter><description><para>An assignment operator. </para></description></copy-assignment> +</struct-specialization><enum name="namespace_enum"><enumvalue name="enumerator"/></enum> +<data-member name="namespace_integer"><type>int</type></data-member> +<data-member name="namespace_static_integer" specifiers="static"><type>int</type></data-member> +<data-member name="namespace_const_integer"><type>const int</type></data-member> +<data-member name="namespace_static_const_integer" specifiers="static"><type>const int</type></data-member> +<function name="free_function"><type>void</type><parameter name="x"><paramtype>int</paramtype><description><para>Parameter description.</para></description></parameter><description><para> +<programlisting language="c++">void function_code_sample(); +</programlisting> </para></description></function> +<function name="namespace_func"><type>int</type><parameter name="i"><paramtype>int</paramtype><description><para>A function parameter </para></description></parameter><parameter name="j"><paramtype>int</paramtype><description><para>Another </para></description></parameter><description><para> + + +This is a test function. <classname alt="example::example">Link to class</classname> <classname alt="example::example_template">Link to class template</classname> <note><para>This is a note.</para></note> +<para><emphasis role="bold">See Also:</emphasis><para><classname alt="example::example">example::example</classname> and <classname alt="example::example_template">example_template</classname> </para></para> +</para></description><requires><para>i > j</para></requires><returns><para>The answer </para></returns></function> +<function name="namespace_func_template"><type>void</type><template> + <template-type-parameter name="TypeParameter"><purpose><para>A template parameter </para></purpose></template-type-parameter> + <template-nontype-parameter name="NonTypeParameter"><type>int</type><purpose><para>This is a non-type template parameter </para></purpose></template-nontype-parameter> + </template><description><para>Testing a function template. +</para></description></function> +</namespace> +<macro name="EXAMPLE" kind="functionlike"><macro-parameter name="m"/><purpose>Documentation for macro example. </purpose></macro> +</header> +</library-reference>
\ No newline at end of file diff --git a/src/boost/tools/boostbook/test/doxygen/boost/example.hpp b/src/boost/tools/boostbook/test/doxygen/boost/example.hpp new file mode 100644 index 000000000..9b32da0bd --- /dev/null +++ b/src/boost/tools/boostbook/test/doxygen/boost/example.hpp @@ -0,0 +1,233 @@ + +// Copyright 2009 Daniel James. +// 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) + +/*! + \class example::example + + \brief Documentation for class example + + Detailed documentation + + \code{.cpp} + void class_code_sample(); + \endcode + */ + +/*! + \def EXAMPLE + + \brief Documentation for macro example + */ + +int global_integer; +static int global_static_integer; +const int global_const_integer = 1; +static const int global_static_const_integer = 2; +enum global_enum { enumerator1 = 1, enumerator2 }; + +namespace example +{ + /*! + + \param x Parameter description. + + \code{.cpp} + void function_code_sample(); + \endcode + */ + void free_function(int x); + + int namespace_integer; + static int namespace_static_integer; + const int namespace_const_integer = 1; + static const int namespace_static_const_integer = 2; + enum namespace_enum { enumerator }; + + class example + { + public: + example(example const&) = default; + example& operator=(example const&) = delete; + virtual int virtual_method(); + virtual int virtual_abstract_method() = 0; + virtual int virtual_const_method() const; + int method_with_default_value(int = default_value); + + int method_with_fp(int (*fp)(), volatile char); + int method_with_string_default1(char* = ")", volatile char); + int method_with_string_default2(char* = "(", volatile char); + int method_with_char_default1(char = '(', volatile char); + int method_with_char_default2(char = ')', volatile char); + + int volatile_method_with_fp(int (*fp)(), volatile char) volatile; + int volatile_method_with_string_default1(char* = ")", volatile char) volatile; + int volatile_method_with_string_default2(char* = "(", volatile char) volatile; + int volatile_method_with_char_default1(char = '(', volatile char) volatile; + int volatile_method_with_char_default2(char = ')', volatile char) volatile; + + void const_method() const; + void volatile_method() volatile; + + void trad_noexcept() noexcept; + void trad_noexcept_if() noexcept(a == b && (c || d)); + void boost_noexcept() BOOST_NOEXCEPT; + void boost_noexcept_if() BOOST_NOEXCEPT_IF(a == b && (c || d)); + + void trad_constexpr() constexpr; + void boost_constexpr() BOOST_CONSTEXPR; + void boost_constexpr_or_const() BOOST_CONSTEXPR_OR_CONST; + + void constexpr_noexcept() constexpr noexcept; + + static int static_method(); + static int static_constexpr() constexpr; + + int integer; + static int static_integer; + mutable int mutable_integer; + const int const_integer; + static const int static_const_integer; + + // Visual check of typedef alignment. + /** This type has documentation. */ + typedef int documented_type1; + /** \brief This type has documentation. */ + typedef long documented_type2; + /** This type has documentation. */ + typedef long double documented_type3; + typedef short undocumented_type1; + typedef double undocumented_type2; + + class inner_class { + public: + int x; + }; + + enum class_enum { enumerator }; + + /// INTERNAL ONLY + enum internal_enum { internal_enumerator }; + + explicit operator int(); + protected: + int protected_integer; + static int protected_static_integer; + mutable int protected_mutable_integer; + const int protected_const_integer; + static const int protected_static_const_integer; + + enum protected_class_enum { enumerator2 }; + private: + int private_integer; + static int private_static_integer; + mutable int private_mutable_integer; + const int private_const_integer; + static const int private_static_const_integer; + + enum private_class_enum { enumerator3 }; + }; + + /** + * Test some doxygen markup + * + * \warning This is just an example. + * + * Embedded docbook list: + * + * \xmlonly + * <orderedlist><listitem><simpara>1</simpara></listitem><listitem><simpara>2</simpara></listitem></orderedlist> + * \endxmlonly + * + * \a Special \b Bold \c Typewriter \e Italics \em emphasis \p parameter + * + * \arg Arg1 first argument. + * \arg Arg2 second argument. + * + * \li First list item. + * \li Second list item + * + * Line 1\n + * Line 2 + * + * \code + * void foo() {} + * void foo2() {} + * \endcode + * + * \code + * void bar() {} + * + * void bar2() {} + * \endcode + * + * Alternative way of writing code, has a complicated workaround + * because doxygen treats the empty line as a paragraph + * separator: + * + * <pre> + * int bar(); + * + * int bar2(); + * </pre> + * + * Unfortunately the workaround will merge consecutive blocks, + * like this: + * + * <pre> + * int foo(); + * </pre> + * + * <pre> + * int foo2(); + * </pre> + * + * \tparam TypeParameter A template parameter + * \tparam NonTypeParameter This is a non-type template parameter + * \tparam TypeParameterWithDefault This is a template parameter with a default argument + */ + + template <typename TypeParameter, int NonTypeParameter, + typename TypeParameterWithDefault = int> + struct example_template {}; + + /** + * \param i A function parameter + * \param j Another + * \return The answer + * \pre i > j + * + * This is a test function. + * \ref example::example "Link to class" + * \ref example_template "Link to class template" + * \note This is a note. + * + * \see example::example and example_template + */ + int namespace_func(int i, int j); + + /** + * Testing a function template. + * \tparam TypeParameter A template parameter + * \tparam NonTypeParameter This is a non-type template parameter + */ + template <typename TypeParameter, int NonTypeParameter> + void namespace_func_template(); + + template<class T> + struct specialization_test { + }; + + template<class T> + struct specialization_test<T*> { + /** A constructor. */ + specialization_test(); + /** A destructor. */ + ~specialization_test(); + /** An assignment operator. */ + detail::unspecified& operator=(const specialization_test&); + }; +} + +#define EXAMPLE(m) The macro diff --git a/src/boost/tools/boostbook/test/doxygen/example.xml b/src/boost/tools/boostbook/test/doxygen/example.xml new file mode 100644 index 000000000..1858ce4c8 --- /dev/null +++ b/src/boost/tools/boostbook/test/doxygen/example.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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) +--> + +<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> +<library id="example" name="Example" dirname="example" xmlns:xi="http://www.w3.org/2001/XInclude"> +<title>Example</title> +<xi:include href="autodoc.xml" /> +</library> diff --git a/src/boost/tools/boostbook/xsl/admon.xsl b/src/boost/tools/boostbook/xsl/admon.xsl new file mode 100644 index 000000000..d29053ac1 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/admon.xsl @@ -0,0 +1,36 @@ +<?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" + version="1.0"> + +<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/admon.xsl"/> + +<!-- Already included in the main style sheet --> +<!-- <xsl:import href="relative-href.xsl"/> --> + +<xsl:template name="admon.graphic"> + <xsl:param name="node" select="."/> + + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$admon.graphics.path"/> + </xsl:call-template> + + <xsl:choose> + <xsl:when test="local-name($node)='note'">note</xsl:when> + <xsl:when test="local-name($node)='warning'">warning</xsl:when> + <xsl:when test="local-name($node)='caution'">caution</xsl:when> + <xsl:when test="local-name($node)='tip'">tip</xsl:when> + <xsl:when test="local-name($node)='important'">important</xsl:when> + <xsl:otherwise>note</xsl:otherwise> + </xsl:choose> + + <xsl:value-of select="$admon.graphics.extension"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/annotation.xsl b/src/boost/tools/boostbook/xsl/annotation.xsl new file mode 100644 index 000000000..1d9b79e60 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/annotation.xsl @@ -0,0 +1,453 @@ +<?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" + version="1.0"> + <xsl:variable name="uppercase-letters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> + <xsl:variable name="lowercase-letters" select="'abcdefghijklmnopqrstuvwxyz'"/> + + <xsl:key name="classes" match="class|struct|union|typedef" use="@name"/> + <xsl:key name="methods" match="method|overloaded-method" use="@name"/> + <xsl:key name="functions" match="function|overloaded-function" use="@name"/> + <xsl:key name="enums" match="enum" use="@name"/> + <xsl:key name="concepts" match="concept" use="@name"/> + <xsl:key name="libraries" match="library" use="@name"/> + <xsl:key name="macros" match="macro" use="@name"/> + <xsl:key name="headers" match="header" use="@name"/> + <xsl:key name="globals" match="namespace/data-member|header/data-member" use="@name"/> + <xsl:key name="named-entities" + match="class|struct|union|concept|function|overloaded-function|macro|library|namespace/data-member|header/data-member|*[attribute::id]" + use="translate(@name|@id, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')"/> + + <xsl:template match="function|overloaded-function" mode="generate.id"> + <xsl:call-template name="fully-qualified-id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="classname" mode="annotation"> + <!-- Determine the (possibly qualified) class name we are looking for --> + <xsl:variable name="fullname"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Strip off any instantiation --> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="contains($fullname, '<')"> + <xsl:value-of select="substring-before($fullname, '<')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fullname"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Determine the unqualified name --> + <xsl:variable name="unqualified-name"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:call-template name="cxx-link-name"> + <xsl:with-param name="lookup" select="."/> + <xsl:with-param name="type" select="'class'"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="display-name" select="string(.)"/> + <xsl:with-param name="unqualified-name" select="$unqualified-name"/> + <xsl:with-param name="nodes" select="key('classes', $unqualified-name)"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="globalname" mode="annotation"> + <!-- Determine the (possibly qualified) global name we are looking for --> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Determine the unqualified name --> + <xsl:variable name="unqualified-name"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:call-template name="cxx-link-name"> + <xsl:with-param name="lookup" select="."/> + <xsl:with-param name="type" select="'data-member'"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="display-name" select="string(.)"/> + <xsl:with-param name="unqualified-name" select="$unqualified-name"/> + <xsl:with-param name="nodes" select="key('globals', $unqualified-name)"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="methodname" mode="annotation"> + <!-- Determine the (possibly qualified) method name we are looking for --> + <xsl:variable name="fullname"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Strip off any call --> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="contains($fullname, 'operator()')"> + <xsl:value-of select="substring-before($fullname, 'operator()')"/> + <xsl:value-of select="'operator()'"/> + </xsl:when> + <xsl:when test="contains($fullname, '(')"> + <xsl:value-of select="substring-before($fullname, '(')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fullname"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Determine the unqualified name --> + <xsl:variable name="unqualified-name"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:call-template name="cxx-link-name"> + <xsl:with-param name="lookup" select="."/> + <xsl:with-param name="type" select="'method'"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="display-name" select="string(.)"/> + <xsl:with-param name="unqualified-name" select="$unqualified-name"/> + <xsl:with-param name="nodes" select="key('methods', $unqualified-name)"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="functionname" mode="annotation"> + <!-- Determine the (possibly qualified) function name we are + looking for --> + <xsl:variable name="fullname"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Strip off any call --> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="contains($fullname, '(')"> + <xsl:value-of select="substring-before($fullname, '(')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fullname"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Determine the unqualified name --> + <xsl:variable name="unqualified-name"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:call-template name="cxx-link-name"> + <xsl:with-param name="lookup" select="."/> + <xsl:with-param name="type" select="'function'"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="display-name" select="string(.)"/> + <xsl:with-param name="unqualified-name" select="$unqualified-name"/> + <xsl:with-param name="nodes" + select="key('functions', $unqualified-name)"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="enumname" mode="annotation"> + <!-- Determine the (possibly qualified) enum name we are + looking for --> + <xsl:variable name="fullname"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Strip off any call --> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="contains($fullname, '(')"> + <xsl:value-of select="substring-before($fullname, '(')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$fullname"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Determine the unqualified name --> + <xsl:variable name="unqualified-name"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:variable> + + <xsl:call-template name="cxx-link-name"> + <xsl:with-param name="lookup" select="."/> + <xsl:with-param name="type" select="'enum'"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="display-name" select="string(.)"/> + <xsl:with-param name="unqualified-name" select="$unqualified-name"/> + <xsl:with-param name="nodes" + select="key('enums', $unqualified-name)"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="libraryname" mode="annotation"> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="text()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="node" select="key('libraries', $name)"/> + + <xsl:choose> + <xsl:when test="count($node)=0"> + <xsl:message> + <xsl:text>warning: Cannot find library '</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>'</xsl:text> + </xsl:message> + <xsl:value-of select="$name"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="library.link"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="name" select="text()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="conceptname" mode="annotation"> + <xsl:param name="name" select="text()"/> + + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="macroname" mode="annotation"> + <xsl:param name="name"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + + <xsl:variable name="node" select="key('macros', $name)"/> + <xsl:choose> + <xsl:when test="count($node) = 0"> + <xsl:message> + <xsl:text>warning: cannot find macro `</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>'</xsl:text> + </xsl:message> + <xsl:value-of select="$name"/> + </xsl:when> + + <xsl:when test="count($node) = 1"> + <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="string(.)"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <xsl:message> + <xsl:text>error: macro `</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>' is multiply defined.</xsl:text> + </xsl:message> + <xsl:value-of select="$node"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="headername" mode="annotation"> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="@alt"> + <xsl:value-of select="@alt"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="node" select="key('headers', $name)"/> + <xsl:choose> + <xsl:when test="count($node) = 0"> + <xsl:message> + <xsl:text>warning: cannot find header `</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>'</xsl:text> + </xsl:message> + <xsl:value-of select="$name"/> + </xsl:when> + + <xsl:when test="count($node) = 1"> + <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="string(.)"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <xsl:message> + <xsl:text>error: header `</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>' is multiply defined.</xsl:text> + </xsl:message> + <xsl:value-of select="$node"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="text()" mode="annotation"> + <xsl:param name="highlight" select="false()"/> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </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"/> + </computeroutput> + </xsl:template> + + <xsl:template match="code[@language='jam']" mode="annotation"> + <computeroutput> + <xsl:apply-templates mode="annotation"/> + </computeroutput> + </xsl:template> + + <xsl:template match="code[@language='c++']" mode="annotation"> + <computeroutput> + <xsl:apply-templates mode="annotation"> + <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> + </computeroutput> + </xsl:template> + + <xsl:template match="bold" mode="annotation"> + <emphasis role="bold"> + <xsl:apply-templates mode="annotation"/> + </emphasis> + </xsl:template> + + <xsl:template match="description" mode="annotation"> + <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> + + <xsl:template match="node()" mode="annotation"> + <xsl:param name="highlight" select="false()"/> + + <xsl:element name="{name(.)}"> + <xsl:copy-of select="./@*"/> + <xsl:apply-templates select="./*|./text()" mode="annotation"> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:apply-templates> + </xsl:element> + </xsl:template> + + <!-- The "purpose" mode strips simpara/para elements so that we can + place the resulting text into a comment in the synopsis. --> + <xsl:template match="para|simpara" mode="purpose"> + <xsl:apply-templates mode="annotation"/> + </xsl:template> + + <xsl:template match="*" mode="purpose"> + <xsl:apply-templates select="." mode="annotation"/> + </xsl:template> + + <xsl:template match="text()" mode="purpose"> + <xsl:apply-templates select="." mode="annotation"/> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/callout.xsl b/src/boost/tools/boostbook/xsl/callout.xsl new file mode 100644 index 000000000..8faa5340b --- /dev/null +++ b/src/boost/tools/boostbook/xsl/callout.xsl @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (c) 2007 Joel de Guzman <djowel -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" + version="1.0"> + +<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/callout.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'/> + + <xsl:choose> + <xsl:when test="$callout.graphics != 0 + and $conum <= $callout.graphics.number.limit"> + + <xsl:variable name="relative_callout_graphics_path"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$callout.graphics.path"/> + </xsl:call-template> + </xsl:variable> + + <img src="{$relative_callout_graphics_path}{$conum}{$callout.graphics.extension}" + alt="{$conum}" border="0"/> + </xsl:when> + + <xsl:when test="$callout.unicode != 0 + and $conum <= $callout.unicode.number.limit"> + <xsl:choose> + <xsl:when test="$callout.unicode.start.character = 10102"> + <xsl:choose> + <xsl:when test="$conum = 1">❶</xsl:when> + <xsl:when test="$conum = 2">❷</xsl:when> + <xsl:when test="$conum = 3">❸</xsl:when> + <xsl:when test="$conum = 4">❹</xsl:when> + <xsl:when test="$conum = 5">❺</xsl:when> + <xsl:when test="$conum = 6">❻</xsl:when> + <xsl:when test="$conum = 7">❼</xsl:when> + <xsl:when test="$conum = 8">❽</xsl:when> + <xsl:when test="$conum = 9">❾</xsl:when> + <xsl:when test="$conum = 10">❿</xsl:when> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>Don't know how to generate Unicode callouts </xsl:text> + <xsl:text>when $callout.unicode.start.character is </xsl:text> + <xsl:value-of select="$callout.unicode.start.character"/> + </xsl:message> + <xsl:text>(</xsl:text> + <xsl:value-of select="$conum"/> + <xsl:text>)</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:text>(</xsl:text> + <xsl:value-of select="$conum"/> + <xsl:text>)</xsl:text> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/caramel/LICENSE b/src/boost/tools/boostbook/xsl/caramel/LICENSE new file mode 100644 index 000000000..d26de04a0 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/caramel/LICENSE @@ -0,0 +1,58 @@ +Software License, Version 1.0 + +Copyright 2002-2003, Trustees of Indiana University. +Copyright 2000-2001, University of Notre Dame. +All rights reserved. + +Indiana University has the exclusive rights to license this product under the +following license. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * All redistributions of source code must retain the above copyright notice, + the list of authors in the original source code, this list of conditions + and the disclaimer listed in this license; + + * All redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the disclaimer listed in this license + in the documentation and/or other materials provided with the distribution; + + * Any documentation included with all redistributions must include the + following acknowledgement: + + "This product includes software developed at the University of Notre Dame + and the Pervasive Technology Labs at Indiana University. For technical + information contact Andrew Lumsdaine at the Pervasive Technology Labs at + Indiana University. For administrative and license questions contact the + Advanced Research and Technology Institute at 351 West 10th Street. + Indianapolis, Indiana 46202, phone 317-278-4100, fax 317-274-5902." + + Alternatively, this acknowledgement may appear in the software itself, and + wherever such third-party acknowledgments normally appear. + + * The name Indiana University, the University of Notre Dame or "Caramel" + shall not be used to endorse or promote products derived from this software + without prior written permission from Indiana University. For written + permission, please contact Indiana University Advanced Research & + Technology Institute. + + * Products derived from this software may not be called "Caramel", nor may + Indiana University, the University of Notre Dame or "Caramel" appear in + their name, without prior written permission of Indiana University Advanced + Research & Technology Institute. + +Indiana University provides no reassurances that the source code provided does +not infringe the patent or any other intellectual property rights of any other +entity. Indiana University disclaims any liability to any recipient for claims +brought by any other entity based on infringement of intellectual property +rights or otherwise. + +LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO WARRANTIES +AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES NO WARRANTIES +AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF INFRINGEMENT OF THIRD +PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES +NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", +"TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE RISK +AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS, AND TO THE +PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING SOFTWARE. diff --git a/src/boost/tools/boostbook/xsl/caramel/concept2docbook.xsl b/src/boost/tools/boostbook/xsl/caramel/concept2docbook.xsl new file mode 100644 index 000000000..655498066 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/caramel/concept2docbook.xsl @@ -0,0 +1,812 @@ +<?xml version="1.0" ?> + +<!-- +Copyright (c) 2002-2003 The Trustees of Indiana University. + All rights reserved. +Copyright (c) 2000-2001 University of Notre Dame. All rights reserved. + + 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" version="1.0"> + <xsl:strip-space elements="* xsl:*"/> + + <xsl:include href="unparser.xsl"/> + + <xsl:key name="concepts" match="concept" use="@name"/> + + <!-- The layout type to use for concept descriptions. Can be one of: + sgi: simulate the SGI STL documentation + austern: simulate the documentation in Generic Programming and the STL, + by Matthew H. Austern + caramel: simulate the formatting from Caramel + --> + <xsl:param name="boost.concept.layout" select="'austern'"/> + + <xsl:template match="concept"> + <refentry> + <xsl:attribute name="id"> + <xsl:call-template name="generate.id"/> + </xsl:attribute> + + <refmeta> + <refentrytitle>Concept <xsl:value-of select="@name"/></refentrytitle> + <manvolnum>7</manvolnum> + </refmeta> + + <refnamediv> + <refname><xsl:value-of select="@name"/></refname> + <xsl:if test="purpose"> + <refpurpose> + <xsl:apply-templates select="purpose/*|purpose/text()"/> + </refpurpose> + </xsl:if> + </refnamediv> + + <!-- + <refentryinfo> + <xsl:for-each select="copyright | copyright-include | legalnotice"> + <xsl:choose> + <xsl:when test="name(.)='copyright'"> + <copyright><xsl:copy-of select="./node()"/></copyright> + </xsl:when> + <xsl:when test="name(.)='legalnotice'"> + <legalnotice><xsl:copy-of select="./node()"/></legalnotice> + </xsl:when> + <xsl:when test="name(.)='copyright-include'"> + <copyright><xsl:copy-of select="document(concat('../concepts/', @file))/copyright/node()"/></copyright> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </refentryinfo> +--> + + <xsl:if test="description"> + <xsl:if test="description"> + <refsect1> + <title>Description</title> + <xsl:for-each select="description"> + <xsl:apply-templates/> + </xsl:for-each> + </refsect1> + </xsl:if> + </xsl:if> + + <xsl:if test="refines | refines-when-mutable"> + <refsect1> + <title>Refinement of</title> + <itemizedlist> + <xsl:if test="refines"> + <xsl:for-each select="refines"> + <listitem> + <para> + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" select="@concept"/> + </xsl:call-template> + </para> + </listitem> + </xsl:for-each> + </xsl:if> + <xsl:if test="refines-when-mutable"> + <xsl:for-each select="refines-when-mutable"> + <listitem> + <para> + <xsl:text>When mutable: </xsl:text> + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" select="@concept"/> + </xsl:call-template> + </para> + </listitem> + </xsl:for-each> + </xsl:if> + </itemizedlist> + </refsect1> + </xsl:if> + + <!-- This part must be run even if there are no associated types to print out, so the hidden type definitions can be found --> + <xsl:variable name="definition_list"> + <xsl:call-template name="make-definition-list"> + <xsl:with-param name="typedefs" select="define-type | associated-type"/> + <xsl:with-param name="definition_list"> + <xsl:for-each select="param/@name"> + @(@<xsl:value-of select="."/>=<xsl:value-of select="."/>@)@ + </xsl:for-each> + </xsl:with-param> + </xsl:call-template> + </xsl:variable> + + <!-- <xsl:message>Definition list: <xsl:value-of select="$definition_list"/></xsl:message> --> + + <xsl:call-template name="print-associated-types"> + <xsl:with-param name="typedefs" select="associated-type"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + </xsl:call-template> + + <xsl:call-template name="concept.notation"> + <xsl:with-param name="definition_list" select="$definition_list"/> + </xsl:call-template> + + <xsl:variable name="notations"> + <xsl:for-each select="notation"> + @@(@@<xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="*[1]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="ignore-cv" select="true()"/> + <xsl:with-param name="ignore-references" select="true()"/> + </xsl:call-template>@@=@@<xsl:value-of select="normalize-space(@variables)"/>@@)@@ + </xsl:for-each> + </xsl:variable> + + <!-- <xsl:message>Notations: <xsl:value-of select="normalize-space($notations)"/> End notations</xsl:message> --> + + <xsl:if test="definition"> + <refsect1> + <title>Definitions</title> + <xsl:for-each select="definition"> + <p><xsl:apply-templates/></p> + </xsl:for-each> + </refsect1> + </xsl:if> + + <xsl:if test="valid-type-expression | models | models-when-mutable"> + <refsect1> + <title>Type expressions</title> + <variablelist> + <xsl:for-each select="models"> + <varlistentry> + <term/> + <listitem> + <para> + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="."/> + <xsl:with-param name="operator_nodeset" select="key('concepts', @concept)/models-sentence/node()"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="ignore-cv" select="false()"/> + <xsl:with-param name="self" select="@concept"/> + <xsl:with-param name="use-code-block" select="true()"/> + </xsl:call-template> + </para> + </listitem> + </varlistentry> + </xsl:for-each> + <xsl:for-each select="models-when-mutable"> + <varlistentry> + <term>Only when mutable</term> + <listitem> + <para> + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="."/> + <xsl:with-param name="operator_nodeset" select="key('concepts', @concept)/models-sentence/node()"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="ignore-cv" select="false()"/> + <xsl:with-param name="self" select="@concept"/> + <xsl:with-param name="use-code-block" select="true()"/> + </xsl:call-template> + </para> + </listitem> + </varlistentry> + </xsl:for-each> + <xsl:for-each select="valid-type-expression"> + <varlistentry> + <term><xsl:value-of select="@name"/></term> + <listitem> + <para> + <type> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="*[2]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="normalize-space($notations)"/> + </xsl:call-template> + </type> + + <xsl:comment/> must be + <xsl:for-each select="return-type/*"> + <xsl:if test="position()!=1 and last()!=2">, </xsl:if> + <xsl:if test="position()=last() and last()!=1"> and </xsl:if> + <xsl:call-template name="unparse-constraint"> + <xsl:with-param name="constraint" select="."/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="type-expr-mode" select="true()"/> + </xsl:call-template> + </xsl:for-each><xsl:comment/>. + </para> + + <xsl:if test="description"> + <xsl:for-each select="description"> + <xsl:apply-templates/> + </xsl:for-each> + </xsl:if> + </listitem> + </varlistentry> + </xsl:for-each> + </variablelist> + </refsect1> + </xsl:if> + + <xsl:if test="valid-expression"> + <refsect1> + <title>Valid expressions</title> + + <xsl:variable name="columns"> + <xsl:if test="valid-expression/return-type"> + <xsl:text>T</xsl:text> + </xsl:if> + <xsl:if test="valid-expression/precondition"> + <xsl:text>P</xsl:text> + </xsl:if> + <xsl:if test="valid-expression/semantics"> + <xsl:text>S</xsl:text> + </xsl:if> + <xsl:if test="valid-expression/postcondition"> + <xsl:text>O</xsl:text> + </xsl:if> + </xsl:variable> + + <informaltable> + <tgroup> + <xsl:attribute name="cols"> + <xsl:value-of select="string-length($columns) + 2"/> + </xsl:attribute> + <thead> + <row> + <entry>Name</entry> + <entry>Expression</entry> + <xsl:if test="contains($columns, 'T')"> + <entry>Type</entry> + </xsl:if> + <xsl:if test="contains($columns, 'P')"> + <entry>Precondition</entry> + </xsl:if> + <xsl:if test="contains($columns, 'S')"> + <entry>Semantics</entry> + </xsl:if> + <xsl:if test="contains($columns, 'O')"> + <entry>Postcondition</entry> + </xsl:if> + </row> + </thead> + <tbody> + <xsl:apply-templates select="valid-expression"> + <xsl:with-param name="definition_list" + select="$definition_list"/> + <xsl:with-param name="notations" + select="normalize-space($notations)"/> + <xsl:with-param name="columns" select="$columns"/> + </xsl:apply-templates> + </tbody> + </tgroup> + </informaltable> + <!-- Doug prefers the table + <variablelist> + <xsl:for-each select="valid-expression"> + <xsl:variable name="as-cxx-value"> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="*[1]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="normalize-space($notations)"/> + </xsl:call-template> + </xsl:variable> + <varlistentry> + <term><xsl:value-of select="@name"/>: <literal><xsl:value-of select="$as-cxx-value"/></literal></term> + <listitem><variablelist> + <xsl:if test="return-type/*"> + <varlistentry><term>Return value</term><listitem><para> + <xsl:for-each select="return-type/*"> + <xsl:if test="position()!=1 and last()!=2">, </xsl:if> + <xsl:if test="position()=last() and last()!=1"> and </xsl:if> + <xsl:call-template name="unparse-constraint"> + <xsl:with-param name="constraint" select="."/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="capitalize" select="position()=1"/> + </xsl:call-template> + </xsl:for-each> + </para></listitem></varlistentry> + </xsl:if> + + <xsl:for-each select="precondition"> + <varlistentry><term>Precondition</term><listitem><para> + <xsl:apply-templates/> + </para></listitem></varlistentry> + </xsl:for-each> + + <xsl:for-each select="semantics"> + <varlistentry><term>Semantics</term><listitem><para> + <xsl:apply-templates/> + </para></listitem></varlistentry> + </xsl:for-each> + + <xsl:for-each select="postcondition"> + <varlistentry><term>Postcondition</term><listitem><para> + <xsl:apply-templates/> + </para></listitem></varlistentry> + </xsl:for-each> + + </variablelist></listitem> + </varlistentry> + + </xsl:for-each> + </variablelist> +--> + </refsect1> + </xsl:if> + + <xsl:if test="complexity"> + <refsect1> + <title>Complexity</title> + <xsl:for-each select="complexity"> + <para><xsl:apply-templates/></para> + </xsl:for-each> + </refsect1> + </xsl:if> + + <xsl:if test="invariant"> + <refsect1> + <title>Invariants</title> + <variablelist> + <xsl:for-each select="invariant"> + <varlistentry> + <term><xsl:value-of select="@name"/></term> + <listitem> + <para><xsl:apply-templates/></para> + </listitem> + </varlistentry> + </xsl:for-each> + </variablelist> + </refsect1> + </xsl:if> + + <xsl:if test="example-model"> + <refsect1> + <title>Models</title> + <itemizedlist> + <xsl:for-each select="example-model"> + <listitem> + <simplelist type="inline"> + <xsl:for-each select="*"> + <xsl:variable name="example-value"> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="."/> + <xsl:with-param name="definition_list" select="$definition_list"/> + </xsl:call-template> + </xsl:variable> + <member><type><xsl:value-of select="$example-value"/></type></member> + </xsl:for-each> + </simplelist> + </listitem> + </xsl:for-each> + </itemizedlist> + </refsect1> + </xsl:if> + + <xsl:variable name="see-also-list-0" select="concept-ref | see-also | refines | refines-when-mutable | models-as-first-arg | models | models-when-mutable"/> + <xsl:variable name="see-also-list-1" select="$see-also-list-0[string(@name | @concept) != string(../@name)]"/> + <xsl:variable name="see-also-list" select="$see-also-list-1[not(string(@name|@concept) = (preceding::*/@name | preceding::*/@concept | ancestor::*/@name | ancestor::*/@concept))]"/> + <xsl:if test="$see-also-list"> + <refsect1> + <title>See also</title> + <itemizedlist> + <xsl:for-each select="$see-also-list"> + <xsl:sort select="string(@name|@concept)" data-type="text"/> + <listitem> + <para> + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" select="@name|@concept"/> + </xsl:call-template> + </para> + </listitem> + </xsl:for-each> + </itemizedlist> + </refsect1> + </xsl:if> + + </refentry> + </xsl:template> + + <xsl:template name="unparse-constraint"> + <xsl:param name="constraint"/> + <xsl:param name="definition_list"/> + <xsl:param name="type-expr-mode" select="false()"/> + <xsl:param name="capitalize" select="true()"/> + + <xsl:choose> + + <xsl:when test="name($constraint)='require-same-type'"> + <xsl:if test="$type-expr-mode">identical to </xsl:if> + <type> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$constraint/*[1]"/> + <xsl:with-param name="definition_list" select="definition_list"/> + </xsl:call-template> + </type> + </xsl:when> + + <xsl:when test="name($constraint)='convertible-to'"> + <xsl:choose> + <xsl:when test="$type-expr-mode">convertible to </xsl:when> + <xsl:when test="not($type-expr-mode) and $capitalize">Convertible to </xsl:when> + <xsl:when test="not($type-expr-mode) and not($capitalize)">convertible to </xsl:when> + </xsl:choose> + <type> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$constraint/*[1]"/> + <xsl:with-param name="definition_list" select="definition_list"/> + </xsl:call-template> + </type> + </xsl:when> + + <xsl:when test="name($constraint)='derived-from'"> + <xsl:choose> + <xsl:when test="$type-expr-mode">derived from </xsl:when> + <xsl:when test="not($type-expr-mode) and $capitalize">Derived from </xsl:when> + <xsl:when test="not($type-expr-mode) and not($capitalize)">derived from </xsl:when> + </xsl:choose> + <type> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$constraint/*[1]"/> + <xsl:with-param name="definition_list" select="definition_list"/> + </xsl:call-template> + </type> + </xsl:when> + + <xsl:when test="name($constraint)='assignable-to'"> + <xsl:choose> + <xsl:when test="$type-expr-mode">assignable to </xsl:when> + <xsl:when test="not($type-expr-mode) and $capitalize">Assignable to </xsl:when> + <xsl:when test="not($type-expr-mode) and not($capitalize)">assignable to </xsl:when> + </xsl:choose> + <type> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$constraint/*[1]"/> + <xsl:with-param name="definition_list" select="definition_list"/> + </xsl:call-template> + </type> + </xsl:when> + + <xsl:when test="name($constraint)='models-as-first-arg'"> + <xsl:choose> + <xsl:when test="$type-expr-mode"> a model </xsl:when> + <xsl:when test="not($type-expr-mode) and $capitalize"> Models </xsl:when> + <xsl:when test="not($type-expr-mode) and not($capitalize)"> models </xsl:when> + </xsl:choose> + <xsl:if test="$constraint/*"><xsl:comment/> + (along with <xsl:for-each select="$constraint/*"><type> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="."/> + <xsl:with-param name="definition_list" select="definition_list"/> + </xsl:call-template> + </type> + <xsl:choose> + <xsl:when test="position()=last()"/> + <xsl:when test="position()=last()-1 and last()=2"> and </xsl:when> + <xsl:when test="position()=last()-1 and last()!=2">, and </xsl:when> + <xsl:otherwise>, </xsl:otherwise> + </xsl:choose><xsl:comment/> + </xsl:for-each><xsl:comment/>) <xsl:comment/> + </xsl:if><xsl:comment/> + <xsl:if test="$type-expr-mode"> of </xsl:if> + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" select="$constraint/@concept"/> + </xsl:call-template> + </xsl:when> + + </xsl:choose> + </xsl:template> + + <xsl:template name="make-definition-list"> + <xsl:param name="typedefs"/> + <xsl:param name="definition_list"/> + + <xsl:choose> + <xsl:when test="$typedefs"> + <xsl:variable name="type_definition"> + <xsl:if test="name($typedefs[1]/*[1])!='description'"> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$typedefs[1]/*[1]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + + <xsl:variable name="new_type_definition"> + <xsl:choose> + <xsl:when test="name($typedefs[1])='associated-type'"> + <xsl:value-of select="$typedefs[1]/@name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$type_definition"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:call-template name="make-definition-list"> + <xsl:with-param name="typedefs" select="$typedefs[position()!=1]"/> + <xsl:with-param name="definition_list" select="concat($definition_list, ' @(@', $typedefs[1]/@name, '=', $new_type_definition, '@)@')"/> + </xsl:call-template> + + </xsl:when> + + <xsl:otherwise> <!-- End of expression list, emit the results that have accumulated --> + <xsl:value-of select="$definition_list"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="print-associated-types"> + <xsl:param name="typedefs"/> + <xsl:param name="definition_list"/> + + <xsl:if test="$typedefs"> + <refsect1> + <title>Associated types</title> + + <xsl:choose> + <xsl:when test="$boost.concept.layout='sgi'"> + <informaltable> + <tgroup cols="2"> + <tbody> + <xsl:apply-templates select="associated-type" mode="sgi"> + <xsl:with-param name="definition_list" + select="$definition_list"/> + </xsl:apply-templates> + </tbody> + </tgroup> + </informaltable> + </xsl:when> + <xsl:when test="$boost.concept.layout='austern'"> + <itemizedlist> + <xsl:apply-templates select="associated-type" mode="austern"> + <xsl:with-param name="definition_list" + select="$definition_list"/> + </xsl:apply-templates> + </itemizedlist> + </xsl:when> + <xsl:when test="$boost.concept.layout='caramel'"> + <segmentedlist> + <segtitle>Name</segtitle> + <segtitle>Code</segtitle> + <segtitle>Description</segtitle> + <xsl:for-each select="$typedefs"> + <xsl:variable name="type_definition"> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="*[1]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + </xsl:call-template> + </xsl:variable> + <seglistitem> + <seg><xsl:value-of select="@name"/></seg> + <seg><xsl:value-of select="$type_definition"/></seg> + <seg> + <xsl:for-each select="description"> + <xsl:call-template name="description"/> + </xsl:for-each> + </seg> + </seglistitem> + </xsl:for-each> + </segmentedlist> + </xsl:when> + </xsl:choose> + </refsect1> + </xsl:if> + </xsl:template> + + <xsl:template name="comma-list"> + <xsl:param name="list"/> + + <xsl:if test="$list!=''"> + <term><varname> + <xsl:if test="substring-before($list,' ')=''"><xsl:value-of select="$list"/></xsl:if> + <xsl:value-of select="substring-before($list,' ')"/> + </varname></term> + <xsl:call-template name="comma-list"> + <xsl:with-param name="list" select="substring-after($list,' ')"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="associated-type" mode="sgi"> + <row> + <entry><simpara><xsl:value-of select="@name"/></simpara></entry> + + <entry> + <para> + <xsl:for-each select="description"> + <xsl:apply-templates/> + </xsl:for-each> + </para> + </entry> + </row> + </xsl:template> + + <xsl:template match="associated-type" mode="austern"> + <xsl:param name="definition_list" select="''"/> + + <listitem> + <para> + <emphasis role="bold"><xsl:value-of select="@name"/></emphasis> + + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="*[1]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + + <xsl:for-each select="description"> + <xsl:apply-templates/> + </xsl:for-each> + </para> + </listitem> + </xsl:template> + + <xsl:template match="valid-expression"> + <xsl:param name="definition_list"/> + <xsl:param name="notations"/> + <xsl:param name="columns"/> + + <row> + <entry><simpara><xsl:value-of select="@name"/></simpara></entry> + + <entry> + <simpara> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="*[1]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$notations"/> + </xsl:call-template> + </simpara> + </entry> + + <xsl:if test="contains($columns, 'T')"> + <entry> + <simpara> + <xsl:for-each select="return-type/*"> + <xsl:if test="position()!=1 and last()!=2">, </xsl:if> + <xsl:if test="position()=last() and last()!=1"> and </xsl:if> + <xsl:call-template name="unparse-constraint"> + <xsl:with-param name="constraint" select="."/> + <xsl:with-param name="definition_list" + select="$definition_list"/> + <xsl:with-param name="capitalize" select="position()=1"/> + </xsl:call-template> + </xsl:for-each> + </simpara> + </entry> + </xsl:if> + + <xsl:if test="contains($columns, 'P')"> + <entry> + <xsl:for-each select="precondition"> + <simpara><xsl:apply-templates/></simpara> + </xsl:for-each> + </entry> + </xsl:if> + + <xsl:if test="contains($columns, 'S')"> + <entry> + <xsl:for-each select="semantics"> + <simpara><xsl:apply-templates/></simpara> + </xsl:for-each> + </entry> + </xsl:if> + + <xsl:if test="contains($columns, 'O')"> + <entry> + <xsl:for-each select="postcondition"> + <simpara><xsl:apply-templates/></simpara> + </xsl:for-each> + </entry> + </xsl:if> + </row> + </xsl:template> + + <xsl:template name="concept.notation"> + <xsl:param name="definition_list"/> + + <refsect1> + <title>Notation</title> + <variablelist> + <xsl:for-each select="param"> + <varlistentry> + <term><xsl:value-of select="@name"/></term> + <listitem> + <simpara> + <xsl:text>A type playing the role of </xsl:text> + <xsl:value-of select="@role"/> + <xsl:text> in the </xsl:text> + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" select="../@name"/> + </xsl:call-template> + <xsl:text> concept.</xsl:text> + </simpara> + </listitem> + </varlistentry> + </xsl:for-each> + <xsl:for-each select="notation"> + <xsl:variable name="notation_name"> + <xsl:call-template name="comma-list"> + <xsl:with-param name="list" + select="normalize-space(@variables)"/> + </xsl:call-template> + </xsl:variable> + + <varlistentry> + <xsl:copy-of select="$notation_name"/> + <listitem> + <simpara> + <xsl:variable name="output-plural" select="substring-before(normalize-space(@variables),' ')!=''"/> + <xsl:if test="name(*[1])='sample-value'">Object<xsl:if test="$output-plural">s</xsl:if> of type </xsl:if> + <xsl:variable name="typeref-to-print" select="*[name()!='sample-value'] | sample-value/*[name()!='sample-value']"/> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$typeref-to-print"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="ignore-cv" select="true()"/> + <xsl:with-param name="ignore-references" select="true()"/> + </xsl:call-template> + </simpara> + </listitem> + </varlistentry> + </xsl:for-each> + </variablelist> + </refsect1> + </xsl:template> + + <xsl:template name="concept.link"> + <xsl:param name="name" select="text()"/> + <xsl:param name="warn" select="true()"/> + <xsl:param name="text" select="$name"/> + <xsl:variable name="node" select="key('concepts', $name)"/> + + <xsl:choose> + <xsl:when test="count($node)=0"> + <xsl:if test="$warn"> + <xsl:message> + <xsl:text>warning: cannot find concept '</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>'</xsl:text> + </xsl:message> + </xsl:if> + <xsl:value-of select="$text"/> + </xsl:when> + <xsl:otherwise> + <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="$text"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="remove-whitespace"> + <xsl:param name="text" select="text()"/> + + <xsl:variable name="normalized" select="normalize-space($text)"/> + <xsl:choose> + <xsl:when test="contains($normalized, ' ')"> + <xsl:value-of select="substring-before($normalized, ' ')"/> + <xsl:call-template name="remove-whitespace"> + <xsl:with-param name="text" + select="substring-after($normalized, ' ')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$normalized"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="concept" mode="generate.id"> + <xsl:call-template name="remove-whitespace"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/caramel/cpp-operators.xml b/src/boost/tools/boostbook/xsl/caramel/cpp-operators.xml new file mode 100644 index 000000000..68626acbb --- /dev/null +++ b/src/boost/tools/boostbook/xsl/caramel/cpp-operators.xml @@ -0,0 +1,288 @@ +<?xml version="1.0" ?> + +<!-- +Copyright (c) 2002-2003 The Trustees of Indiana University. + All rights reserved. +Copyright (c) 2000-2001 University of Notre Dame. All rights reserved. + + 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) --> + +<operator-list> + <!-- This list is from Pohl's book, and needs to be checked for accuracy --> + + <op name="postincrement"> + <apply priority="100"><arg num="1"/>++</apply> <!-- No assoc - always use parentheses --> + <impl position="method">operator++(int)</impl> + </op> + + <op name="postdecrement"> + <apply priority="100"><arg num="1"/>--</apply> + <impl position="method">operator--(int)</impl> + </op> + + <op name="apply-function"> + <apply priority="100"><name/>(<arg-list start="1" priority="30"/>)</apply> + <impl position="freestanding"><name/>(<arg-list/>)</impl> + </op> + + <op name="apply-method"> + <apply priority="100" assoc="1"><arg num="1"/>.<name/>(<arg-list start="2" priority="30"/>)</apply> + <impl position="method"><name/>(<arg-list/>)</impl> + </op> + + <op name="pointer-apply-method"> + <apply priority="100" assoc="1"><arg num="1"/>-><name/>(<arg-list start="2" priority="30"/>)</apply> + <impl>Error</impl> + </op> + + <op name="apply-funcobj"> + <apply priority="100" assoc="1"><arg num="1"/>(<arg-list start="2" priority="30"/>)</apply> + <impl position="method">operator()(<arg-list/>)</impl> + </op> + + <op name="construct"> + <apply priority="100"><arg num="1"/>(<arg-list start="2" priority="30"/>)</apply> + <impl position="method"><self/>(<arg-list/>)</impl> + </op> + + <op name="subscript"> + <apply priority="100" assoc="1"><arg num="1"/>[<arg num="2" priority="0"/>]</apply> + <impl position="method">operator[](<arg-list/>)</impl> + </op> + + <op name="class-member"> + <apply priority="100" assoc="1"><arg num="1"/>.<name/></apply> + <impl>Error</impl> + </op> + + <op name="pointer-member"> + <!-- Note: non-testable constraint --> + <apply priority="100"><arg num="1" assoc="1"/>->{member-name} (return type is pointer-to-object type)</apply> + <impl>operator->(<arg-list/>)</impl> + </op> + + <op name="preincrement"> + <apply priority="95">++<arg num="1"/></apply> + <impl position="method">operator++(<arg-list/>)</impl> + </op> + + <op name="predecrement"> + <apply priority="95">--<arg num="1"/></apply> + <impl position="method">operator--(<arg-list/>)</impl> + </op> + + <op name="logical-not"> + <apply priority="95" assoc="1">!<arg num="1"/></apply> + <impl position="method">operator!(<arg-list/>)</impl> + </op> + + <op name="bitwise-not"> + <apply priority="95" assoc="1">~<arg num="1"/></apply> + <impl position="method">operator~(<arg-list/>)</impl> + </op> + + <op name="address-of"> + <apply priority="95">&<arg num="1"/></apply> + <impl position="method">operator&(<arg-list/>)</impl> + </op> + + <op name="dereference"> + <apply priority="95" assoc="1">*<arg num="1"/></apply> + <impl position="method">operator*(<arg-list/>)</impl> + </op> + + <op name="unary-plus"> + <apply priority="95">+<arg num="1"/></apply> + <impl position="method">operator+(<arg-list/>)</impl> + </op> + + <op name="unary-minus"> + <apply priority="95">-<arg num="1"/></apply> + <impl position="method">operator-(<arg-list/>)</impl> + </op> + + <op name="class-member-ptr"> + <apply priority="90" assoc="1"><arg num="1"/>.*<arg num="2"/></apply> + <impl>Error</impl> + </op> + + <op name="pointer-member-ptr"> + <apply priority="90" assoc="1"><arg num="1"/>->*<arg num="2"/></apply> + <impl position="method">operator->*(<arg-list/>)</impl> + </op> + + <op name="multiply"> + <apply priority="90" assoc="1"><arg num="1"/> * <arg num="2"/></apply> + <impl position="freestanding">operator * (<arg-list/>)</impl> + </op> + + <op name="divide"> + <apply priority="90" assoc="1"><arg num="1"/> / <arg num="2"/></apply> + <impl position="freestanding">operator / (<arg-list/>)</impl> + </op> + + <op name="modulus"> + <apply priority="90" assoc="1"><arg num="1"/> % <arg num="2"/></apply> + <impl position="freestanding">operator % (<arg-list/>)</impl> + </op> + + <op name="add"> + <apply priority="85" assoc="1"><arg num="1"/> + <arg num="2"/></apply> + <impl position="freestanding">operator + (<arg-list/>)</impl> + </op> + + <op name="subtract"> + <apply priority="85" assoc="1"><arg num="1"/> - <arg num="2"/></apply> + <impl position="freestanding">operator - (<arg-list/>)</impl> + </op> + + <op name="shift-left"> + <apply priority="80" assoc="1"><arg num="1"/> << <arg num="2"/></apply> + <impl position="freestanding">operator << (<arg-list/>)</impl> + </op> + + <op name="shift-right"> + <apply priority="80" assoc="1"><arg num="1"/> >> <arg num="2"/></apply> + <impl position="freestanding">operator >> (<arg-list/>)</impl> + </op> + + <op name="less-than"> + <apply priority="75"><arg num="1"/> < <arg num="2"/></apply> + <impl position="freestanding">operator < (<arg-list/>)</impl> + </op> + + <op name="greater-than"> + <apply priority="75"><arg num="1"/> > <arg num="2"/></apply> + <impl position="freestanding">operator > (<arg-list/>)</impl> + </op> + + <op name="less-than-or-equal"> + <apply priority="75"><arg num="1"/> <= <arg num="2"/></apply> + <impl position="freestanding">operator <= (<arg-list/>)</impl> + </op> + + <op name="greater-than-or-equal"> + <apply priority="75"><arg num="1"/> >= <arg num="2"/></apply> + <impl position="freestanding">operator >= (<arg-list/>)</impl> + </op> + + <op name="equal-to"> + <apply priority="70"><arg num="1"/> == <arg num="2"/></apply> + <impl position="freestanding">operator == (<arg-list/>)</impl> + </op> + + <op name="not-equal-to"> + <apply priority="70"><arg num="1"/> != <arg num="2"/></apply> + <impl position="freestanding">operator != (<arg-list/>)</impl> + </op> + + <op name="bitwise-and"> + <apply priority="65" assoc="1"><arg num="1"/> & <arg num="2"/></apply> + <impl position="freestanding">operator & (<arg-list/>)</impl> + </op> + + <op name="bitwise-or"> + <apply priority="60" assoc="1"><arg num="1"/> | <arg num="2"/></apply> + <impl position="freestanding">operator | (<arg-list/>)</impl> + </op> + + <op name="bitwise-xor"> + <apply priority="55" assoc="1"><arg num="1"/> ^ <arg num="2"/></apply> + <impl position="freestanding">operator ^ (<arg-list/>)</impl> + </op> + + <op name="logical-and"> + <apply priority="50" assoc="1"><arg num="1"/> && <arg num="2"/></apply> + <impl position="freestanding">operator && (<arg-list/>)</impl> + </op> + + <op name="logical-or"> + <apply priority="45" assoc="1"><arg num="1"/> || <arg num="2"/></apply> + <impl position="freestanding">operator || (<arg-list/>)</impl> + </op> + + <op name="conditional"> + <apply priority="40" assoc="3"><arg num="1"/> ? <arg num="2"/> : <arg num="3"/></apply> + <impl>Error</impl> + </op> + + <op name="assign"> + <apply priority="35" assoc="2"><arg num="1"/> = <arg num="2"/></apply> + <impl position="method">operator = (<arg-list/>)</impl> + </op> + + <op name="add-assign"> + <apply priority="35" assoc="2"><arg num="1"/> += <arg num="2"/></apply> + <impl position="method">operator += (<arg-list/>)</impl> + </op> + + <op name="subtract-assign"> + <apply priority="35" assoc="2"><arg num="1"/> -= <arg num="2"/></apply> + <impl position="method">operator -= (<arg-list/>)</impl> + </op> + + <op name="multiply-assign"> + <apply priority="35" assoc="2"><arg num="1"/> *= <arg num="2"/></apply> + <impl position="method">operator *= (<arg-list/>)</impl> + </op> + + <op name="divide-assign"> + <apply priority="35" assoc="2"><arg num="1"/> /= <arg num="2"/></apply> + <impl position="method">operator /= (<arg-list/>)</impl> + </op> + + <op name="modulus-assign"> + <apply priority="35" assoc="2"><arg num="1"/> %= <arg num="2"/></apply> + <impl position="method">operator %= (<arg-list/>)</impl> + </op> + + <op name="shift-left-assign"> + <apply priority="35" assoc="2"><arg num="1"/> <<= <arg num="2"/></apply> + <impl position="method">operator <<= (<arg-list/>)</impl> + </op> + + <op name="shift-right-assign"> + <apply priority="35" assoc="2"><arg num="1"/> >>= <arg num="2"/></apply> + <impl position="method">operator >>= (<arg-list/>)</impl> + </op> + + <op name="bitwise-and-assign"> + <apply priority="35" assoc="2"><arg num="1"/> &= <arg num="2"/></apply> + <impl position="method">operator &= (<arg-list/>)</impl> + </op> + + <op name="bitwise-or-assign"> + <apply priority="35" assoc="2"><arg num="1"/> |= <arg num="2"/></apply> + <impl position="method">operator |= (<arg-list/>)</impl> + </op> + + <op name="bitwise-xor-assign"> + <apply priority="35" assoc="2"><arg num="1"/> ^= <arg num="2"/></apply> + <impl position="method">operator ^= (<arg-list/>)</impl> + </op> + + <op name="comma"> + <apply priority="20"><arg num="1"/>, <arg num="2"/></apply> + <impl position="freestanding">operator , (<arg-list/>)</impl> + </op> + + <op name="function-pointer"> + <apply><arg num="1"/> (*)(<arg-list start="2" priority="30"/>)</apply> + <impl>Error</impl> + </op> + + <op name="functorize-operator"> + <!-- Note: non-testable constraint --> + <apply>functorization of operator <name/> on arguments {<arg-list start="1"/>}</apply> + <impl>Error</impl> + </op> + + <op name="functorize-function"> + <!-- Note: non-testable constraint --> + <apply>functorization of function <name/> on arguments {<arg-list start="1"/>}</apply> + <impl>Error</impl> + </op> + +</operator-list> diff --git a/src/boost/tools/boostbook/xsl/caramel/unparser.xsl b/src/boost/tools/boostbook/xsl/caramel/unparser.xsl new file mode 100644 index 000000000..63db55fff --- /dev/null +++ b/src/boost/tools/boostbook/xsl/caramel/unparser.xsl @@ -0,0 +1,497 @@ +<?xml version="1.0" ?> + +<!-- +Copyright (c) 2002-2003 The Trustees of Indiana University. + All rights reserved. +Copyright (c) 2000-2001 University of Notre Dame. All rights reserved. + + 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" version="1.0"> + <xsl:template name="unparse-cpp"> + <xsl:param name="typeref"/> + <xsl:param name="definition_list"/> + <xsl:param name="priority">0</xsl:param> + <xsl:param name="ignore-cv" select="false()"/> + <xsl:param name="ignore-references" select="false()"/> + <xsl:param name="notations"/> + <xsl:param name="ignore-notation" select="false()"/> + <xsl:param name="print-updated-notation" select="false()"/> + <xsl:param name="use-typename" select="false()"/> + <xsl:param name="const-if-not-mutable-value" select="'const-if-not-mutable'"/> + + <xsl:variable name="notation_check"> + <xsl:if test="not($ignore-notation)"> <!-- Prevent infinite recursion --> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="priority">0</xsl:with-param> + <xsl:with-param name="ignore-cv" select="true()"/> + <xsl:with-param name="ignore-references" select="true()"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="ignore-notation" select="true()"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + + <!-- + <xsl:message>Notation check: <xsl:value-of select="$notation_check"/> + Notations: <xsl:value-of select="$notations"/> + </xsl:message> --> + + <xsl:variable name="this_op_priority" select="document('cpp-operators.xml')/operator-list/op[@name=name($typeref)]/apply/@priority"/> + + <xsl:variable name="result"> + + <xsl:variable name="subcall_priority"> + <xsl:choose> + <xsl:when test="true() or ($this_op_priority > $priority)"> + <xsl:value-of select="$this_op_priority"/> + </xsl:when> + <!-- <xsl:otherwise>0</xsl:otherwise> --> + </xsl:choose> + </xsl:variable> + + <xsl:if test="$this_op_priority <= $priority">(</xsl:if> + + <xsl:choose> + + <xsl:when test="name($typeref)='sample-value'" + >boost::sample_value < <xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template> >()</xsl:when> + + <xsl:when test="name($typeref)='reference-to'" + ><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template><xsl:if test="not($ignore-references)"> &</xsl:if></xsl:when> + + <xsl:when test="name($typeref)='pointer-to'" + ><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/></xsl:call-template> *</xsl:when> + + <xsl:when test="name($typeref)='const'" + ><xsl:if test="not($ignore-cv)">const </xsl:if><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template> + </xsl:when> + + <xsl:when test="name($typeref)='const-if-not-mutable'" + ><xsl:if test="not($ignore-cv)"><xsl:value-of select="$const-if-not-mutable-value"/><xsl:if test="$const-if-not-mutable-value"><xsl:text> </xsl:text></xsl:if></xsl:if><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template> + </xsl:when> + + <xsl:when test="name($typeref)='volatile'" + ><xsl:if test="not($ignore-cv)">volatile </xsl:if><xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="priority" select="$subcall_priority"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="ignore-references" select="$ignore-references"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template> + </xsl:when> + + <xsl:when test="name($typeref)='apply-template'"> + <xsl:value-of select="$typeref/@name"/><<xsl:for-each select="$typeref/*"> + <xsl:if test="position()!=1">, </xsl:if><xsl:comment/> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="."/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template></xsl:for-each + ><xsl:comment/>></xsl:when> + + <xsl:when test="name($typeref)='get-member-type'"> + <xsl:call-template name="unparse-cpp"><xsl:with-param name="typeref" select="$typeref/*[1]"/><xsl:with-param name="definition_list" select="$definition_list"/><xsl:with-param name="ignore-cv" select="$ignore-cv"/><xsl:with-param name="notations" select="$notations"/><xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/></xsl:call-template>::<xsl:value-of select="$typeref/@name"/> + </xsl:when> + + <xsl:when test="name($typeref)='type'"> + <xsl:variable name="typeref_value" select="normalize-space(substring-before(substring-after($definition_list,concat('@(@',$typeref/@name,'=')),'@)@'))"/> + <xsl:choose> + <xsl:when test="$typeref_value=''"> + <xsl:value-of select="$typeref/@name"/><xsl:comment/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$typeref_value"/><xsl:comment/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + + <xsl:when test="name($typeref)='documentation'"/> + + <xsl:when test="document('cpp-operators.xml')/operator-list/op[@name=name($typeref)]"> + <xsl:variable name="op_file" select="document('cpp-operators.xml')/operator-list"/> + <xsl:variable name="op_info" select="$op_file/op[@name=name($typeref)]/apply/."/> + + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="operator_nodeset" select="$op_info/child::node()"/> + <xsl:with-param name="my_priority" select="$subcall_priority"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/> + </xsl:call-template> + + </xsl:when> + + <xsl:otherwise> + (Unrecognized tag <xsl:value-of select="name($typeref)"/>) + </xsl:otherwise> + </xsl:choose> + + <!-- Close parenthesis code moved below --> + + </xsl:variable> + + <!-- <xsl:message>ignore-notation = <xsl:value-of select="$ignore-notation"/></xsl:message> --> + <!-- <xsl:message>notation_check = <xsl:value-of select="$notation_check"/></xsl:message> --> + <!-- <xsl:message>notations = <xsl:value-of select="$notations"/></xsl:message> --> + <!-- <xsl:message>result = <xsl:value-of select="$result"/></xsl:message> --> + + <xsl:variable name="used_notation" select="boolean($notation_check) and boolean(substring-before(substring-after($notations, concat('@@(@@', $notation_check, '@@=@@')),'@@)@@'))"/> + + <xsl:variable name="notations2"> + <!-- Possibly replace from result of unparse-operator-definition --> + <xsl:choose> + <xsl:when test="contains($result, ' *@@@* ')"> + <xsl:value-of select="substring-after($result, ' *@@@* ')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$notations"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="result2"> + <!-- Possibly replace from result of unparse-operator-definition --> + <xsl:choose> + <xsl:when test="contains($result, ' *@@@* ')"> + <xsl:value-of select="substring-before($result, ' *@@@* ')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$result"/> + </xsl:otherwise> + </xsl:choose> + <!-- Close parenthesis code --> + <xsl:if test="$this_op_priority <= $priority">)</xsl:if> + </xsl:variable> + + <xsl:variable name="notation_varlist"> + <xsl:choose> + <xsl:when test="$used_notation"> + <xsl:value-of select="substring-before(substring-after($notations2, concat('@@(@@', $notation_check, '@@=@@')), '@@)@@')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$result2"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="new_varlist" select="substring-after(normalize-space($notation_varlist), ' ')"/> + + <xsl:variable name="notation_var"> + <xsl:choose> + <xsl:when test="not($used_notation)"> + <xsl:value-of select="$result2"/> + </xsl:when> + <xsl:when test="$new_varlist=''"> + <xsl:value-of select="$notation_varlist"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before(normalize-space($notation_varlist), ' ')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Generate new notation list --> + <xsl:variable name="new_notations"> + <xsl:choose> + <xsl:when test="$used_notation"> + <xsl:value-of select="normalize-space(concat('@@(@@', $notation_check, '@@=@@', $new_varlist, '@@)@@', $notations2))"/> + <!-- Duplicate entries always use first occurrance, so I can optimize this --> + </xsl:when> + <xsl:otherwise><xsl:value-of select="$notations2"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- <xsl:message>final_result = <xsl:value-of select="normalize-space($final_result)"/></xsl:message> --> + + <xsl:call-template name="add-typename"><xsl:with-param name="really-do-it" select="$use-typename"/><xsl:with-param name="type"><xsl:value-of select="normalize-space($notation_var)"/></xsl:with-param></xsl:call-template><xsl:if test="$print-updated-notation"> *@@@* <xsl:value-of select="$new_notations"/></xsl:if> + + </xsl:template> + + <xsl:template name="unparse-operator-definition"> + <xsl:param name="typeref"/> + <xsl:param name="operator_nodeset"/> + <xsl:param name="current_start">1</xsl:param> + <xsl:param name="my_priority"/> + <xsl:param name="definition_list"/> + <xsl:param name="notations"/> + <xsl:param name="ignore-cv"/> + <xsl:param name="self"/> + <xsl:param name="use-code-block" select="false()"/> + <xsl:param name="print-updated-notation" select="false()"/> + <xsl:param name="const-if-not-mutable-value"/> + + <xsl:variable name="op_current" select="$operator_nodeset[position()=1]"/> + <xsl:variable name="op_rest" select="$operator_nodeset[position()!=1]"/> + + <xsl:choose> + + <xsl:when test="count($operator_nodeset)=0"> + <xsl:if test="$print-updated-notation"> *@@@* <xsl:value-of select="$notations"/></xsl:if> + </xsl:when> + + <xsl:when test="$op_current != $op_current/../*"> <!-- If I am not an element --> + <xsl:value-of select="$op_current"/> + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="operator_nodeset" select="$op_rest"/> + <xsl:with-param name="my_priority" select="$my_priority"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="self" select="$self"/> + <xsl:with-param name="use-code-block" select="$use-code-block"/> + <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="name($op_current)='name'"> + <xsl:value-of select="$typeref/@name"/> + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="operator_nodeset" select="$op_rest"/> + <xsl:with-param name="my_priority" select="$my_priority"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="self" select="$self"/> + <xsl:with-param name="use-code-block" select="$use-code-block"/> + <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="name($op_current)='self'"> + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" select="string($self)"/> + </xsl:call-template> + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="operator_nodeset" select="$op_rest"/> + <xsl:with-param name="my_priority" select="$my_priority"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="self" select="$self"/> + <xsl:with-param name="use-code-block" select="$use-code-block"/> + <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="name($op_current)='arg'"> + <xsl:variable name="num" select="$op_current/@num"/> + <xsl:variable name="assoc" select="$op_current/../@assoc"/> + <xsl:variable name="my_priority_before" select="$my_priority"/> + <xsl:variable name="my_priority"> + <xsl:choose> + <xsl:when test="count($op_current/@priority)"> + <xsl:value-of select="$op_current/@priority"/> + </xsl:when> + <xsl:when test="$assoc and ($num = $assoc)"> + <xsl:value-of select="$my_priority_before - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$my_priority"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="typeref-result"> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$typeref/*[position()=$num]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="priority" select="$my_priority"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="print-updated-notation" select="true()"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="typeref-print" select="normalize-space(substring-before($typeref-result, ' *@@@* '))"/> + <xsl:variable name="new_notations" select="normalize-space(substring-after($typeref-result, ' *@@@* '))"/> + + <xsl:choose> + <xsl:when test="$use-code-block"> + <type><xsl:value-of select="$typeref-print"/></type> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$typeref-print"/> + </xsl:otherwise> + </xsl:choose> + + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="operator_nodeset" select="$op_rest"/> + <xsl:with-param name="my_priority" select="$my_priority_before"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$new_notations"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="self" select="$self"/> + <xsl:with-param name="use-code-block" select="$use-code-block"/> + <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="name($op_current)='arg-list'"> + <xsl:variable name="start" select="$op_current/@start"/> + <xsl:variable name="typeref-result"> + <xsl:choose> + <xsl:when test="$current_start >= $start"> + <xsl:call-template name="unparse-cpp"> + <xsl:with-param name="typeref" select="$typeref/*[$current_start]"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="priority" select="$my_priority"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="notations" select="$notations"/> + <xsl:with-param name="print-updated-notation" select="true()"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + *@@@* <xsl:value-of select="$notations"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="typeref-print" select="normalize-space(substring-before($typeref-result, ' *@@@* '))"/> + <xsl:variable name="new_notations" select="normalize-space(substring-after($typeref-result, ' *@@@* '))"/> + + <xsl:choose> + <xsl:when test="$use-code-block"> + <type><xsl:value-of select="$typeref-print"/></type> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$typeref-print"/> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="$current_start >= $start"> + <xsl:if test="$current_start!=count($typeref/*)">, </xsl:if> + </xsl:if> + + <xsl:choose> + <xsl:when test="$current_start != count($typeref/*)"> + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="operator_nodeset" select="$operator_nodeset"/> + <xsl:with-param name="current_start" select="$current_start + 1"/> + <xsl:with-param name="my_priority" select="$my_priority"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$new_notations"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="self" select="$self"/> + <xsl:with-param name="use-code-block" select="$use-code-block"/> + <xsl:with-param name="print-updated-notation" select="$print-updated-notation"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="unparse-operator-definition"> + <xsl:with-param name="typeref" select="$typeref"/> + <xsl:with-param name="operator_nodeset" select="$op_rest"/> + <xsl:with-param name="my_priority" select="$my_priority"/> + <xsl:with-param name="definition_list" select="$definition_list"/> + <xsl:with-param name="notations" select="$new_notations"/> + <xsl:with-param name="ignore-cv" select="$ignore-cv"/> + <xsl:with-param name="self" select="$self"/> + <xsl:with-param name="use-code-block" select="$use-code-block"/> + <xsl:with-param name="const-if-not-mutable-value" select="$const-if-not-mutable-value"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + + <xsl:otherwise>Invalid tag in operator definition: <xsl:value-of select="name($op_current)"/></xsl:otherwise> + + </xsl:choose> + </xsl:template> + + <xsl:template name="add-typename"> + <!-- Adds typename to the front of a string if it is necessary. --> + <xsl:param name="type"/> <!-- string to prepend to --> + <xsl:param name="params" select="/concept/param | /concept/define-type | /concept/associated-type"/> + <!-- nodeset of param tags for concept --> + <!-- associated types are assumed to be dependent --> + <xsl:param name="really-do-it"/> <!-- really change anything? --> + + <xsl:variable name="type-after-last-scope"> + <xsl:call-template name="substring-before-last"> + <xsl:with-param name="string" select="$type"/> + <xsl:with-param name="to-find" select="'::'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="tokenized-type-after-last-scope"> + <xsl:call-template name="rough-tokenize"> + <xsl:with-param name="string" select="$type-after-last-scope"/> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$really-do-it and boolean($params[contains($tokenized-type-after-last-scope, concat(' ', @name, ' '))])"> + <!-- If the tokenized string contains any of the param names in a + token by itself, return true. Return false otherwise --> + <xsl:comment/>typename <xsl:value-of select="$type"/><xsl:comment/> + </xsl:when> + <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="substring-before-last"> + <xsl:param name="string"/> + <xsl:param name="to-find"/> + <xsl:param name="string-processed-so-far"/> <!-- internal --> + <!-- Find the substring of $string before the last occurrance of + $to-find, returning '' if it was not found. --> + + <xsl:choose> + <xsl:when test="contains($string, $to-find)"> + <xsl:call-template name="substring-before-last"> + <xsl:with-param name="string" select="substring-after($string, $to-find)"/> + <xsl:with-param name="to-find" select="$to-find"/> + <xsl:with-param name="string-processed-so-far" select="concat($string-processed-so-far, substring-before($string, $to-find), $to-find)"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <xsl:value-of select="substring($string-processed-so-far, 1, string-length($string-processed-so-far)-(string-length($to-find)))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="substring-after-last"> + <xsl:param name="string"/> + <xsl:param name="to-find"/> + <!-- Find the substring of $string after the last occurrance of + $to-find, returning the original string if it was not found. --> + + <xsl:choose> + <xsl:when test="contains($string, $to-find)"> + <xsl:call-template name="substring-after-last"> + <xsl:with-param name="string" select="substring-after($string, $to-find)"/> + <xsl:with-param name="to-find" select="$to-find"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <xsl:value-of select="$string"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="rough-tokenize"> + <xsl:param name="string"/> + <!-- Do a rough tokenization of the string. Right now, just translate + all non-token-chars to spaces, normalize-space the result, and prepend + and append spaces. --> + + <xsl:value-of select="concat(' ', normalize-space(translate($string, '<>,./?;:[]{}-=\\_+|!@#$%^&*()', ' ')), ' ')"/> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/chunk-common.xsl b/src/boost/tools/boostbook/xsl/chunk-common.xsl new file mode 100644 index 000000000..e3a04a207 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/chunk-common.xsl @@ -0,0 +1,126 @@ +<?xml version="1.0"?> +<!-- + 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" + 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"/> --> + +<!-- Already included in the main stylesheet --> +<!-- <xsl:import href="relative-href.xsl"/> --> + +<!-- ==================================================================== --> + +<xsl:template match="*" mode="recursive-chunk-filename"> + <xsl:param name="recursive" select="false()"/> + + <xsl:variable name="their"> + <xsl:apply-imports mode="recursive-chunk-filename" select="."/> + </xsl:variable> + + <xsl:variable name="basename" select="substring-before( $their, $html.ext )"/> + <xsl:choose> + <xsl:when test="not($recursive)"> + <!-- translate dots into directory separators, and replace illegal file path characters with underscores --> + <xsl:value-of select="translate($basename, '.<>\:*?"|,()!+=&', '/_______________' )"/> + <xsl:value-of select="$html.ext"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$basename"/> + <xsl:value-of select="'.'"/> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + +<!-- ==================================================================== --> + +<xsl:template name="navig.content"> + <xsl:param name="direction" select="next"/> + <xsl:variable name="navtext"> + <xsl:choose> + <xsl:when test="$direction = 'prev'"> + <xsl:call-template name="gentext.nav.prev"/> + </xsl:when> + <xsl:when test="$direction = 'next'"> + <xsl:call-template name="gentext.nav.next"/> + </xsl:when> + <xsl:when test="$direction = 'up'"> + <xsl:call-template name="gentext.nav.up"/> + </xsl:when> + <xsl:when test="$direction = 'home'"> + <xsl:call-template name="gentext.nav.home"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>xxx</xsl:text> + </xsl:otherwise> + </xsl:choose> + </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"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$navig.graphics.path"/> + </xsl:call-template> + <xsl:value-of select="$direction"/> + <xsl:value-of select="$navig.graphics.extension"/> + </xsl:attribute> + <xsl:attribute name="alt"> + <xsl:value-of select="$navtext"/> + </xsl:attribute> + </img> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$navtext"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + +<!-- ====================================================================== --> + +<xsl:template match="@fileref"> + <xsl:choose> + <xsl:when test="contains(., ':')"> + <xsl:value-of select="."/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="."/> + <xsl:with-param name="context" select=".."/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + +<xsl:template match="@url"> + <xsl:choose> + <xsl:when test="contains(., ':')"> + <xsl:value-of select="."/> + </xsl:when> + <xsl:otherwise> + <xsl:text>XXX</xsl:text> + <xsl:value-of select="."/> + <xsl:text>XXX</xsl:text> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/docbook-layout.xsl b/src/boost/tools/boostbook/xsl/docbook-layout.xsl new file mode 100644 index 000000000..9a382ad5b --- /dev/null +++ b/src/boost/tools/boostbook/xsl/docbook-layout.xsl @@ -0,0 +1,262 @@ +<?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 version = "1.0" + xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" +> + + <!-- needed for calsTable template --> + + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/html/formal.xsl"/> + + <!-- Optionally add the section id to each section's class. + This is useful if you want to style individual sections differently. --> + <xsl:param name="boost.section.class.add.id" select="0"/> + + <!-- + Override the behaviour of some DocBook elements for better + integration with the new look & feel. + --> + + <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> + + <!-- table: remove border = '1' --> + + <xsl:template match = "table|informaltable"> + <xsl:choose> + <xsl:when test = "self::table and tgroup|mediaobject|graphic"> + <xsl:apply-imports/> + </xsl:when><xsl:when test = "self::informaltable and tgroup|mediaobject|graphic"> + <xsl:call-template name = "informal.object"> + <xsl:with-param name = "class"><xsl:choose> + <xsl:when test = "@tabstyle"> + <xsl:value-of select = "@tabstyle"/> + </xsl:when><xsl:otherwise> + <xsl:value-of select = "local-name(.)"/> + </xsl:otherwise> + </xsl:choose></xsl:with-param> + </xsl:call-template> + </xsl:when><xsl:otherwise> + <table class = "table"><xsl:copy-of select = "@*[not(local-name(.)='border')]"/> + <xsl:call-template name = "htmlTable"/> + </table> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match = "tgroup" name = "tgroup"> + <xsl:variable name="summary"><xsl:call-template name="dbhtml-attribute"> + <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/> + <xsl:with-param name="attribute" select="'table-summary'"/> + </xsl:call-template></xsl:variable> + + <xsl:variable name="cellspacing"><xsl:call-template name="dbhtml-attribute"> + <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/> + <xsl:with-param name="attribute" select="'cellspacing'"/> + </xsl:call-template></xsl:variable> + + <xsl:variable name="cellpadding"><xsl:call-template name="dbhtml-attribute"> + <xsl:with-param name="pis" select="processing-instruction('dbhtml')[1]"/> + <xsl:with-param name="attribute" select="'cellpadding'"/> + </xsl:call-template></xsl:variable> + + <table class = "table"> + <xsl:choose> + <xsl:when test="../textobject/phrase"> + <xsl:attribute name="summary"> + <xsl:value-of select="../textobject/phrase"/> + </xsl:attribute> + </xsl:when><xsl:when test="$summary != ''"> + <xsl:attribute name="summary"> + <xsl:value-of select="$summary"/> + </xsl:attribute> + </xsl:when><xsl:when test="../title"> + <xsl:attribute name="summary"> + <xsl:value-of select="string(../title)"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise/> + </xsl:choose><xsl:if test="$cellspacing != '' or $html.cellspacing != ''"> + <xsl:attribute name="cellspacing"><xsl:choose> + <xsl:when test="$cellspacing != ''"><xsl:value-of select="$cellspacing"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$html.cellspacing"/></xsl:otherwise> + </xsl:choose></xsl:attribute> + </xsl:if><xsl:if test="$cellpadding != '' or $html.cellpadding != ''"> + <xsl:attribute name="cellpadding"><xsl:choose> + <xsl:when test="$cellpadding != ''"><xsl:value-of select="$cellpadding"/></xsl:when> + <xsl:otherwise><xsl:value-of select="$html.cellpadding"/></xsl:otherwise> + </xsl:choose></xsl:attribute> + </xsl:if><xsl:if test="../@pgwide=1"> + <xsl:attribute name="width">100%</xsl:attribute> + </xsl:if> + + <xsl:variable name="colgroup"> + <colgroup><xsl:call-template name="generate.colgroup"> + <xsl:with-param name="cols" select="@cols"/> + </xsl:call-template></colgroup> + </xsl:variable> + + <xsl:variable name="explicit.table.width"><xsl:call-template name="dbhtml-attribute"> + <xsl:with-param name="pis" select="../processing-instruction('dbhtml')[1]"/> + <xsl:with-param name="attribute" select="'table-width'"/> + </xsl:call-template></xsl:variable> + + <xsl:variable name="table.width"><xsl:choose> + <xsl:when test="$explicit.table.width != ''"> + <xsl:value-of select="$explicit.table.width"/> + </xsl:when><xsl:when test="$default.table.width = ''"> + <xsl:text>100%</xsl:text> + </xsl:when><xsl:otherwise> + <xsl:value-of select="$default.table.width"/> + </xsl:otherwise> + </xsl:choose></xsl:variable> + + <xsl:if test="$default.table.width != '' or $explicit.table.width != ''"> + <xsl:attribute name="width"><xsl:choose> + <xsl:when test="contains($table.width, '%')"> + <xsl:value-of select="$table.width"/> + </xsl:when><xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0"> + <xsl:choose> + <xsl:when test="function-available('stbl:convertLength')"> + <xsl:value-of select="stbl:convertLength($table.width)"/> + </xsl:when><xsl:when test="function-available('xtbl:convertLength')"> + <xsl:value-of select="xtbl:convertLength($table.width)"/> + </xsl:when><xsl:otherwise> + <xsl:message terminate="yes"> + <xsl:text>No convertLength function available.</xsl:text> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:when><xsl:otherwise> + <xsl:value-of select="$table.width"/> + </xsl:otherwise> + </xsl:choose></xsl:attribute> + </xsl:if> + + <xsl:choose> + <xsl:when test="$use.extensions != 0 and $tablecolumns.extension != 0"> + <xsl:choose> + <xsl:when test="function-available('stbl:adjustColumnWidths')"> + <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/> + </xsl:when><xsl:when test="function-available('xtbl:adjustColumnWidths')"> + <xsl:copy-of select="xtbl:adjustColumnWidths($colgroup)"/> + </xsl:when><xsl:when test="function-available('ptbl:adjustColumnWidths')"> + <xsl:copy-of select="ptbl:adjustColumnWidths($colgroup)"/> + </xsl:when><xsl:otherwise> + <xsl:message terminate="yes"> + <xsl:text>No adjustColumnWidths function available.</xsl:text> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:when><xsl:otherwise> + <xsl:copy-of select="$colgroup"/> + </xsl:otherwise> + </xsl:choose> + + <xsl:apply-templates select="thead"/> + <xsl:apply-templates select="tfoot"/> + <xsl:apply-templates select="tbody"/> + + <xsl:if test=".//footnote"><tbody class="footnotes"> + <tr><td colspan="{@cols}"> + <xsl:apply-templates select=".//footnote" mode="table.footnote.mode"/> + </td></tr> + </tbody></xsl:if> + </table> + </xsl:template> + + <!-- table of contents + + The standard Docbook template selects, amoung others, + the 'refentry' element for inclusion in TOC. In some + cases, this creates empty TOC. The most possible reason + is that there's 'refentry' element without 'refentrytitle', + but it's a mistery why it occurs. Even if we fix that + problem, we'll get non-empty TOC where no TOC is desired + (e.g. for section corresponding to each header file in + library doc). So, don't bother for now. + --> + + <xsl:template name="section.toc"> + <xsl:param name="toc-context" select="."/> + <xsl:param name="toc.title.p" select="true()"/> + + <xsl:call-template name="make.toc"> + <xsl:with-param name="toc-context" select="$toc-context"/> + <xsl:with-param name="toc.title.p" select="$toc.title.p"/> + <xsl:with-param name="nodes" select=" + section|sect1|sect2|sect3|sect4|sect5| + bridgehead[$bridgehead.in.toc != 0] + "/> + </xsl:call-template> + </xsl:template> + + <!-- When there is both a title and a caption for a table, only use the + title. --> + <xsl:template match="table" mode="title.markup"> + <xsl:param name="allow-anchors" select="0"/> + <xsl:apply-templates select="(title|caption)[1]" mode="title.markup"> + <xsl:with-param name="allow-anchors" select="$allow-anchors"/> + </xsl:apply-templates> + </xsl:template> + + + <!-- Adds role class for section element resulting div. So that + we can style them in the resulting HTML. + Also, add the section id, if boost.section.class.add.id = 1. + This can be used to style individual sections differently. --> + <xsl:template match="section" mode="class.value"> + <xsl:param name="class" select="local-name(.)"/> + <xsl:param name="node" select="."/> + <xsl:variable name="id"> + <xsl:if test="$boost.section.class.add.id"> + <xsl:call-template name="object.id"> + <xsl:with-param name="object" select="$node"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:value-of select="normalize-space(concat($class, ' ', + @role, ' ', translate($id, '.', '_')))"/> + </xsl:template> + + <!-- Adds role class for simplesect element resulting div. So that + we can style them in the resulting HTML. --> + <xsl:template match="simplesect" mode="class.value"> + <xsl:param name="class" select="local-name(.)"/> + <xsl:param name="node" select="."/> + <xsl:value-of select="normalize-space(concat($class,' ',@role))"/> + </xsl:template> + + <!-- Allow for specifying that a section should not include the parents + labeling. This allows us to start clean numering of a sub-section. --> + <xsl:template match="section[@label-style='no-parent']" mode="label.markup"> + <xsl:choose> + <xsl:when test="@label"> + <xsl:value-of select="@label"/> + </xsl:when> + <xsl:when test="$label != 0"> + <xsl:variable name="format"> + <xsl:call-template name="autolabel.format"> + <xsl:with-param name="format" select="$section.autolabel"/> + </xsl:call-template> + </xsl:variable> + <xsl:number format="{$format}" count="section"/> + </xsl:when> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/docbook.xsl b/src/boost/tools/boostbook/xsl/docbook.xsl new file mode 100644 index 000000000..a862bb107 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/docbook.xsl @@ -0,0 +1,538 @@ +<?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:xi="http://www.w3.org/2001/XInclude" + version="1.0"> + <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/common/common.xsl"/> + <xsl:include href="reference.xsl"/> + + <xsl:output method="xml" + doctype-public="-//OASIS//DTD DocBook XML V4.2//EN" + doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"/> + + <!-- Generate consistent id values if document is unchanged --> + <xsl:param name="generate.consistent.ids" select="0"/> + + <!-- The maximum number of columns allowed in preformatted text --> + <xsl:param name="max-columns" select="78"/> + + <!-- The root of the Boost directory --> + <xsl:param name="boost.root" select="'../..'"/> + + <!-- A space-separated list of libraries to include in the + output. If this list is empty, all libraries will be included. --> + <xsl:param name="boost.include.libraries" select="''"/> + + <!-- Whether to rewrite relative URL's to point to the website --> + <xsl:param name="boost.url.prefix"/> + + <!-- A space-separated list of xml elements in the input file for which + whitespace should be preserved --> + <xsl:preserve-space elements="*"/> + + <!-- The root for boost headers --> + <xsl:param name="boost.header.root"> + <xsl:if test="$boost.url.prefix"> + <xsl:value-of select="$boost.url.prefix"/> + <xsl:text>/</xsl:text> + </xsl:if> + <xsl:value-of select="$boost.root"/> + </xsl:param> + + <!-- The prefix for 'boost:' links. --> + <xsl:variable name="boost.protocol.text"> + <xsl:if test="($boost.url.prefix != '') and (contains($boost.root, '://') = 0)"> + <xsl:value-of select="concat($boost.url.prefix, '/', $boost.root)"/> + </xsl:if> + <xsl:if test="($boost.url.prefix = '') or contains($boost.root, '://')"> + <xsl:value-of select="$boost.root"/> + </xsl:if> + </xsl:variable> + + <xsl:template match="library-reference"> + <xsl:choose> + <xsl:when test="ancestor::library-reference"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <section> + <xsl:choose> + <xsl:when test="@id"> + <xsl:attribute name="id"> + <xsl:value-of select="@id"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="ancestor::library/attribute::id"> + <xsl:attribute name="id"> + <xsl:value-of select="ancestor::library/attribute::id"/> + <xsl:text>.reference</xsl:text> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:if test="not(title)"> + <title> + <xsl:text>Reference</xsl:text> + </title> + </xsl:if> + + <xsl:if test="concept"> + <section> + <xsl:choose> + <xsl:when test="@id"> + <xsl:attribute name="id"> + <xsl:value-of select="@id"/> + <xsl:text>.concepts</xsl:text> + </xsl:attribute> + </xsl:when> + <xsl:when test="ancestor::library/attribute::id"> + <xsl:attribute name="id"> + <xsl:value-of select="ancestor::library/attribute::id"/> + <xsl:text>.concepts</xsl:text> + </xsl:attribute> + </xsl:when> + </xsl:choose> + + <title>Concepts</title> + + <itemizedlist> + <xsl:for-each select="concept"> + <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> + </simpara></listitem> + </xsl:for-each> + </itemizedlist> + </section> + </xsl:if> + + <xsl:apply-templates/> + </section> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="header"> + <xsl:if test="*"> + <section> + <xsl:attribute name="id"> + <xsl:call-template name="generate.id"/> + </xsl:attribute> + + <title> + <xsl:text>Header <</xsl:text> + <ulink> + <xsl:attribute name="url"> + <xsl:value-of select="$boost.header.root"/> + <xsl:text>/</xsl:text> + <xsl:value-of select="@name"/> + </xsl:attribute> + <xsl:value-of select="@name"/> + </ulink> + <xsl:text>></xsl:text> + </title> + + <xsl:apply-templates select="para|section" mode="annotation"/> + + <xsl:if test="macro"> + <xsl:call-template name="synopsis"> + <xsl:with-param name="text"> + <xsl:apply-templates mode="synopsis" select="macro"> + <xsl:with-param name="indentation" select="0"/> + </xsl:apply-templates> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + + <xsl:if test="descendant::class|descendant::struct|descendant::union + |descendant::function|descendant::free-function-group + |descendant::overloaded-function|descendant::enum + |descendant::typedef"> + <xsl:call-template name="synopsis"> + <xsl:with-param name="text"> + <xsl:apply-templates mode="synopsis" + select="namespace|class|struct|union + |function|free-function-group + |overloaded-function|enum + |typedef"> + <xsl:with-param name="indentation" select="0"/> + </xsl:apply-templates> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + + <xsl:apply-templates mode="namespace-reference"/> + </section> + </xsl:if> + </xsl:template> + + <xsl:template match="header" mode="generate.id"> + <xsl:text>header.</xsl:text> + <xsl:value-of select="translate(@name, '/.', '._')"/> + </xsl:template> + + <xsl:template match="*" mode="passthrough"> + <xsl:copy-of select="."/> + </xsl:template> + + <xsl:template name="monospaced"> + <xsl:param name="text"/> + <computeroutput><xsl:value-of select="$text"/></computeroutput> + </xsl:template> + + <!-- Linking --> + <xsl:template match="ulink"> + <xsl:copy> + <xsl:copy-of select="@*"/> + <xsl:attribute name="url"> + <xsl:choose> + <xsl:when test="starts-with(@url, 'boost:/')"> + <xsl:value-of select="concat($boost.protocol.text, substring-after(@url, 'boost:'))"/> + </xsl:when> + <xsl:when test="starts-with(@url, 'boost:')"> + <xsl:value-of select="concat($boost.protocol.text, '/', substring-after(@url, 'boost:'))"/> + </xsl:when> + <xsl:when test="$boost.url.prefix != '' and not(contains(@url, ':') or starts-with(@url, '//'))"> + <xsl:value-of select="concat($boost.url.prefix, '/', @url)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@url"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:apply-templates/> + </xsl:copy> + </xsl:template> + <xsl:template name="internal-link"> + <xsl:param name="to"/> + <xsl:param name="text"/> + <xsl:param name="highlight" select="false()"/> + + <link linkend="{$to}"> + <xsl:if test="$highlight"> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not($highlight)"> + <xsl:value-of select="string($text)"/> + </xsl:if> + </link> + </xsl:template> + + <xsl:template name="anchor"> + <xsl:param name="to"/> + <xsl:param name="text"/> + <xsl:param name="highlight" select="false()"/> + + <anchor id="{$to}"/> + <xsl:if test="$highlight"> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not($highlight)"> + <xsl:value-of select="$text"/> + </xsl:if> + </xsl:template> + + <xsl:template name="link-or-anchor"> + <xsl:param name="to"/> + <xsl:param name="text"/> + + <!-- True if we should create an anchor, otherwise we will create + a link. If you require more control (e.g., with the possibility of + having no link or anchor), set link-type instead: if present, it + takes precedence. --> + <xsl:param name="is-anchor"/> + + <!-- 'anchor', 'link', or 'none' --> + <xsl:param name="link-type"> + <xsl:choose> + <xsl:when test="$is-anchor"> + <xsl:text>anchor</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>link</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + + <xsl:param name="highlight" select="false()"/> + + <xsl:choose> + <xsl:when test="$link-type='anchor'"> + <xsl:call-template name="anchor"> + <xsl:with-param name="to" select="$to"/> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$link-type='link'"> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to" select="$to"/> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$link-type='none'"> + <xsl:if test="$highlight"> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="not($highlight)"> + <xsl:value-of select="$text"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:message> +Error: XSL template 'link-or-anchor' called with invalid link-type '<xsl:value-of select="$link-type"/>' + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="separator"/> + + <xsl:template name="reference-documentation"> + <xsl:param name="name"/> + <xsl:param name="refname"/> + <xsl:param name="purpose"/> + <xsl:param name="anchor"/> + <xsl:param name="synopsis"/> + <xsl:param name="text"/> + + <refentry id="{$anchor}"> + <refmeta> + <refentrytitle><xsl:value-of select="$name"/></refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + <refnamediv> + <refname><xsl:value-of select="$refname"/></refname> + <refpurpose> + <xsl:apply-templates mode="purpose" select="$purpose"/> + </refpurpose> + </refnamediv> + <refsynopsisdiv> + <synopsis> + <xsl:copy-of select="$synopsis"/> + </synopsis> + </refsynopsisdiv> + <xsl:if test="not(string($text)='')"> + <refsect1> + <title>Description</title> + <xsl:copy-of select="$text"/> + </refsect1> + </xsl:if> + </refentry> + </xsl:template> + + <xsl:template name="member-documentation"> + <xsl:param name="name"/> + <xsl:param name="text"/> + + <refsect2> + <title><xsl:copy-of select="$name"/></title> + <xsl:copy-of select="$text"/> + </refsect2> + </xsl:template> + + <xsl:template name="preformatted"> + <xsl:param name="text"/> + + <literallayout class="monospaced"> + <xsl:copy-of select="$text"/> + </literallayout> + </xsl:template> + + <xsl:template name="synopsis"> + <xsl:param name="text"/> + + <synopsis> + <xsl:copy-of select="$text"/> + </synopsis> + </xsl:template> + + <!-- Fallthrough for DocBook elements --> + <xsl:template match="*"> + <xsl:element name="{name(.)}"> + <xsl:for-each select="./@*"> + <xsl:choose> + <xsl:when test="local-name(.)='last-revision'"> + <xsl:attribute + name="rev:last-revision" + namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="{name(.)}"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <xsl:apply-templates/> + </xsl:element> + </xsl:template> + + <xsl:template match="processing-instruction()"> + <xsl:copy/> + </xsl:template> + + <xsl:template match="code"> + <computeroutput> + <xsl:apply-templates mode="annotation"/> + </computeroutput> + </xsl:template> + + <xsl:template match="code[@language='jam']"> + <computeroutput> + <xsl:apply-templates mode="highlight-jam"/> + </computeroutput> + </xsl:template> + + <xsl:template match="code[@language='c++']"> + <xsl:apply-templates select="." mode="annotation"/> + </xsl:template> + + <xsl:template match="bold"> + <emphasis role="bold"> + <xsl:apply-templates mode="annotation"/> + </emphasis> + </xsl:template> + + <xsl:template match="library"> + <xsl:if test="not(@html-only = 1) and + ($boost.include.libraries='' or + contains($boost.include.libraries, @id))"> + <chapter> + <xsl:copy-of select="@*[not(contains(' last-revision name dirname html-only url ', concat(' ',local-name(),' ')))]"/> + <xsl:if test="not(@id)"> + <xsl:attribute name="id"> + <xsl:call-template name="generate.id"/> + </xsl:attribute> + </xsl:if> + + <xsl:if test="@last-revision"> + <xsl:attribute + name="rev:last-revision" + namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"> + <xsl:value-of select="@last-revision"/> + </xsl:attribute> + </xsl:if> + <xsl:apply-templates/> + </chapter> + </xsl:if> + </xsl:template> + + <xsl:template match="chapter"> + <xsl:if test="$boost.include.libraries=''"> + <chapter> + <xsl:copy-of select="./@*" /> + <xsl:apply-templates/> + </chapter> + </xsl:if> + </xsl:template> + + <xsl:template match="boostbook"> + <book> + <xsl:copy-of select="@*[not(contains(' last-revision name dirname html-only url ', concat(' ',local-name(),' ')))]"/> + <xsl:apply-templates/> + </book> + </xsl:template> + + <xsl:template match="programlisting"> + <programlisting><xsl:apply-templates/></programlisting> + </xsl:template> + + <xsl:template match="programlisting[@language='jam']"> + <programlisting> + <xsl:apply-templates mode="highlight-jam"/> + </programlisting> + </xsl:template> + + <xsl:template match="programlisting[@language='c++']"> + <xsl:apply-templates select="." mode="annotation"/> + </xsl:template> + + <!-- These DocBook elements have special meaning. Use the annotation mode --> + <xsl:template match="classname|methodname|functionname|enumname| + macroname|headername|globalname"> + <computeroutput> + <xsl:apply-templates select="." mode="annotation"/> + </computeroutput> + </xsl:template> + + <xsl:template match="libraryname|conceptname"> + <xsl:apply-templates select="." mode="annotation"/> + </xsl:template> + + <xsl:template match="description"> + <xsl:apply-templates mode="annotation"/> + </xsl:template> + + <!-- Swallow using-namespace and using-class directives along with + last-revised elements --> + <xsl:template match="using-namespace|using-class|last-revised"/> + + <!-- If there is no "namespace-reference" mode, forward to + "reference" mode --> + <xsl:template match="*" mode="namespace-reference"> + <xsl:apply-templates select="." mode="reference"/> + </xsl:template> + + <!-- Make the various blocks immediately below a "part" be + "chapter"-s. Must also take into account turning + chapters within chpaters into sections. --> + <xsl:template match="part/part|part/article"> + <chapter> + <xsl:copy-of select="./@*"/> + <xsl:apply-templates/> + </chapter> + </xsl:template> + <xsl:template match="part/part/partinfo|part/article/articleinfo"> + <chapterinfo><xsl:apply-templates/></chapterinfo> + </xsl:template> + <xsl:template match="part/part/chapter|part/part/appendix"> + <section> + <xsl:copy-of select="./@*"/> + <xsl:apply-templates/> + </section> + </xsl:template> + <xsl:template match="part/part/chapter/chapterinfo|part/part/appendix/appendixinfo"> + <sectioninfo><xsl:apply-templates/></sectioninfo> + </xsl:template> + + <!-- Header link comment to be inserted at the start of a reference page's + synopsis --> + <xsl:template name="header-link"> + <xsl:if test="ancestor::header"> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// In header: <</xsl:text> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="ancestor::header[1]"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text" select="ancestor::header[1]/@name" /> + </xsl:call-template> + <xsl:text>> </xsl:text> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> +</xsl:stylesheet> + diff --git a/src/boost/tools/boostbook/xsl/doxygen/collect.xsl b/src/boost/tools/boostbook/xsl/doxygen/collect.xsl new file mode 100644 index 000000000..3ec164bed --- /dev/null +++ b/src/boost/tools/boostbook/xsl/doxygen/collect.xsl @@ -0,0 +1,58 @@ +<?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" version="1.0"> + <xsl:output method="xml" version="1.0" indent="yes" standalone="yes" /> + + <xsl:template match="/"> + <doxygen> + <xsl:attribute name="version"> + <xsl:choose> + <xsl:when test="doxygen"> + <xsl:value-of select="doxygen/attribute::version"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="doxygenindex/attribute::version"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + + <!-- Load all doxgen generated xml files --> + <xsl:for-each select="doxygen/compound"> + <xsl:variable name="id"> + <xsl:choose> + <xsl:when test="@refid"> + <xsl:value-of select="@refid"/> + </xsl:when> + <xsl:when test="@id"> + <xsl:value-of select="@id"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:if test="$id"> + <xsl:copy-of select="document( concat( $id, '.xml' ), / )/doxygen/*" /> + </xsl:if> + </xsl:for-each> + <xsl:for-each select="doxygenindex/compound"> + <xsl:variable name="id"> + <xsl:choose> + <xsl:when test="@refid"> + <xsl:value-of select="@refid"/> + </xsl:when> + <xsl:when test="@id"> + <xsl:value-of select="@id"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:if test="$id"> + <xsl:copy-of select="document( concat($id, '.xml'), /)/doxygen/*" /> + </xsl:if> + </xsl:for-each> + </doxygen> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl b/src/boost/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl new file mode 100644 index 000000000..5d68930e0 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/doxygen/doxygen2boostbook.xsl @@ -0,0 +1,1846 @@ +<?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" + version="1.0"> + <xsl:import href="../lookup.xsl"/> + + <!-- Set this parameter to a space-separated list of headers that + will be included in the output (all others are ignored). If this + parameter is omitted or left as the empty string, all headers will + be output. --> + <xsl:param name="boost.doxygen.headers" select="''"/> + + <!-- The common prefix to all headers --> + <xsl:param name="boost.doxygen.header.prefix" select="'boost'"/> + + <!-- The text that Doxygen places in overloaded functions. Damn them + for forcing us to compare TEXT just to figure out what's overloaded + and what isn't. --> + <xsl:param name="boost.doxygen.overload"> + This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. + </xsl:param> + + <!-- The namespace used to identify code that should not be + processed at all. --> + <xsl:param name="boost.doxygen.detailns">detail</xsl:param> + + <!-- The substring used to identify unspecified types that we can't + mask from within Doxygen. This is a hack (big surprise). --> + <xsl:param name="boost.doxygen.detail"><xsl:value-of select="$boost.doxygen.detailns"/>::</xsl:param> + + <!-- The title that will be used for the BoostBook library reference emitted. + If left blank, BoostBook will assign a default title. --> + <xsl:param name="boost.doxygen.reftitle" select="''"/> + + <!-- The id used for the library-reference. By default, it is the normalized + form of the reftitle. --> + <xsl:param name="boost.doxygen.refid" select="''"/> + + <!-- The directory into which png files corresponding to LaTeX formulas will be found. --> + <xsl:param name="boost.doxygen.formuladir" select="'images/'"/> + + <xsl:output method="xml" indent="no" standalone="yes"/> + + <xsl:key name="compounds-by-kind" match="compounddef" use="@kind"/> + <xsl:key name="compounds-by-id" match="compounddef" use="@id"/> + <xsl:key name="members-by-id" match="memberdef" use="@id" /> + + <!-- Add trailing slash to formuladir if missing --> + + <xsl:variable name="boost.doxygen.formuladir.fixed"> + <xsl:choose> + <xsl:when test="substring(boost.doxygen.formuladir, string-length(boost.doxygen.formuladir) - 1) = '/'"> + <xsl:value-of select="$boost.doxygen.formuladir" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($boost.doxygen.formuladir, '/')" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:strip-space elements="briefdescription detaileddescription inbodydescription"/> + + <xsl:template name="kind-error-message"> + <xsl:param name="message"/> + + <xsl:variable name="location" select=".//location[1]" /> + <xsl:variable name="name" select="./name" /> + + <xsl:message> + <xsl:if test="$location"> + <xsl:value-of select="concat($location/@file, ':', $location/@line, ': ')" /> + </xsl:if> + <xsl:value-of select="concat($message, ' with kind=', @kind)" /> + <xsl:if test="$name"> + <xsl:value-of select="concat(' (name=', $name, ') ')" /> + </xsl:if> + </xsl:message> + </xsl:template> + + <!-- translate-name: given a string, return a string suitable for use as a refid --> + <xsl:template name="translate-name"> + <xsl:param name="name"/> + <xsl:value-of select="translate($name, + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ~!%^&*()[].,<>|/ +-=', + 'abcdefghijklmnopqrstuvwxyz_____________________')"/> + </xsl:template> + + <xsl:template match="/"> + <xsl:apply-templates select="doxygen"/> + </xsl:template> + + <xsl:template match="doxygen"> + <library-reference> + <xsl:if test="string($boost.doxygen.reftitle) != ''"> + <!-- when a reference section has a reftitle, also give it a refid. The id + is determined by the boost.doxygen.refid param, which defaults to a + normalized form of the boost.doxygen.reftitle --> + <xsl:attribute name="id"> + <xsl:choose> + <xsl:when test="string($boost.doxygen.refid) != ''"> + <xsl:value-of select="$boost.doxygen.refid"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="translate-name"> + <xsl:with-param name="name" select="$boost.doxygen.reftitle"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + + <title><xsl:copy-of select="$boost.doxygen.reftitle"/></title> + </xsl:if> + <xsl:apply-templates select="key('compounds-by-kind', 'file')"/> + </library-reference> + </xsl:template> + + <xsl:template match="compounddef"> + <!-- The set of innernamespace nodes that limits our search --> + <xsl:param name="with-namespace-refs"/> + <xsl:param name="in-file"/> + + <xsl:choose> + <!-- If the string INTERNAL ONLY is in the description, don't + emit this entity. This hack is necessary because Doxygen doesn't + tell us what is \internal and what isn't. --> + <xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/> + + <xsl:when test="@kind='file'"> + <xsl:call-template name="file"/> + </xsl:when> + <xsl:when test="@kind='namespace'"> + <xsl:call-template name="namespace"> + <xsl:with-param name="with-namespace-refs" + select="$with-namespace-refs"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@kind='class'"> + <xsl:call-template name="class"> + <xsl:with-param name="class-key" select="'class'"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@kind='struct'"> + <xsl:call-template name="class"> + <xsl:with-param name="class-key" select="'struct'"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@kind='union'"> + <xsl:call-template name="class"> + <xsl:with-param name="class-key" select="'union'"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="kind-error-message"> + <xsl:with-param name="message" select="'Cannot handle compounddef'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="namespace"> + <!-- The set of innernamespace nodes that limits our search --> + <xsl:param name="with-namespace-refs"/> + <xsl:param name="in-file"/> + + <xsl:variable name="fullname" select="string(compoundname)"/> + + <xsl:if test="$with-namespace-refs[string(text())=$fullname] + and not(contains($fullname, $boost.doxygen.detailns))"> + <!-- Namespace without the prefix --> + <xsl:variable name="rest"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="compoundname"/> + </xsl:call-template> + </xsl:variable> + + <!-- Grab only the namespace name, not any further nested namespaces --> + <xsl:variable name="name"> + <xsl:choose> + <xsl:when + test="contains($rest, '::')"> + <xsl:value-of select="substring-before($rest, '::')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$rest"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <namespace> + <xsl:attribute name="name"> + <xsl:value-of select="$name"/> + </xsl:attribute> + <xsl:text> </xsl:text><!-- Newline --> + + <xsl:apply-templates> + <xsl:with-param name="with-namespace-refs" + select="$with-namespace-refs"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </namespace> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:if> + </xsl:template> + + <xsl:template name="class"> + <xsl:param name="class-key"/> + <xsl:param name="in-file"/> + <xsl:param name="with-namespace-refs"/> + + <xsl:if test="string(location/attribute::file)=$in-file"> + + <!-- The short name of this class --> + <xsl:variable name="name-with-spec"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="compoundname"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="name"> + <xsl:choose> + <xsl:when test="contains($name-with-spec, '<')"> + <xsl:value-of select="substring-before($name-with-spec, '<')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$name-with-spec"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="specialization"> + <xsl:if test="contains($name-with-spec, '<')"> + <xsl:variable name="spec-with-gt" + select="substring-after($name-with-spec, '<')"/> + <xsl:value-of select="substring($spec-with-gt, 1, + string-length($spec-with-gt)-1)"/> + </xsl:if> + </xsl:variable> + + <xsl:variable name="actual-class-key"> + <xsl:value-of select="$class-key"/> + <xsl:if test="string-length($specialization) > 0"> + <xsl:text>-specialization</xsl:text> + </xsl:if> + </xsl:variable> + + <xsl:element name="{$actual-class-key}"> + <xsl:attribute name="name"> + <xsl:value-of select="$name"/> + </xsl:attribute> + + <xsl:apply-templates select="templateparamlist" mode="template"/> + + <xsl:if test="string-length($specialization) > 0"> + <specialization> + <xsl:call-template name="specialization"> + <xsl:with-param name="specialization" select="$specialization"/> + </xsl:call-template> + </specialization> + </xsl:if> + + <xsl:apply-templates select="basecompoundref" mode="inherit"/> + + <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:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:element> + </xsl:if> + </xsl:template> + + <xsl:template name="enum"> + <xsl:param name="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"/> + </xsl:call-template> + </xsl:variable> + + <enum> + <xsl:attribute name="name"> + <xsl:value-of select="$name"/> + </xsl:attribute> + + <xsl:apply-templates select="enumvalue"/> + + <xsl:apply-templates select="briefdescription" mode="passthrough"/> + <xsl:apply-templates select="detaileddescription" mode="passthrough"/> + <xsl:apply-templates select="inbodydescription" mode="passthrough"/> + </enum> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:if> + </xsl:template> + + <xsl:template match="enumvalue"> + <xsl:choose> + <!-- If the string INTERNAL ONLY is in the description, don't + emit this entity. This hack is necessary because Doxygen doesn't + tell us what is \internal and what isn't. --> + <xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/> + <xsl:otherwise> + + <enumvalue> + <xsl:attribute name="name"> + <xsl:value-of select="name"/> + </xsl:attribute> + + <xsl:if test="initializer"> + <default> + <xsl:apply-templates select="initializer/*|initializer/text()" mode="passthrough"/> + </default> + </xsl:if> + + <xsl:apply-templates select="briefdescription" mode="passthrough"/> + <xsl:apply-templates select="detaileddescription" mode="passthrough"/> + <xsl:apply-templates select="inbodydescription" mode="passthrough"/> + </enumvalue> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="doxygen.include.header.rec"> + <xsl:param name="name"/> + <xsl:param name="header-list" select="$boost.doxygen.headers"/> + + <xsl:choose> + <xsl:when test="contains($header-list, ' ')"> + <xsl:variable name="header" + select="substring-before($header-list, ' ')"/> + <xsl:variable name="rest" select="substring-after($header-list, ' ')"/> + + <xsl:choose> + <xsl:when test="$name=$header"> + <xsl:text>yes</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="doxygen.include.header.rec"> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="header-list" select="$rest"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$name=$header-list"> + <xsl:text>yes</xsl:text> + </xsl:when> + </xsl:choose> + </xsl:template> + + <xsl:template name="doxygen.include.header"> + <xsl:param name="name"/> + + <xsl:if test="$boost.doxygen.headers=''"> + <xsl:text>yes</xsl:text> + </xsl:if> + <xsl:if test="not($boost.doxygen.headers='')"> + <xsl:call-template name="doxygen.include.header.rec"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="file"> + <xsl:variable name="include-header"> + <xsl:call-template name="doxygen.include.header"> + <xsl:with-param name="name" select="string(compoundname)"/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$include-header='yes'"> + <header> + <xsl:attribute name="name"> + <xsl:call-template name="shorten.header.name"> + <xsl:with-param name="header" select="location/attribute::file"/> + </xsl:call-template> + </xsl:attribute> + <xsl:text> </xsl:text><!-- Newline --> + + <xsl:if test="briefdescription/*|detaileddescription/*|inbodydescription/*"> + <xsl:apply-templates select="briefdescription/*" mode="passthrough"/> + <xsl:apply-templates select="detaileddescription/*" mode="passthrough"/> + <xsl:apply-templates select="inbdoydescription/*" mode="passthrough"/> + </xsl:if> + + <xsl:apply-templates mode="toplevel"> + <xsl:with-param name="with-namespace-refs" + select="innernamespace"/> + <xsl:with-param name="in-file" select="location/attribute::file"/> + </xsl:apply-templates> + </header> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:if> + </xsl:template> + + <xsl:template name="shorten.header.name"> + <xsl:param name="header"/> + + <xsl:variable name="prefix"> + <xsl:value-of select="concat($boost.doxygen.header.prefix, '/')"/> + </xsl:variable> + + <xsl:choose> + <xsl:when test="contains($header, $prefix)"> + <xsl:variable name="rest" select="substring-after($header, $prefix)"/> + <xsl:choose> + <xsl:when test="contains($rest, $prefix)"> + <xsl:call-template name="shorten.header.name"> + <xsl:with-param name="header" select="$rest"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$prefix"/> + <xsl:value-of select="$rest"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$header"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <xsl:template match="innernamespace"> + <xsl:param name="with-namespace-refs"/> + <xsl:param name="in-file"/> + + <xsl:apply-templates select="key('compounds-by-id', @refid)"> + <xsl:with-param name="with-namespace-refs" + select="$with-namespace-refs"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="innernamespace" mode="toplevel"> + <!-- The set of innernamespace nodes that limits our search --> + <xsl:param name="with-namespace-refs"/> + <xsl:param name="in-file"/> + + <!-- The full name of the namespace we are referring to --> + <xsl:variable name="fullname" + select="string(key('compounds-by-id', @refid)/compoundname)"/> + + <!-- Only pass on top-level namespaces --> + <xsl:if test="not(contains($fullname, '::'))"> + <xsl:apply-templates select="key('compounds-by-id', @refid)"> + <xsl:with-param name="with-namespace-refs" + select="$with-namespace-refs"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:if> + </xsl:template> + + <xsl:template match="sectiondef" mode="toplevel"> + <xsl:param name="in-file" select="''"/> + + <xsl:apply-templates mode="toplevel" + select="memberdef[generate-id() = + generate-id(key('members-by-id', @id))]"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="memberdef" mode="toplevel"> + <xsl:param name="with-namespace-refs"/> + <xsl:param name="in-file"/> + + <xsl:choose> + <!-- If the string INTERNAL ONLY is in the description, don't + emit this entity. This hack is necessary because Doxygen doesn't + tell us what is \internal and what isn't. --> + <xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/> + + <xsl:when test="@kind='define'"> + <macro> + <xsl:attribute name="name"> + <xsl:value-of select="name/text()"/> + </xsl:attribute> + + <xsl:if test="param"> + <xsl:attribute name="kind"> + <xsl:value-of select="'functionlike'"/> + </xsl:attribute> + </xsl:if> + + <xsl:for-each select="param"> + <xsl:variable name="name" select="defname/text()"/> + <macro-parameter> + <xsl:attribute name="name"> + <xsl:value-of select="defname/text()"/> + </xsl:attribute> + <xsl:variable name="params" + select="../detaileddescription/para/parameterlist"/> + <xsl:variable name="description" select="$params/parameteritem/ + parameternamelist/parametername[text() = $name]/../../parameterdescription/para"/> + <xsl:if test="$description"> + <description> + <xsl:apply-templates select="$description" mode="passthrough"/> + </description> + </xsl:if> + </macro-parameter> + </xsl:for-each> + + <xsl:apply-templates select="briefdescription" mode="passthrough"/> + <xsl:apply-templates select="detaileddescription" mode="passthrough"/> + <xsl:apply-templates select="inbodydescription" mode="passthrough"/> + </macro> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:when> + + <xsl:when test="@kind='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:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="@kind='variable'"> + <xsl:call-template name="variable" /> + </xsl:when> + + <xsl:when test="@kind='enum'"> + <xsl:call-template name="enum" /> + </xsl:when> + + <xsl:otherwise> + <xsl:call-template name="kind-error-message"> + <xsl:with-param name="message" select="'Cannot handle toplevel memberdef element'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="innerclass" mode="toplevel"> + <xsl:param name="with-namespace-refs"/> + <xsl:param name="in-file"/> + + <xsl:variable name="name"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" select="."/> + </xsl:call-template> + </xsl:variable> + + <!-- Only process this if it is indeed global --> + <xsl:if test=".=$name"> + <xsl:apply-templates select="key('compounds-by-id', @refid)"> + <xsl:with-param name="with-namespace-refs" + select="$with-namespace-refs"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:if> + </xsl:template> + + <xsl:template match="innerclass"> + <xsl:param name="with-namespace-refs"/> + <xsl:param name="in-file"/> + + <xsl:apply-templates select="key('compounds-by-id', @refid)"> + <xsl:with-param name="with-namespace-refs" + select="$with-namespace-refs"/> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:template> + + <!-- Classes --> + <xsl:template match="templateparamlist" mode="template"> + <template> + <xsl:apply-templates mode="template"/> + </template> + </xsl:template> + + <xsl:template match="param" mode="template"> + <xsl:choose> + <xsl:when test="string(type)='class' or string(type)='typename'"> + <xsl:variable name="name" select="normalize-space(string(declname))"/> + <template-type-parameter> + <xsl:attribute name="name"> + <xsl:value-of select="normalize-space(string(declname))"/> + </xsl:attribute> + <xsl:if test="defval"> + <default> + <xsl:apply-templates select="defval/*|defval/text()" + mode="passthrough"/> + </default> + </xsl:if> + <xsl:for-each select="../../detaileddescription//parameterlist[@kind='templateparam']/parameteritem"> + <xsl:if test="string(parameternamelist/parametername)=$name"> + <purpose> + <xsl:apply-templates select="parameterdescription/para" mode="passthrough"/> + </purpose> + </xsl:if> + </xsl:for-each> + </template-type-parameter> + </xsl:when> + <!-- Doxygen 1.5.8 generates odd xml for template type parameters. + This deals with that --> + <xsl:when test="not(declname) and + (starts-with(string(type), 'class ') or starts-with(string(type), 'typename '))"> + <template-type-parameter> + <xsl:variable name="name"> + <xsl:value-of select="normalize-space(substring-after(string(type), ' '))"/> + </xsl:variable> + <xsl:attribute name="name"> + <xsl:value-of select="$name"/> + </xsl:attribute> + <xsl:if test="defval"> + <default> + <xsl:apply-templates select="defval/*|defval/text()" + mode="passthrough"/> + </default> + </xsl:if> + <xsl:for-each select="../../detaileddescription//parameterlist[@kind='templateparam']/parameteritem"> + <xsl:if test="string(parameternamelist/parametername)=$name"> + <purpose> + <xsl:apply-templates select="parameterdescription/para" mode="passthrough"/> + </purpose> + </xsl:if> + </xsl:for-each> + </template-type-parameter> + </xsl:when> + <xsl:otherwise> + <template-nontype-parameter> + <xsl:variable name="name"> + <xsl:value-of select="normalize-space(string(declname))"/> + </xsl:variable> + <xsl:attribute name="name"> + <xsl:value-of select="$name"/> + </xsl:attribute> + <type> + <xsl:apply-templates select="type"/> + </type> + <xsl:if test="defval"> + <default> + <xsl:apply-templates select="defval/*|defval/text()" + mode="passthrough"/> + </default> + </xsl:if> + <xsl:for-each select="../../detaileddescription//parameterlist[@kind='templateparam']/parameteritem"> + <xsl:if test="string(parameternamelist/parametername)=$name"> + <purpose> + <xsl:apply-templates select="parameterdescription/para" mode="passthrough"/> + </purpose> + </xsl:if> + </xsl:for-each> + </template-nontype-parameter> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="templateparamlist"/> + + <!-- "Parse" a specialization from part of a name --> + <xsl:template name="specialization"> + <xsl:param name="specialization"/> + + <xsl:choose> + <xsl:when test="contains($specialization, ',')"> + <template-arg> + <xsl:value-of + select="normalize-space(substring-before($specialization, ','))"/> + </template-arg> + <xsl:call-template name="specialization"> + <xsl:with-param name="specialization" + select="substring-after($specialization, ',')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <template-arg> + <xsl:value-of select="normalize-space($specialization)"/> + </template-arg> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Inheritance --> + <xsl:template match="basecompoundref" mode="inherit"> + <xsl:choose> + <xsl:when test="contains(string(.), $boost.doxygen.detail)"/> + <xsl:otherwise> + <inherit> + <!-- Access specifier for inheritance --> + <xsl:attribute name="access"> + <xsl:value-of select="@prot"/> + </xsl:attribute> + <!-- TBD: virtual vs. non-virtual inheritance --> + + <xsl:apply-templates mode="passthrough"/> + </inherit> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="basecompoundref"/> + + <!-- Skip over sections: they aren't very useful at all --> + <xsl:template match="sectiondef"> + <xsl:param name="in-file" select="''"/> + + <xsl:choose> + <xsl:when test="@kind='public-static-func'"> + <!-- TBD: pass on the fact that these are static functions --> + <method-group name="public static functions"> + <xsl:text> </xsl:text><!-- Newline --> + <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:text> </xsl:text><!-- Newline --> + </xsl:when> + <xsl:when test="@kind='protected-static-func'"> + <!-- TBD: pass on the fact that these are static functions --> + <method-group name="protected static functions"> + <xsl:text> </xsl:text><!-- Newline --> + <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:text> </xsl:text><!-- Newline --> + </xsl:when> + <xsl:when test="@kind='private-static-func'"> + <!-- TBD: pass on the fact that these are static functions --> + <method-group name="private static functions"> + <xsl:text> </xsl:text><!-- Newline --> + <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:text> </xsl:text><!-- Newline --> + </xsl:when> + <xsl:when test="@kind='public-func'"> + <xsl:variable name="members" select="./memberdef"/> + <xsl:variable name="num-internal-only"> + <xsl:value-of + select="count($members[contains(detaileddescription/para, + 'INTERNAL ONLY')])"/> + </xsl:variable> + <xsl:if test="$num-internal-only < count($members)"> + <method-group name="public member functions"> + <xsl:text> </xsl:text><!-- Newline --> + <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:text> </xsl:text><!-- Newline --> + <xsl:apply-templates/> + </xsl:if> + </xsl:when> + <xsl:when test="@kind='protected-func'"> + <method-group name="protected member functions"> + <xsl:text> </xsl:text><!-- Newline --> + <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:text> </xsl:text><!-- Newline --> + <xsl:apply-templates/> + </xsl:when> + <xsl:when test="@kind='private-func'"> + <xsl:variable name="members" select="./memberdef"/> + <xsl:variable name="num-internal-only"> + <xsl:value-of + select="count($members[contains(detaileddescription/para, + 'INTERNAL ONLY')])"/> + </xsl:variable> + <xsl:if test="$num-internal-only < count($members)"> + <method-group name="private member functions"> + <xsl:text> </xsl:text><!-- Newline --> + <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:text> </xsl:text><!-- Newline --> + </xsl:if> + <xsl:apply-templates/> + </xsl:when> + <xsl:when test="@kind='friend'"> + <xsl:if test="./memberdef/detaileddescription/para or ./memberdef/briefdescription/para"> + <method-group name="friend functions"> + <xsl:text> </xsl:text><!-- Newline --> + <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:text> </xsl:text><!-- Newline --> + </xsl:if> + </xsl:when> + <xsl:when test="@kind='public-static-attrib' or @kind='public-attrib'"> + <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:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="@kind='private-type'"> + <!--skip private members--> + </xsl:when> + <xsl:when test="@kind='private-static-attrib' or @kind='private-attrib'"> + <!--skip private members--> + </xsl:when> + <xsl:when test="@kind='func'"> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="@kind='typedef'"> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="@kind='var'"> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="@kind='enum'"> + <xsl:apply-templates> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:when> + <xsl:when test="@kind='user-defined'"> + <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() = + generate-id(key('members-by-id', @id))]"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="kind-error-message"> + <xsl:with-param name="message" select="'Cannot handle sectiondef'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Handle member definitions --> + <xsl:template match="memberdef"> + <!-- True when we're inside a section --> + <xsl:param name="in-section" select="false()"/> + <xsl:param name="in-file" select="''"/> + + <xsl:choose> + <!-- If the string INTERNAL ONLY is in the description, don't + emit this entity. This hack is necessary because Doxygen doesn't + tell us what is \internal and what isn't. --> + <xsl:when test="contains(detaileddescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(briefdescription/para, 'INTERNAL ONLY')"/> + <xsl:when test="contains(inbodydescription/para, 'INTERNAL ONLY')"/> + + <xsl:when test="@kind='typedef'"> + <xsl:call-template name="typedef"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@kind='function'"> + <xsl:choose> + <xsl:when test="ancestor::compounddef/attribute::kind='namespace'"> + <xsl:call-template name="function"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- We are in a class --> + <!-- The name of the class we are in --> + <xsl:variable name="in-class-full"> + <xsl:call-template name="strip-qualifiers"> + <xsl:with-param name="name" + select="string(ancestor::compounddef/compoundname/text())"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name ="in-class"> + <xsl:choose> + <xsl:when test="contains($in-class-full, '<')"> + <xsl:value-of select="substring-before($in-class-full, '<')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$in-class-full"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + <xsl:when test="string(name/text())=$in-class"> + <xsl:if test="not ($in-section)"> + <xsl:call-template name="constructor"/> + </xsl:if> + </xsl:when> + <xsl:when test="string(name/text())=concat('~',$in-class)"> + <xsl:if test="not ($in-section)"> + <xsl:call-template name="destructor"/> + </xsl:if> + </xsl:when> + <xsl:when test="string(name/text())='operator='"> + <xsl:if test="not ($in-section)"> + <xsl:call-template name="copy-assignment"/> + </xsl:if> + </xsl:when> + <xsl:when test="normalize-space(string(type))='' + and contains(name/text(), 'operator ')"> + <xsl:if test="$in-section"> + <xsl:call-template name="conversion-operator"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:if test="$in-section"> + <xsl:call-template name="method"/> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="@kind='friend'"> + <xsl:if test="./detaileddescription/para or ./briefdescription/para"> + <xsl:call-template name="method"/> + </xsl:if> + </xsl:when> + <xsl:when test="@kind='enum'"> + <xsl:call-template name="enum"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="@kind='variable'"> + <xsl:call-template name="variable"> + <xsl:with-param name="in-file" select="$in-file"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="kind-error-message"> + <xsl:with-param name="message" select="'Cannot handle memberdef element'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Display typedefs --> + <xsl:template name="typedef"> + <xsl:param name="in-file" select="''"/> + + <xsl:if test="string(location/attribute::file)=$in-file"> + <!-- TBD: Handle public/protected/private --> + <typedef> + <!-- Name of the type --> + <xsl:attribute name="name"> + <xsl:value-of select="name/text()"/> + </xsl:attribute> + + <xsl:apply-templates select="briefdescription" mode="passthrough"/> + <xsl:apply-templates select="detaileddescription" mode="passthrough"/> + <xsl:apply-templates select="inbodydescription" mode="passthrough"/> + + <type><xsl:apply-templates select="type"/></type> + </typedef> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:if> + </xsl:template> + + <!-- Handle function parameters --> + <xsl:template match="param" mode="function"> + <parameter> + <!-- Parameter name --> + <xsl:attribute name="name"> + <xsl:value-of select="normalize-space(declname/text())"/> + </xsl:attribute> + + <!-- Parameter type --> + <paramtype><xsl:apply-templates select="type"/></paramtype> + + <!-- Default argument --> + <xsl:if test="defval"> + <default> + <xsl:choose> + <xsl:when test="contains(string(defval), $boost.doxygen.detail)"> + <emphasis>unspecified</emphasis> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="defval/*|defval/text()" + mode="passthrough"/> + </xsl:otherwise> + </xsl:choose> + + </default> + </xsl:if> + + <!-- Parameter description --> + <xsl:variable name="name"> + <xsl:value-of select="normalize-space(declname/text())"/> + </xsl:variable> + + <xsl:apply-templates select="../*[self::detaileddescription or self::inbodydescription]//parameterlist[attribute::kind='param']/*" + mode="parameter.description"> + <xsl:with-param name="name"> + <xsl:value-of select="$name"/> + </xsl:with-param> + </xsl:apply-templates> + </parameter> + </xsl:template> + + <xsl:template match="parameteritem" mode="parameter.description"> + <!-- The parameter name we are looking for --> + <xsl:param name="name"/> + + <xsl:if test="string(parameternamelist/parametername) = $name"> + <description> + <xsl:apply-templates select="parameterdescription/para" mode="passthrough"/> + </description> + </xsl:if> + </xsl:template> + + <!-- For older versions of Doxygen, which didn't use parameteritem --> + <xsl:template match="parameterdescription" mode="parameter.description"> + <!-- The parameter name we are looking for --> + <xsl:param name="name"/> + + <!-- The parametername node associated with this description --> + <xsl:variable name="name-node" select="preceding-sibling::*[1]"/> + + <xsl:if test="string($name-node/text()) = $name"> + <description> + <xsl:apply-templates select="para" mode="passthrough"/> + </description> + </xsl:if> + </xsl:template> + + <xsl:template name="function.attributes"> + + <!-- argsstring = '(arguments) [= delete] [= default] [constexpt]' --> + <xsl:variable name="extra-qualifiers-a"> + <xsl:if test="contains(argsstring/text(), '(')"> + <xsl:call-template name="strip-brackets"> + <xsl:with-param name="text" select="substring-after(argsstring/text(), '(')" /> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="extra-qualifiers"> + <xsl:if test="$extra-qualifiers-a"> + <xsl:value-of select="concat(' ', normalize-space($extra-qualifiers-a), ' ')" /> + </xsl:if> + </xsl:variable> + + <!-- CV Qualifiers --> + <!-- Plus deleted and defaulted function markers as they're not properly + supported in boostbook --> + + <!-- noexcept is complicated because is can have parameters. + TODO: should really remove the noexcept parameters before doing + anything else. --> + <xsl:variable name="noexcept"> + <xsl:choose> + <xsl:when test="contains($extra-qualifiers, ' noexcept(')"> + <xsl:call-template name="noexcept-if"> + <xsl:with-param name="condition" select="substring-after($extra-qualifiers, ' noexcept(')" /> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($extra-qualifiers, ' BOOST_NOEXCEPT_IF(')"> + <xsl:call-template name="noexcept-if"> + <xsl:with-param name="condition" select="substring-after($extra-qualifiers, ' BOOST_NOEXCEPT_IF(')" /> + </xsl:call-template> + </xsl:when> + + <xsl:when test="contains($extra-qualifiers, ' noexcept ') or contains($extra-qualifiers, ' BOOST_NOEXCEPT ')"> + <xsl:value-of select="'noexcept '" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <!-- Calculate constexpr now, so that we can avoid it getting confused + with const --> + <xsl:variable name="constexpr" select=" + contains($extra-qualifiers, ' const expr ') or + contains($extra-qualifiers, ' BOOST_CONSTEXPR ') or + contains($extra-qualifiers, ' BOOST_CONSTEXPR_OR_CONST ')" /> + + <!-- The 'substring' trick includes the string if the condition is true --> + <xsl:variable name="cv-qualifiers" select="normalize-space(concat( + substring('constexpr ', 1, 999 * $constexpr), + substring('const ', 1, 999 * (not($constexpr) and @const='yes')), + substring('volatile ', 1, 999 * (@volatile='yes' or contains($extra-qualifiers, ' volatile '))), + $noexcept, + substring('= delete ', 1, 999 * contains($extra-qualifiers, ' =delete ')), + substring('= default ', 1, 999 * contains($extra-qualifiers, ' =default ')), + substring('= 0 ', 1, 999 * (@virt = 'pure-virtual')), + ''))" /> + + <!-- Specifiers --> + <xsl:variable name="specifiers" select="normalize-space(concat( + substring('explicit ', 1, 999 * (@explicit = 'yes')), + substring('virtual ', 1, 999 * ( + @virtual='yes' or @virt='virtual' or @virt='pure-virtual')), + substring('static ', 1, 999 * (@static = 'yes')), + ''))" /> + + <xsl:if test="$cv-qualifiers"> + <xsl:attribute name="cv"> + <xsl:value-of select="$cv-qualifiers" /> + </xsl:attribute> + </xsl:if> + + <xsl:if test="$specifiers"> + <xsl:attribute name="specifiers"> + <xsl:value-of select="$specifiers" /> + </xsl:attribute> + </xsl:if> + + </xsl:template> + + <!-- $condition = string after the opening bracket of the condition --> + <xsl:template name="noexcept-if"> + <xsl:param name="condition"/> + + <xsl:variable name="trailing"> + <xsl:call-template name="strip-brackets"> + <xsl:with-param name="text" select="$condition" /> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test="string-length($trailing)"> + <xsl:value-of select="concat( + 'noexcept(', + substring($condition, 1, string-length($condition) - string-length($trailing)), + ') ')" /> + </xsl:when> + <xsl:otherwise> + <!-- Something has gone wrong so: --> + <xsl:value-of select="'noexcept(condition) '" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- $text = substring after the opening bracket --> + <xsl:template name="strip-brackets"> + <xsl:param name="text"/> + + <xsl:if test="contains($text, ')')"> + <xsl:variable name="prefix1" select="substring-before($text, ')')" /> + <xsl:variable name="prefix2" select="substring($prefix1, 1, + string-length(substring-before($prefix1, '(')) + + 999 * not(contains($prefix1, '(')))" /> + <xsl:variable name="prefix3" select="substring($prefix2, 1, + string-length(substring-before($prefix2, '"')) + + 999 * not(contains($prefix2, '"')))" /> + <xsl:variable name="prefix" select="substring($prefix3, 1, + string-length(substring-before($prefix3, "'")) + + 999 * not(contains($prefix3, "'")))" /> + + <xsl:variable name="prefix-length" select="string-length($prefix)" /> + <xsl:variable name="char" select="substring($text, $prefix-length + 1, 1)" /> + + <xsl:choose> + <xsl:when test="$char=')'"> + <xsl:value-of select="substring($text, $prefix-length + 2)" /> + </xsl:when> + <xsl:when test="$char='('"> + <xsl:variable name="text2"> + <xsl:call-template name="strip-brackets"> + <xsl:with-param name="text" select="substring($text, $prefix-length + 2)" /> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="strip-brackets"> + <xsl:with-param name="text" select="$text2" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="$char="'""> + <!-- Not bothering with escapes, because this is crazy enough as it is --> + <xsl:call-template name="strip-brackets"> + <xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), "'")" /> + </xsl:call-template> + </xsl:when> + <xsl:when test="$char='"'"> + <!-- Not bothering with escapes, because this is crazy enough as it is --> + <xsl:call-template name="strip-brackets"> + <xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), '"')" /> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:if> + </xsl:template> + + <!-- Handle function children --> + <xsl:template name="function.children"> + <xsl:param name="is-overloaded" select="false()"/> + + <xsl:if test="not($is-overloaded)"> + <!-- Emit template header --> + <xsl:apply-templates select="templateparamlist" mode="template"/> + + <!-- Emit function parameters --> + <xsl:apply-templates select="param" mode="function"/> + </xsl:if> + + <!-- The description --> + <xsl:apply-templates select="briefdescription" mode="passthrough"/> + <xsl:apply-templates select="detaileddescription" mode="passthrough"/> + <xsl:apply-templates select="inbodydescription" mode="passthrough"/> + + <xsl:apply-templates + select="*[self::detaileddescription or self::inbodydescription]/para/simplesect[@kind='pre']" + mode="function-clauses"/> + <xsl:apply-templates + select="*[self::detaileddescription or self::inbodydescription]/para/simplesect[@kind='post']" + mode="function-clauses"/> + <xsl:apply-templates + select="*[self::detaileddescription or self::inbodydescription]/para/simplesect[@kind='return']" + mode="function-clauses"/> + <xsl:if test="*[self::detaileddescription or self::inbodydescription]/para/parameterlist[@kind='exception']"> + <throws> + <xsl:apply-templates + select="*[self::detaileddescription or self::inbodydescription]/para/parameterlist[@kind='exception']" + mode="function-clauses"/> + </throws> + </xsl:if> + </xsl:template> + + <!-- Handle free functions --> + <xsl:template name="function"> + <xsl:param name="in-file" select="''"/> + + <xsl:variable name="firstpara" + select="normalize-space(detaileddescription/para[1])"/> + <xsl:if test="string(location/attribute::file)=$in-file + and + not($firstpara=normalize-space($boost.doxygen.overload))"> + + <xsl:variable name="next-node" select="following-sibling::*[1]"/> + <xsl:variable name="has-overload"> + <xsl:if test="not(local-name($next-node)='memberdef')"> + false + </xsl:if> + <xsl:if test="not(string($next-node/name/text())=string(name/text()))"> + false + </xsl:if> + <xsl:if + test="not(normalize-space($next-node/detaileddescription/para[1]) + =normalize-space($boost.doxygen.overload))"> + false + </xsl:if> + </xsl:variable> + + <xsl:choose> + <xsl:when test="not(contains($has-overload, 'false'))"> + <overloaded-function> + <xsl:attribute name="name"> + <xsl:call-template name="normalize-name"/> + </xsl:attribute> + + <xsl:call-template name="overload-signatures"/> + <xsl:call-template name="function.children"> + <xsl:with-param name="is-overloaded" select="true()"/> + </xsl:call-template> + </overloaded-function> + </xsl:when> + <xsl:otherwise> + <function> + <xsl:attribute name="name"> + <xsl:call-template name="normalize-name"/> + </xsl:attribute> + + <!-- Return type --> + <type><xsl:apply-templates select="type"/></type> + + <xsl:call-template name="function.children"/> + </function> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:template> + + <!-- Emit overload signatures --> + <xsl:template name="overload-signatures"> + <xsl:param name="node" select="."/> + <xsl:param name="name" select="string(name/text())"/> + <xsl:param name="first" select="true()"/> + + <xsl:choose> + <xsl:when test="not(local-name($node)='memberdef')"/> + <xsl:when test="not(string($node/name/text())=$name)"/> + <xsl:when test="not(normalize-space($node/detaileddescription/para[1]) + =normalize-space($boost.doxygen.overload)) + and not($first)"/> + <xsl:otherwise> + <signature> + <type> + <xsl:apply-templates select="$node/type"/> + </type> + <xsl:apply-templates select="$node/templateparamlist" + mode="template"/> + <xsl:apply-templates select="$node/param" mode="function"/> + </signature> + + <xsl:call-template name="overload-signatures"> + <xsl:with-param name="node" select="$node/following-sibling::*[1]"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="first" select="false()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Handle constructors --> + <xsl:template name="constructor"> + <constructor> + <xsl:if test="@explicit = 'yes'"> + <xsl:attribute name="specifiers">explicit</xsl:attribute> + </xsl:if> + <xsl:call-template name="function.attributes"/> + <xsl:call-template name="function.children"/> + </constructor> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:template> + + <!-- Handle Destructors --> + <xsl:template name="destructor"> + <destructor> + <xsl:call-template name="function.children"/> + </destructor> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:template> + + <!-- Handle Copy Assignment --> + <xsl:template name="copy-assignment"> + <copy-assignment> + <xsl:call-template name="function.attributes"/> + <!-- Return type --> + <xsl:element name="type"> + <xsl:apply-templates select="type"/> + </xsl:element> + + <xsl:call-template name="function.children"/> + </copy-assignment> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:template> + + <!-- Handle conversion operator --> + <xsl:template name="conversion-operator"> + <method> + <xsl:attribute name="name"> + <xsl:text>conversion-operator</xsl:text> + </xsl:attribute> + <xsl:call-template name="function.attributes"/> + + <!-- Conversion type --> + <type> + <xsl:value-of select="substring-after(name/text(), 'operator ')"/> + </type> + + <xsl:call-template name="function.children"/> + </method> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:template> + + <!-- Handle methods --> + <xsl:template name="method"> + <method> + <xsl:attribute name="name"> + <xsl:value-of select="name/text()"/> + </xsl:attribute> + <xsl:call-template name="function.attributes"/> + + <!-- Return type --> + <xsl:element name="type"> + <xsl:apply-templates select="type"/> + </xsl:element> + + <xsl:call-template name="function.children"/> + </method> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:template> + + <!-- Handle member variables --> + <xsl:template name="variable"> + <xsl:param name="in-file"/> + <xsl:if test="string(location/attribute::file)=$in-file"> + <data-member> + <xsl:attribute name="name"> + <xsl:value-of select="name/text()"/> + </xsl:attribute> + + <!-- Specifiers --> + <xsl:if test="@static = 'yes'"> + <xsl:attribute name="specifiers">static</xsl:attribute> + </xsl:if> + <xsl:if test="@mutable = 'yes'"> + <xsl:attribute name="specifiers">mutable</xsl:attribute> + </xsl:if> + + <type> + <xsl:apply-templates select="type"/> + </type> + + <xsl:apply-templates select="briefdescription" mode="passthrough"/> + <xsl:apply-templates select="detaileddescription" mode="passthrough"/> + <xsl:apply-templates select="inbodydescription" mode="passthrough"/> + </data-member> + <xsl:text> </xsl:text><!-- Newline --> + </xsl:if> + </xsl:template> + + <!-- Things we ignore directly --> + <xsl:template match="compoundname" mode="toplevel"/> + <xsl:template match="includes|includedby|incdepgraph|invincdepgraph" mode="toplevel"/> + <xsl:template match="programlisting" mode="toplevel"/> + <xsl:template match="text()" mode="toplevel"/> + + <xsl:template match="text()"/> + + <!-- Passthrough of text --> + <xsl:template match="text()" mode="passthrough"> + <xsl:value-of select="."/> + </xsl:template> + <xsl:template match="para" mode="passthrough"> + <para> + <xsl:apply-templates mode="passthrough"/> + </para> + </xsl:template> + <xsl:template match="copydoc" mode="passthrough"> + <xsl:apply-templates mode="passthrough"/> + </xsl:template> + <xsl:template match="verbatim" mode="passthrough"> + <xsl:copy-of select="node()"/> + </xsl:template> + + <xsl:template match="para/simplesect" mode="passthrough"> + <xsl:if test="not (@kind='pre') and + not (@kind='return') and + not (@kind='post') and + not (@kind='attention') and + not (@kind='see') and + not (@kind='warning') + "> + <xsl:apply-templates mode="passthrough"/> + </xsl:if> + </xsl:template> + + <xsl:template match="para/simplesect[@kind='note' or @kind='attention']" mode="passthrough"> + <note> + <xsl:apply-templates mode="passthrough"/> + </note> + </xsl:template> + + <xsl:template match="para/simplesect[@kind='warning']" mode="passthrough"> + <warning> + <xsl:apply-templates mode="passthrough"/> + </warning> + </xsl:template> + + <xsl:template match="para/simplesect[@kind='par']" mode="passthrough"> + <formalpara> + <xsl:apply-templates mode="passthrough"/> + </formalpara> + </xsl:template> + + <xsl:template match="para/simplesect[@kind='see']" mode="passthrough"> + <para> + <emphasis role="bold"> + <xsl:text>See Also:</xsl:text> + </emphasis> + <xsl:apply-templates mode="passthrough"/> + </para> + </xsl:template> + + <xsl:template match="simplesectsep" mode="passthrough"> + <xsl:apply-templates mode="passthrough"/> + </xsl:template> + + <xsl:template match="*" mode="passthrough"> + <xsl:copy> + <xsl:copy-of select="@*"/> + <xsl:apply-templates mode="passthrough"/> + </xsl:copy> + </xsl:template> + + <xsl:template match="parameterlist" mode="passthrough"/> + + <xsl:template match="bold" mode="passthrough"> + <emphasis role="bold"> + <xsl:apply-templates mode="passthrough"/> + </emphasis> + </xsl:template> + + <xsl:template match="linebreak" mode="passthrough"> + <sbr/> + </xsl:template> + + <xsl:template match="ndash" mode="passthrough"> + <xsl:text>–</xsl:text> + </xsl:template> + + <xsl:template match="briefdescription" mode="passthrough"> + <xsl:if test="text()|*"> + <purpose> + <xsl:apply-templates mode="purpose"/> + </purpose> + </xsl:if> + </xsl:template> + + <xsl:template match="detaileddescription" mode="passthrough"> + <xsl:if test="text()|*"> + <description> + <xsl:apply-templates mode="passthrough"/> + </description> + </xsl:if> + </xsl:template> + + <xsl:template match="inbodydescription" mode="passthrough"> + <xsl:if test="text()|*"> + <description> + <xsl:apply-templates mode="passthrough"/> + </description> + </xsl:if> + </xsl:template> + + <!-- Ignore ref elements for now, as there is a lot of documentation which + will have incorrect ref elements at the moment --> + <xsl:template match="ref" mode="passthrough"> + <xsl:variable name="as-class" select="key('compounds-by-id', @refid)[@kind='class' or @kind='struct']"/> + <xsl:choose> + <xsl:when test="$as-class"> + <classname> + <xsl:attribute name="alt"> + <xsl:value-of select="$as-class/compoundname/text()"/> + </xsl:attribute> + <xsl:value-of select="text()"/> + </classname> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="passthrough"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Handle function clauses --> + <xsl:template match="simplesect" mode="function-clauses"> + <xsl:if test="@kind='pre'"> + <requires> + <xsl:apply-templates mode="passthrough"/> + </requires> + </xsl:if> + <xsl:if test="@kind='return'"> + <returns> + <xsl:apply-templates mode="passthrough"/> + </returns> + </xsl:if> + <xsl:if test="@kind='post'"> + <postconditions> + <xsl:apply-templates mode="passthrough"/> + </postconditions> + </xsl:if> + </xsl:template> + + <xsl:template match="parameterlist" mode="function-clauses"> + <xsl:if test="@kind='exception'"> + <simpara> + <xsl:choose> + <xsl:when test="normalize-space(.//parametername//text())='nothrow'"> + <xsl:text>Will not throw.</xsl:text> + </xsl:when> + <xsl:otherwise> + <classname> + <xsl:value-of select=".//parametername//text()"/> + </classname> + <xsl:text> </xsl:text> + <xsl:apply-templates + select=".//parameterdescription/para/text() + |.//parameterdescription/para/*" + mode="passthrough"/> + </xsl:otherwise> + </xsl:choose> + </simpara> + </xsl:if> + </xsl:template> + + <xsl:template match="type"> + <xsl:choose> + <xsl:when test="contains(string(.), $boost.doxygen.detail)"> + <emphasis>unspecified</emphasis> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates mode="type"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="ref" mode="type"> + <xsl:choose> + <xsl:when test="@kindref='compound'"> + <classname> + <xsl:value-of select="text()"/> + </classname> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="text()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="*" mode="type"> + <xsl:value-of select="."/> + </xsl:template> + + <!-- Normalize the names of functions, because Doxygen sometimes + puts in an obnoixous space. --> + <xsl:template name="normalize-name"> + <xsl:param name="name" select="name/text()"/> + + <xsl:choose> + <xsl:when test="contains($name, ' ')"> + <xsl:value-of select="substring-before($name, ' ')"/> + <xsl:value-of select="substring-after($name, ' ')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Convert HTML tables into DocBook format --> + <xsl:template match="table" mode="passthrough"> + <informaltable> + <tgroup> + <xsl:attribute name="cols"> + <xsl:value-of select="@cols"/> + </xsl:attribute> + + <tbody> + <xsl:apply-templates mode="table"/> + </tbody> + </tgroup> + </informaltable> + </xsl:template> + + <xsl:template match="row" mode="table"> + <row> + <xsl:apply-templates mode="table"/> + </row> + </xsl:template> + + <xsl:template match="entry" mode="table"> + <entry> + <xsl:if test="para/center"> + <xsl:attribute name="valign"> + <xsl:value-of select="'middle'"/> + </xsl:attribute> + <xsl:attribute name="align"> + <xsl:value-of select="'center'"/> + </xsl:attribute> + </xsl:if> + + <xsl:choose> + <xsl:when test="@thead='yes'"> + <emphasis role="bold"> + <xsl:call-template name="table-entry"/> + </emphasis> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="table-entry"/> + </xsl:otherwise> + </xsl:choose> + </entry> + </xsl:template> + + <xsl:template name="table-entry"> + <xsl:choose> + <xsl:when test="para/center"> + <xsl:apply-templates select="para/center/*|para/center/text()" + mode="passthrough"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="para/*|para/text()" mode="passthrough"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Handle preformatted. + Doxygen generates markup such as: + <para><preformatted>void foo() {</preformatted></para> + <para><preformatted>}</preformatted></para> + This complicated mess tries to combine that into a single + programlisting element. + --> + <xsl:template match="para[preformatted][count(preformatted)=count(*)]" mode="passthrough"> + <!-- Only do this for the first of a group of paras. --> + <xsl:if test="not(preceding-sibling::para[1][preformatted][count(preformatted)=count(*)])"> + <programlisting> + <!-- This node's children. --> + <xsl:apply-templates mode="passthrough" select="./preformatted/node()"/> + + <!-- Adjacent para nodes' children. + Based on code at: http://stackoverflow.com/a/2092144 --> + <xsl:variable name="following-siblings" select="following-sibling::*" /> + <xsl:for-each select="following-sibling::para[preformatted][count(preformatted)=count(*)]"> + <xsl:variable name="index" select="position()"/> + <xsl:if test="generate-id(.)=generate-id($following-siblings[$index])"> + <xsl:text>

</xsl:text> + <xsl:apply-templates mode="passthrough" select="./preformatted/node()"/> + </xsl:if> + </xsl:for-each> + </programlisting> + </xsl:if> + </xsl:template> + + <!-- Remove empty preformatted elements. --> + <xsl:template match="preformatted[not(node())]" mode="passthrough"/> + + <!-- Convert remaining to programlisting. --> + <xsl:template match="preformatted" mode="passthrough"> + <programlisting> + <xsl:apply-templates mode="passthrough"/> + </programlisting> + </xsl:template> + + <!-- Handle program listings --> + <xsl:template match="programlisting" mode="passthrough"> + <programlisting language="c++"> + <xsl:apply-templates mode="programlisting"/> + </programlisting> + </xsl:template> + + <xsl:template match="highlight|codeline" mode="programlisting"> + <xsl:apply-templates mode="programlisting"/> + </xsl:template> + + <xsl:template match="sp" mode="programlisting"> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="*" mode="programlisting"> + <xsl:apply-templates select="." mode="passthrough"/> + </xsl:template> + + <!-- Replace top-level "para" elements with "simpara" elements in + the purpose --> + <xsl:template match="*" mode="purpose"> + <xsl:apply-templates mode="passthrough"/> + </xsl:template> + + <xsl:template match="text()" mode="purpose"> + <xsl:apply-templates mode="passthrough"/> + </xsl:template> + + <xsl:template match="para" mode="purpose"> + <xsl:apply-templates select="*|text()" mode="passthrough"/> + </xsl:template> + + <!-- + Eric Niebler: Jan-8-2008 + Here is some 3/4-baked support for LaTeX formulas in + Doxygen comments. Doxygen doesn't generate the PNG files + when outputting XML. In order to use this code, you must + run Doxygen first to generate HTML (and the PNG files for + the formulas). You can do this in a Jamfile with + "doxygen foo.html : <sources, etc...> ; ", where the ".html" + is significant. Then the png files should be copied into the + images/ directory (or another place relative to the html/ + directory, as specified by $boost.doxygen.formuladir XSL + parameter). This can be done with a custom action in a + Jamfile. Finally, the docs can be built as normal. + See libs/accumulators/doc/Jamfile.v2 for a working example. + --> + <xsl:template match="formula" mode="passthrough"> + <xsl:choose> + <xsl:when test="substring(*|text(), 1, 2) = '\['"> + <equation> + <title/> + <alt> + <xsl:value-of select="*|text()"/> + </alt> + <mediaobject> + <imageobject role="html"> + <imagedata format="PNG" align="center"> + <xsl:attribute name="fileref"> + <xsl:value-of select="concat(concat(concat($boost.doxygen.formuladir.fixed, 'form_'), @id), '.png')"/> + </xsl:attribute> + </imagedata> + </imageobject> + <textobject role="tex"> + <phrase> + <xsl:value-of select="*|text()"/> + </phrase> + </textobject> + </mediaobject> + </equation> + </xsl:when> + <xsl:otherwise> + <inlineequation> + <alt> + <xsl:value-of select="*|text()"/> + </alt> + <inlinemediaobject> + <imageobject role="html"> + <imagedata format="PNG"> + <xsl:attribute name="fileref"> + <xsl:value-of select="concat(concat(concat($boost.doxygen.formuladir.fixed, 'form_'), @id), '.png')"/> + </xsl:attribute> + </imagedata> + </imageobject> + <textobject role="tex"> + <phrase> + <xsl:value-of select="*|text()"/> + </phrase> + </textobject> + </inlinemediaobject> + </inlineequation> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + </xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/dtd/dtd2boostbook.xsl b/src/boost/tools/boostbook/xsl/dtd/dtd2boostbook.xsl new file mode 100644 index 000000000..38bf815fa --- /dev/null +++ b/src/boost/tools/boostbook/xsl/dtd/dtd2boostbook.xsl @@ -0,0 +1,217 @@ +<?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" + version="1.0"> + + <xsl:output method="xml" indent="yes" standalone="yes"/> + + <xsl:strip-space elements="sequence-group or-group element element-name"/> + + <xsl:key name="elements" match="element" use="@name"/> + <xsl:key name="attributes" match="attlist" use="@name"/> + <xsl:key name="attribute-purposes" match="attpurpose" use="@name"/> + + <xsl:template match="dtd"> + <section id="reference"> + <title>Reference</title> + <para> + <xsl:text>Elements:</xsl:text> + <itemizedlist spacing="compact"> + <xsl:apply-templates select="element" mode="synopsis"> + <xsl:sort select="@name"/> + </xsl:apply-templates> + </itemizedlist> + </para> + <xsl:apply-templates select="element"/> + </section> + </xsl:template> + + <!-- Element synopsis --> + <xsl:template match="element" mode="synopsis"> + <listitem> + <simpara> + <link> + <xsl:attribute name="linkend"> + <xsl:value-of select="concat('boostbook.dtd.',@name)"/> + </xsl:attribute> + <xsl:text>Element </xsl:text> + <sgmltag><xsl:value-of select="@name"/></sgmltag> + <xsl:text> - </xsl:text> + <xsl:apply-templates select="purpose"/> + </link> + </simpara> + </listitem> + </xsl:template> + + <!-- Elements are transformed into DocBook refentry elements --> + <xsl:template match="element"> + <refentry> + <xsl:attribute name="id"> + <xsl:value-of select="concat('boostbook.dtd.',@name)"/> + </xsl:attribute> + + <refmeta> + <refentrytitle> + BoostBook element <sgmltag><xsl:value-of select="@name"/></sgmltag> + </refentrytitle> + <manvolnum>9</manvolnum> + </refmeta> + <refnamediv> + <refname><xsl:value-of select="@name"/></refname> + <refpurpose><xsl:apply-templates select="purpose"/></refpurpose> + </refnamediv> + <refsynopsisdiv> + <xsl:value-of select="@name"/><xsl:text> ::= </xsl:text> + <xsl:apply-templates select="content-model-expanded"/> + </refsynopsisdiv> + <xsl:apply-templates select="description"/> + <xsl:apply-templates select="key('attributes', @name)"/> + </refentry> + </xsl:template> + + <xsl:template match="content-model-expanded"> + <xsl:apply-templates/> + </xsl:template> + + <!-- Sequences --> + <xsl:template match="sequence-group"> + <xsl:param name="separator" select="''"/> + + <xsl:if test="preceding-sibling::*"> + <xsl:value-of select="$separator"/> + </xsl:if> + <xsl:text>(</xsl:text> + <xsl:apply-templates> + <xsl:with-param name="separator" select="', '"/> + </xsl:apply-templates> + <xsl:text>)</xsl:text> + <xsl:value-of select="@occurrence"/> + </xsl:template> + + <!-- Alternatives --> + <xsl:template match="or-group"> + <xsl:param name="separator" select="''"/> + + <xsl:if test="preceding-sibling::*"> + <xsl:value-of select="$separator"/> + </xsl:if> + <xsl:text>(</xsl:text> + <xsl:apply-templates> + <xsl:with-param name="separator" select="'| '"/> + </xsl:apply-templates> + <xsl:text>)</xsl:text> + <xsl:value-of select="@occurrence"/> + </xsl:template> + + <!-- Element references --> + <xsl:template match="element-name"> + <xsl:param name="separator" select="''"/> + + <xsl:if test="preceding-sibling::*"> + <xsl:value-of select="$separator"/> + </xsl:if> + + <xsl:variable name="element-node" select="key('elements', @name)"/> + + <xsl:choose> + <xsl:when test="$element-node"> + <link> + <xsl:attribute name="linkend"> + <xsl:value-of select="concat('boostbook.dtd.',@name)"/> + </xsl:attribute> + <xsl:value-of select="@name"/> + </link> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@name"/> + </xsl:otherwise> + </xsl:choose> + <xsl:value-of select="@occurrence"/> + </xsl:template> + + <!-- #PCDATA --> + <xsl:template match="pcdata"> + <xsl:param name="separator" select="''"/> + + <xsl:if test="preceding-sibling::*"> + <xsl:value-of select="$separator"/> + </xsl:if> + + <xsl:text>#PCDATA</xsl:text> + </xsl:template> + + <!-- ANY --> + <xsl:template match="any"> + <xsl:text>ANY</xsl:text> + </xsl:template> + + <!-- EMPTY --> + <xsl:template match="empty"> + <xsl:text>EMPTY</xsl:text> + </xsl:template> + + <!-- Just copy anything in a purpose element --> + <xsl:template match="purpose"> + <xsl:copy-of select="text()|*"/> + </xsl:template> + + <!-- Just copy anything in a description element, but place it in a + section. --> + <xsl:template match="description"> + <refsection> + <title>Description</title> + <xsl:copy-of select="text()|*"/> + </refsection> + </xsl:template> + + <!-- Attributes --> + <xsl:template match="attlist"> + <refsection> + <title>Attributes</title> + + <informaltable> + <tgroup cols="4"> + <thead> + <row> + <entry>Name</entry> + <entry>Type</entry> + <entry>Value</entry> + <entry>Purpose</entry> + </row> + </thead> + <tbody> + <xsl:apply-templates/> + </tbody> + </tgroup> + </informaltable> + </refsection> + </xsl:template> + + <!-- Attribute --> + <xsl:template match="attribute"> + <row> + <entry><xsl:value-of select="@name"/></entry> + <entry><xsl:value-of select="@type"/></entry> + <entry><xsl:value-of select="@value"/></entry> + <entry> + <xsl:choose> + <xsl:when test="purpose"> + <xsl:apply-templates select="purpose"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="key('attribute-purposes', @name)"/> + </xsl:otherwise> + </xsl:choose> + </entry> + </row> + </xsl:template> + + <!-- Eat attribute declarations --> + <xsl:template match="attdecl"/> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/error.xsl b/src/boost/tools/boostbook/xsl/error.xsl new file mode 100644 index 000000000..a1c160107 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/error.xsl @@ -0,0 +1,19 @@ +<?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" + version="1.0"> + <xsl:template name="print.warning.context"> + <xsl:message> + <xsl:text> In </xsl:text> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:message> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/fo.xsl b/src/boost/tools/boostbook/xsl/fo.xsl new file mode 100644 index 000000000..44d325526 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/fo.xsl @@ -0,0 +1,520 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2003 Douglas Gregor --> +<!-- Distributed under the Boost Software License, Version 1.0. --> +<!-- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) --> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version="1.0"> + + <!-- Import the FO stylesheet --> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/> + + <xsl:param name="chapter.autolabel" select="0"/> + <xsl:param name="refentry.generate.name" select="0"/> + <xsl:param name="refentry.generate.title" select="1"/> + <xsl:param name="fop1.extensions" select="1"/> + <xsl:param name="make.year.ranges" select="1"/> + <xsl:param name="ulink.show" select="0"/> + + + <!-- + The following code sets which sections start new pages in the PDF document flow. + + The parameter "boost.section.newpage.depth" set how far down the hierarchy the + page breaks go. Defaults to 1 (the same as html chunking), in which case only + top level sections start a new page, set to a higher value to force nested sections + onto new pages as well. + + For top level sections (level 1), we use "break-before" which forces the very first + section onto a separate page from the TOC. + + For nested sections (level 2 and greater) we use "break-after" which keeps nested + sections together with their enclosing section (rationale: the enclosing section + often has nothing but a title, and no content except the nested sections, and we + don't want a page break right after a section title!). + + For reference sections, we turn page breaks *off* by setting "refentry.pagebreak" to 0. + This is for the same reason we use "break-after" for nested sections - we want reference + entries to be on the same page as the title and synopsis which encloses them. Ideally + we'd use "break-after" here too, but I can't find an easy to to fix that. + + Finally note that TOC's and Indexes don't get page breaks forced after them. + Again there's no easy fix here, *except* for the top level TOC which gets a page break + after it thanks to the "break-before" on level 1 sections. Unfortunately this means + there's no break after the last section and before the first Index, *unless* the + final section has nested sections which may then trigger one! + + We could fix all this by cut-and-pasting the relevant XSL from the stylesheets to here + and making sure everything uses "break-after", but whether it's worth it is questionable...? + + --> + + <xsl:param name="boost.section.newpage.depth" select="1"/> + <xsl:param name="refentry.pagebreak" select="0"/> + + <xsl:attribute-set name="section.level1.properties" use-attribute-sets="section.properties"> + <xsl:attribute name="break-before"> + <xsl:if test="($boost.section.newpage.depth > 0)"> + page + </xsl:if> + <xsl:if test="not($boost.section.newpage.depth > 0)"> + auto + </xsl:if> + </xsl:attribute> + </xsl:attribute-set> + + <xsl:attribute-set name="section.level2.properties" use-attribute-sets="section.properties"> + <xsl:attribute name="break-after"> + <xsl:if test="($boost.section.newpage.depth > 1)"> + page + </xsl:if> + <xsl:if test="not($boost.section.newpage.depth > 1)"> + auto + </xsl:if> + </xsl:attribute> + </xsl:attribute-set> + + <xsl:attribute-set name="section.level3.properties" use-attribute-sets="section.properties"> + <xsl:attribute name="break-after"> + <xsl:if test="($boost.section.newpage.depth > 2)"> + page + </xsl:if> + <xsl:if test="not($boost.section.newpage.depth > 2)"> + auto + </xsl:if> + </xsl:attribute> + </xsl:attribute-set> + + <xsl:attribute-set name="section.level4.properties" use-attribute-sets="section.properties"> + <xsl:attribute name="break-after"> + <xsl:if test="($boost.section.newpage.depth > 3)"> + page + </xsl:if> + <xsl:if test="not($boost.section.newpage.depth > 3)"> + auto + </xsl:if> + </xsl:attribute> + </xsl:attribute-set> + + <xsl:attribute-set name="section.level5.properties" use-attribute-sets="section.properties"> + <xsl:attribute name="break-after"> + <xsl:if test="($boost.section.newpage.depth > 4)"> + page + </xsl:if> + <xsl:if test="not($boost.section.newpage.depth > 4)"> + auto + </xsl:if> + </xsl:attribute> + </xsl:attribute-set> + + <xsl:attribute-set name="section.level6.properties" use-attribute-sets="section.properties"> + <xsl:attribute name="break-after"> + <xsl:if test="($boost.section.newpage.depth > 5)"> + page + </xsl:if> + <xsl:if test="not($boost.section.newpage.depth > 5)"> + auto + </xsl:if> + </xsl:attribute> + </xsl:attribute-set> + + <!-- The question and answer templates are copied here from the + 1.61.3 DocBook XSL stylesheets so that we can eliminate the emission + of id attributes in the emitted fo:list-item-label elements. FOP + 0.20.5 has problems with these id attributes, and they are otherwise + unused. --> +<xsl:template match="question"> + <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> + + <xsl:variable name="entry.id"> + <xsl:call-template name="object.id"> + <xsl:with-param name="object" select="parent::*"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="deflabel"> + <xsl:choose> + <xsl:when test="ancestor-or-self::*[@defaultlabel]"> + <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] + /@defaultlabel"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$qanda.defaultlabel"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <fo:list-item id="{$entry.id}" xsl:use-attribute-sets="list.item.spacing"> + <fo:list-item-label end-indent="label-end()"> + <xsl:choose> + <xsl:when test="$deflabel = 'none'"> + <fo:block/> + </xsl:when> + <xsl:otherwise> + <fo:block> + <xsl:apply-templates select="." mode="label.markup"/> + <xsl:text>.</xsl:text> <!-- FIXME: Hack!!! This should be in the locale! --> + </fo:block> + </xsl:otherwise> + </xsl:choose> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <xsl:choose> + <xsl:when test="$deflabel = 'none'"> + <fo:block font-weight="bold"> + <xsl:apply-templates select="*[local-name(.)!='label']"/> + </fo:block> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*[local-name(.)!='label']"/> + </xsl:otherwise> + </xsl:choose> + </fo:list-item-body> + </fo:list-item> +</xsl:template> + +<xsl:template match="answer"> + <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> + <xsl:variable name="entry.id"> + <xsl:call-template name="object.id"> + <xsl:with-param name="object" select="parent::*"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="deflabel"> + <xsl:choose> + <xsl:when test="ancestor-or-self::*[@defaultlabel]"> + <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()] + /@defaultlabel"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$qanda.defaultlabel"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <fo:list-item xsl:use-attribute-sets="list.item.spacing"> + <fo:list-item-label end-indent="label-end()"> + <xsl:choose> + <xsl:when test="$deflabel = 'none'"> + <fo:block/> + </xsl:when> + <xsl:otherwise> + <fo:block> + <!-- FIXME: Hack!!! This should be in the locale! --> + <xsl:variable name="answer.label"> + <xsl:apply-templates select="." mode="label.markup"/> + </xsl:variable> + <xsl:copy-of select="$answer.label"/> + <xsl:if test="string($answer.label) != ''"> + <xsl:text>.</xsl:text> + </xsl:if> + </fo:block> + </xsl:otherwise> + </xsl:choose> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <xsl:apply-templates select="*[local-name(.)!='label']"/> + </fo:list-item-body> + </fo:list-item> +</xsl:template> + + +<!-- + + The following rules apply text coloring to Quickbook items like + + [role blue Some blue text] + + These correspond to an arbitrary list of colors added to the CSS file + + $(BOOST-ROOT)\doc\src\boostbook.css + + and are required for building pdf documentation. + + A more elegant way of doing this is probably possible. + Other colors can be added simply by copying these examples. +--> + +<xsl:template match="phrase[@role='red']"> + <fo:inline color="red"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='blue']"> + <fo:inline color="blue"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='green']"> + <fo:inline color="green"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> +<xsl:template match="phrase[@role='lime']"> + <fo:inline color="lime"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> +<xsl:template match="phrase[@role='navy']"> + <fo:inline color="navy"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> +<xsl:template match="phrase[@role='yellow']"> + <fo:inline color="yellow"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> +<xsl:template match="phrase[@role='magenta']"> + <fo:inline color="magenta"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='indigo']"> + <fo:inline color="indigo"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='cyan']"> + <fo:inline color="cyan"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='purple']"> + <fo:inline color="purple"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='gold']"> + <fo:inline color="gold"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='silver']"> + <fo:inline color="silver"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='gray']"> + <fo:inline color="gray"> + <xsl:apply-templates/> + </fo:inline> +</xsl:template> + +<!-- alignment --> + +<xsl:template match="phrase[@role='aligncenter']"> + <fo:inline> + <fo:block text-align="center"> + <xsl:apply-templates/> + </fo:block> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='alignleft']"> + <fo:inline> + <fo:block text-align="left"> + <xsl:apply-templates/> + </fo:block> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='alignright']"> + <fo:inline> + <fo:block text-align="right"> + <xsl:apply-templates/> + </fo:block> + </fo:inline> +</xsl:template> + +<xsl:template match="phrase[@role='alignjustify']"> + <fo:inline> + <fo:block text-align="justify"> + <xsl:apply-templates/> + </fo:block> + </fo:inline> +</xsl:template> + + <!-- + + The following rules apply syntax highlighting to phrases + that have been appropriately marked up, the highlighting + used is the same as that used by our CSS style sheets, + but potentially we have the option to do better here + since we can add bold and italic formatting quite easily + + --> + +<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="//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="//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="//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="//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="//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="//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="//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="//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> + +<!-- +Make all hyperlinks blue colored: +--> +<xsl:attribute-set name="xref.properties"> + <xsl:attribute name="color">blue</xsl:attribute> +</xsl:attribute-set> + +<!-- +Put a box around admonishments and keep them together: +--> +<xsl:attribute-set name="graphical.admonition.properties"> + <xsl:attribute name="border-color">#FF8080</xsl:attribute> + <xsl:attribute name="border-width">1px</xsl:attribute> + <xsl:attribute name="border-style">solid</xsl:attribute> + <xsl:attribute name="padding-left">0.2cm</xsl:attribute> + <xsl:attribute name="padding-right">0.2cm</xsl:attribute> + <xsl:attribute name="padding-top">0.2cm</xsl:attribute> + <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute> + <xsl:attribute name="keep-together.within-page">1</xsl:attribute> + <xsl:attribute name="margin-left">0pt</xsl:attribute> + <xsl:attribute name="margin-right">0pt</xsl:attribute> +</xsl:attribute-set> + +<!-- +Put a box around code blocks, also set the font size +and keep the block together if we can using the widows +and orphans controls. Hyphenation and line wrapping +is also turned on, so that long lines of code don't +bleed off the edge of the page, a carriage return +symbol is used as the hyphenation character: +--> +<xsl:attribute-set name="monospace.verbatim.properties"> + <xsl:attribute name="border-color">#DCDCDC</xsl:attribute> + <xsl:attribute name="border-width">1px</xsl:attribute> + <xsl:attribute name="border-style">solid</xsl:attribute> + <xsl:attribute name="padding-left">0.2cm</xsl:attribute> + <xsl:attribute name="padding-right">0.2cm</xsl:attribute> + <xsl:attribute name="padding-top">0.2cm</xsl:attribute> + <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute> + <xsl:attribute name="widows">6</xsl:attribute> + <xsl:attribute name="orphans">40</xsl:attribute> + <xsl:attribute name="font-size">9pt</xsl:attribute> + <xsl:attribute name="hyphenate">true</xsl:attribute> + <xsl:attribute name="wrap-option">wrap</xsl:attribute> + <xsl:attribute name="hyphenation-character">↵</xsl:attribute> + <xsl:attribute name="margin-left">0pt</xsl:attribute> + <xsl:attribute name="margin-right">0pt</xsl:attribute> +</xsl:attribute-set> + +<xsl:param name="hyphenate.verbatim" select="1"></xsl:param> +<xsl:param name="monospace.font.family">monospace,Symbol</xsl:param> + + <!--Regular monospace text should have the same font size as code blocks etc--> +<xsl:attribute-set name="monospace.properties"> + <xsl:attribute name="font-size">9pt</xsl:attribute> +</xsl:attribute-set> + +<!-- +Put some small amount of padding around table cells, and keep tables +together on one page if possible: +--> +<xsl:attribute-set name="table.cell.padding"> + <xsl:attribute name="padding-left">0.2cm</xsl:attribute> + <xsl:attribute name="padding-right">0.2cm</xsl:attribute> + <xsl:attribute name="padding-top">0.2cm</xsl:attribute> + <xsl:attribute name="padding-bottom">0.2cm</xsl:attribute> +</xsl:attribute-set> + + <!--Formal and informal tables have the same properties + Using widow-and-orphan control here gives much better + results for very large tables than a simple "keep-together" + instruction--> +<xsl:attribute-set name="table.properties"> + <xsl:attribute name="keep-together.within-page">1</xsl:attribute> +</xsl:attribute-set> +<xsl:attribute-set name="informaltable.properties"> + <xsl:attribute name="keep-together.within-page">1</xsl:attribute> +</xsl:attribute-set> + +<!-- +General default options go here: +* Borders are mid-grey. +* Body text is not indented compared to the titles. +* Page margins are a rather small 0.5in, but we need + all the space we can get for code blocks. +* Paper size is A4: an ISO standard, slightly taller and narrower than US Letter. +* Use SVG graphics for admonishments: the bitmaps look awful in PDF's. +* Disable draft mode so we're not constantly trying to download the necessary graphic. +* Set default image paths to pull down direct from SVN: individual Jamfiles can override this + and pass an absolute path to local versions of the images, but we can't get that here, so + we'll use SVN instead so that most things "just work". +--> +<xsl:param name="table.frame.border.color">#DCDCDC</xsl:param> +<xsl:param name="table.cell.border.color">#DCDCDC</xsl:param> +<xsl:param name="body.start.indent">0pt</xsl:param> +<xsl:param name="page.margin.inner">0.5in</xsl:param> +<xsl:param name="page.margin.outer">0.5in</xsl:param> +<xsl:param name="paper.type">A4</xsl:param> +<xsl:param name="admon.graphics">1</xsl:param> +<xsl:param name="admon.graphics.extension">.svg</xsl:param> +<xsl:param name="draft.mode">no</xsl:param> +<xsl:param name="admon.graphics.path">http://www.boost.org/doc/libs/develop/doc/src/images/</xsl:param> +<xsl:param name="callout.graphics.path">http://www.boost.org/doc/libs/develop/doc/src/images/callouts/</xsl:param> +<xsl:param name="img.src.path">http://www.boost.org/doc/libs/devlop/doc/html/</xsl:param> + +</xsl:stylesheet> + diff --git a/src/boost/tools/boostbook/xsl/function.xsl b/src/boost/tools/boostbook/xsl/function.xsl new file mode 100644 index 000000000..edba8ed1c --- /dev/null +++ b/src/boost/tools/boostbook/xsl/function.xsl @@ -0,0 +1,1217 @@ +<?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" + version="1.0"> + + <xsl:strip-space elements="requires effects postconditions returns throws + complexity notes rationale purpose"/> + + <!-- When true, the stylesheet will emit compact definitions of + functions when the function does not have any detailed + description. --> + <xsl:param name="boost.compact.function">1</xsl:param> + + <!-- The longest type length that is considered "short" for the + layout of function return types. When the length of the result type + and any storage specifiers is greater than this length, they will be + placed on a separate line from the function name and parameters + unless everything fits on a single line. --> + <xsl:param name="boost.short.result.type">12</xsl:param> + + <!-- Display a function declaration --> + <xsl:template name="function"> + <xsl:param name="indentation"/> + <xsl:param name="is-reference"/> + + <!-- Whether or not we should include parameter names in the output --> + <xsl:param name="include-names" select="$is-reference"/> + + <!-- What type of link the function name should have. This shall + be one of 'anchor' (the function output will be the target of + links), 'link' (the function output will link to a definition), or + 'none' (the function output will not be either a link or a link + target) --> + <xsl:param name="link-type"> + <xsl:choose> + <xsl:when test="$is-reference"> + <xsl:text>anchor</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>link</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + + <!-- The id we should link to or anchor as --> + <xsl:param name="link-to"> + <xsl:call-template name="generate.id"/> + </xsl:param> + + <!-- If we are printing a constructor --> + <xsl:param name="constructor-for"/> + + <!-- If we are printing a destructor --> + <xsl:param name="destructor-for"/> + + <!-- If we are printing a copy assignment operator --> + <xsl:param name="copy-assign-for"/> + + <!-- The name of this function --> + <xsl:param name="name" select="@name"/> + + <!-- True if this is the function's separate documentation --> + <xsl:param name="standalone" select="false()"/> + + <!-- True if we should suppress the template header --> + <xsl:param name="suppress-template" select="false()"/> + + <!-- Calculate the specifiers --> + <xsl:variable name="specifiers"> + <xsl:if test="@specifiers"> + <xsl:value-of select="concat(@specifiers, ' ')"/> + </xsl:if> + </xsl:variable> + + <!-- Calculate the type --> + <xsl:variable name="type"> + <xsl:value-of select="$specifiers"/> + + <xsl:choose> + <!-- Conversion operators have an empty type, because the return + type is part of the name --> + <xsl:when test="$name='conversion-operator'"/> + + <!-- Constructors and destructors have no return type --> + <xsl:when test="$constructor-for or $destructor-for"/> + + <!-- Copy assignment operators return a reference to the class + they are in, unless another type has been explicitly + provided in the element. --> + <xsl:when test="$copy-assign-for and not(type)"> + <xsl:value-of select="concat($copy-assign-for, '& ')"/> + </xsl:when> + + <xsl:otherwise> + <xsl:apply-templates select="type" mode="annotation"/> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Build the function name with return type --> + <xsl:variable name="function-name"> + <xsl:choose> + <xsl:when test="$constructor-for"> + <xsl:value-of select="$constructor-for"/> + </xsl:when> + <xsl:when test="$destructor-for"> + <xsl:value-of select="concat('~',$destructor-for)"/> + </xsl:when> + <xsl:when test="$copy-assign-for"> + <xsl:value-of select="'operator='"/> + </xsl:when> + <xsl:when test="$name='conversion-operator'"> + <xsl:text>operator </xsl:text> + <xsl:apply-templates select="type" mode="annotation"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:if test="not ($standalone) or + (local-name(.)='signature' and (position() > 1)) + or $suppress-template"> + <xsl:text> </xsl:text> + </xsl:if> + + <!-- Indent this declaration --> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + + <!-- Build the template header --> + <xsl:variable name="template-length"> + <xsl:choose> + <xsl:when test="$suppress-template"> + 0 + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="template.synopsis.length"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Build a full parameter string (without line breaks) --> + <xsl:variable name="param-string"> + <xsl:text>(</xsl:text> + <xsl:call-template name="function-parameters"> + <xsl:with-param name="include-names" select="$include-names"/> + <xsl:with-param name="wrap" select="false()"/> + </xsl:call-template> + <xsl:text>)</xsl:text> + </xsl:variable> + + <!-- Build the text that follows the declarator--> + <xsl:variable name="postdeclarator"> + <xsl:if test="@cv and @cv != ''"> + <xsl:text> </xsl:text> + <xsl:value-of select="@cv"/> + </xsl:if> + </xsl:variable> + + <!-- Build the full declaration text --> + <xsl:variable name="decl-string" + select="concat($type, $function-name, $param-string, $postdeclarator)"/> + <xsl:variable name="end-column" + select="$template-length + string-length($decl-string) + $indentation"/> + + <xsl:choose> + <!-- Check if we should put the template header on its own line to + save horizontal space. --> + <xsl:when test="($template-length > 0) and + ($end-column > $max-columns)"> + <!-- Emit template header on its own line --> + <xsl:apply-templates select="template" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:apply-templates> + + <!-- Emit the rest of the function declaration (without the + template header) indented two extra spaces. --> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + <xsl:with-param name="is-reference" select="$is-reference"/> + <xsl:with-param name="include-names" select="$include-names"/> + <xsl:with-param name="link-type" select="$link-type"/> + <xsl:with-param name="link-to" select="$link-to"/> + <xsl:with-param name="constructor-for" select="$constructor-for"/> + <xsl:with-param name="destructor-for" select="$destructor-for"/> + <xsl:with-param name="copy-assign-for" select="$copy-assign-for"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="standalone" select="$standalone"/> + <xsl:with-param name="suppress-template" select="true()"/> + </xsl:call-template> + </xsl:when> + + <!-- Check if we can put the entire declaration on a single + line. --> + <xsl:when test="not($end-column > $max-columns)"> + <!-- Emit template header, if not suppressed --> + <xsl:if test="not($suppress-template)"> + <xsl:apply-templates select="template" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="wrap" select="false()"/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> + </xsl:if> + + <!-- Emit specifiers --> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="$specifiers"/> + </xsl:call-template> + + <!-- Emit type, if any --> + <xsl:choose> + <!-- Conversion operators have an empty type, because the return + type is part of the name --> + <xsl:when test="$name='conversion-operator'"/> + + <!-- Constructors and destructors have no return type --> + <xsl:when test="$constructor-for or $destructor-for"/> + + <!-- Copy assignment operators return a reference to the class + they are in, unless another type has been explicitly + provided in the element. --> + <xsl:when test="$copy-assign-for and not(type)"> + <xsl:value-of select="concat($copy-assign-for, '& ')"/> + </xsl:when> + + <xsl:otherwise> + <xsl:apply-templates select="type" mode="highlight"/> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + + <xsl:call-template name="link-or-anchor"> + <xsl:with-param name="to" select="$link-to"/> + <xsl:with-param name="text" select="$function-name"/> + <xsl:with-param name="link-type" select="$link-type"/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:call-template> + + <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" + select="$indentation + $template-length + string-length($type) + + string-length($function-name) + 1"/> + <xsl:with-param name="final" select="true()"/> + </xsl:call-template> + <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:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:when> + + <!-- This declaration will take multiple lines --> + <xsl:otherwise> + <!-- Emit specifiers --> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="$specifiers"/> + </xsl:call-template> + + <!-- Emit type, if any --> + <xsl:choose> + <!-- Conversion operators have an empty type, because the return + type is part of the name --> + <xsl:when test="$name='conversion-operator'"/> + + <!-- Constructors and destructors have no return type --> + <xsl:when test="$constructor-for or $destructor-for"/> + + <!-- Copy assignment operators return a reference to the class + they are in, unless another type has been explicitly + provided in the element. --> + <xsl:when test="$copy-assign-for and not(type)"> + <xsl:value-of select="concat($copy-assign-for, '& ')"/> + </xsl:when> + + <xsl:otherwise> + <xsl:apply-templates select="type" mode="highlight"/> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="string-length($type) > $boost.short.result.type"> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:if> + + <!-- Determine how many columns the type and storage + specifiers take on the same line as the function name. --> + <xsl:variable name="type-length"> + <xsl:choose> + <xsl:when test="string-length($type) > $boost.short.result.type"> + 0 + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($type)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:call-template name="link-or-anchor"> + <xsl:with-param name="to" select="$link-to"/> + <xsl:with-param name="text" select="$function-name"/> + <xsl:with-param name="link-type" select="$link-type"/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:call-template> + <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" + select="$indentation + $type-length + + string-length($function-name) + 1"/> + <xsl:with-param name="final" select="true()"/> + </xsl:call-template> + <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:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Synopsis of function parameters, e.g., "(const T&, int x = 5)" --> + <xsl:template name="function-parameters"> + <!-- Indentation level of this parameter list --> + <xsl:param name="indentation"/> + + <!-- True if we should include parameter names --> + <xsl:param name="include-names" select="true()"/> + + <!-- True if we should wrap function parameters to the next line --> + <xsl:param name="wrap" select="true()"/> + + <!-- True if we are printing the final output --> + <xsl:param name="final" select="false()"/> + + <!-- Internal: The prefix to emit before a parameter --> + <xsl:param name="prefix" select="''"/> + + <!-- Internal: The list of parameters --> + <xsl:param name="parameters" select="parameter"/> + + <!-- Internal: The column we are on --> + <xsl:param name="column" select="$indentation"/> + + <!-- Internal: Whether this is the first parameter on this line or not --> + <xsl:param name="first-on-line" select="true()"/> + + <xsl:if test="$parameters"> + <!-- Information for this parameter --> + <xsl:variable name="parameter" select="$parameters[position()=1]"/> + <xsl:variable name="pack"> + <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 != ''"> + <xsl:text> </xsl:text><xsl:value-of select="$parameter/@name"/> + </xsl:if> + </xsl:variable> + + <xsl:variable name="type" select="string($parameter/paramtype)"/> + + <xsl:variable name="default"> + <xsl:choose> + <xsl:when test="$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: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"> + <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> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="text" select="concat($type, $pack, $name, $default)"/> + + <xsl:variable name="end-column" + select="$column + string-length($prefix) + string-length($text)"/> + + <xsl:choose> + <!-- Parameter goes on this line --> + <xsl:when test="$first-on-line or ($end-column < $max-columns) + or not($wrap)"> + <xsl:choose> + <xsl:when test="$final"> + <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:copy-of select="$pack"/> + <xsl:value-of select="$name"/> + <xsl:copy-of select="$default"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($prefix, $text)"/> + </xsl:otherwise> + </xsl:choose> + + <xsl:call-template name="function-parameters"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="include-names" select="$include-names"/> + <xsl:with-param name="wrap" select="$wrap"/> + <xsl:with-param name="final" select="$final"/> + <xsl:with-param name="parameters" + select="$parameters[position()!=1]"/> + <xsl:with-param name="prefix" select="', '"/> + <xsl:with-param name="column" select="$end-column"/> + <xsl:with-param name="first-on-line" select="false()"/> + </xsl:call-template> + </xsl:when> + <!-- Parameter goes on next line --> + <xsl:otherwise> + <!-- The comma goes on this line --> + <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"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:choose> + <xsl:when test="$final"> + <xsl:apply-templates + select="$parameter/paramtype/*|$parameter/paramtype/text()" + mode="annotation"> + <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> + <xsl:copy-of select="$pack"/> + <xsl:value-of select="$name"/> + <xsl:copy-of select="$default"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($prefix, $text)"/> + </xsl:otherwise> + </xsl:choose> + + <!-- Emit next parameter --> + <xsl:call-template name="function-parameters"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="include-names" select="$include-names"/> + <xsl:with-param name="wrap" select="$wrap"/> + <xsl:with-param name="final" select="$final"/> + <xsl:with-param name="parameters" + select="$parameters[position()!=1]"/> + <xsl:with-param name="prefix" select="', '"/> + <xsl:with-param name="column" + select="1 + string-length($text) + $indentation"/> + <xsl:with-param name="first-on-line" select="false()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + + <!-- Function synopsis --> + <xsl:template match="function|method" mode="synopsis"> + <xsl:param name="indentation"/> + + <!-- True if we should compact this function --> + <xsl:variable name="compact" + select="not (para|description|requires|effects|postconditions|returns| + throws|complexity|notes|rationale) and + ($boost.compact.function='1') and + not (local-name(.)='method')"/> + + <xsl:choose> + <xsl:when test="$compact"> + <xsl:if test="purpose"> + <!-- Compact display outputs the purpose as a comment (if + there is one) and the entire function declaration. --> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:apply-templates select="purpose/*|purpose/text()" + mode="purpose"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="is-reference" select="true()"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="is-reference" select="false()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="overloaded-function|overloaded-method" mode="synopsis"> + <xsl:param name="indentation"/> + + <xsl:variable name="name" select="@name"/> + + <!-- True if we should compact this function --> + <xsl:variable name="compact" + select="not (para|description|requires|effects|postconditions|returns| + throws|complexity|notes|rationale) and + ($boost.compact.function='1') and + not (local-name(.)='overloaded-method')"/> + + <xsl:choose> + <xsl:when test="$compact"> + <xsl:if test="purpose"> + <!-- Compact display outputs the purpose as a comment (if + there is one) and the entire function declaration. --> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:apply-templates select="purpose" mode="annotation"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + + <xsl:for-each select="signature"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:when test="local-name(..)='namespace'"> + <xsl:variable name="link-to"> + <xsl:call-template name="generate.id"/> + </xsl:variable> + + <xsl:for-each select="signature"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="is-reference" select="false()"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="link-to" select="$link-to"/> + </xsl:call-template> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="signature"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="is-reference" select="false()"/> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Group free functions together under a category name (header synopsis)--> + <xsl:template match="free-function-group" mode="header-synopsis"> + <xsl:param name="class"/> + <xsl:param name="indentation"/> + <xsl:apply-templates select="function|overloaded-function" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:apply-templates> + </xsl:template> + + <!-- Constructors, destructor, and assignment operators --> + <xsl:template name="construct-copy-destruct-synopsis"> + <xsl:param name="indentation"/> + <xsl:if test="constructor|copy-assignment|destructor"> + <xsl:if test="typedef|static-constant"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <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> + <xsl:apply-templates select="copy-assignment" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:apply-templates> + <xsl:apply-templates select="destructor" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:apply-templates> + </xsl:if> + </xsl:template> + + <xsl:template name="construct-copy-destruct-reference"> + <xsl:if test="constructor|copy-assignment|destructor"> + <xsl:call-template name="member-documentation"> + <xsl:with-param name="name"> + <xsl:call-template name="anchor"> + <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="''"/> + </xsl:call-template> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:call-template name="access-name"/> + <xsl:text> construct/copy/destruct</xsl:text> + </xsl:with-param> + <xsl:with-param name="text"> + <orderedlist> + <xsl:apply-templates select="constructor" mode="reference"/> + <xsl:apply-templates select="copy-assignment" mode="reference"/> + <xsl:apply-templates select="destructor" mode="reference"/> + </orderedlist> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="constructor" mode="reference"> + <xsl:call-template name="function.documentation"> + <xsl:with-param name="text"> + <para> + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="constructor-for"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + <xsl:with-param name="standalone" select="true()"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:call-template name="function-requirements"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="copy-assignment" mode="reference"> + <xsl:call-template name="function.documentation"> + <xsl:with-param name="text"> + <para> + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="copy-assign-for"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + <xsl:with-param name="standalone" select="true()"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:call-template name="function-requirements"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="destructor" mode="reference"> + <xsl:call-template name="function.documentation"> + <xsl:with-param name="text"> + <para> + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="destructor-for"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + <xsl:with-param name="standalone" select="true()"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:call-template name="function-requirements"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <!-- Templates for functions --> + <xsl:template name="function.documentation"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="count(ancestor::free-function-group) > 0 + or count(ancestor::method-group) > 0 + or local-name(.)='constructor' + or local-name(.)='copy-assignment' + or local-name(.)='destructor'"> + <listitem><xsl:copy-of select="$text"/></listitem> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Semantic descriptions of functions --> + <xsl:template name="function-requirements"> + <xsl:param name="namespace-reference" select="false()"/> + + <xsl:if test="$namespace-reference=false()"> + <xsl:apply-templates select="purpose/*|purpose/text()"/> + </xsl:if> + + <xsl:apply-templates select="description/*"/> + + <xsl:if test="parameter/description|signature/parameter/description| + template/template-type-parameter/purpose| + template/template-nontype-parameter/purpose| + requires|effects|postconditions|returns|throws|complexity| + notes|rationale"> + <variablelist spacing="compact"> + <xsl:processing-instruction name="dbhtml"> + list-presentation="table" + </xsl:processing-instruction> + + <!-- Document parameters --> + <xsl:if test="parameter/description|signature/parameter/description"> + <varlistentry> + <term>Parameters:</term> + <listitem> + <variablelist spacing="compact"> + <xsl:processing-instruction name="dbhtml"> + list-presentation="table" + </xsl:processing-instruction> + <xsl:for-each select="parameter|signature/parameter"> + <xsl:sort select="attribute::name"/> + <xsl:if test="description"> + <varlistentry> + <term> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </term> + <listitem> + <xsl:apply-templates select="description/*"/> + </listitem> + </varlistentry> + </xsl:if> + </xsl:for-each> + </variablelist> + </listitem> + </varlistentry> + </xsl:if> + + <!-- Document template parameters --> + <xsl:if test="template/template-type-parameter/purpose| + template/template-nontype-parameter/purpose"> + <varlistentry> + <term>Template Parameters:</term> + <listitem> + <variablelist spacing="compact"> + <xsl:processing-instruction name="dbhtml"> + list-presentation="table" + </xsl:processing-instruction> + <xsl:for-each select="template/template-type-parameter| + template/template-nontype-parameter"> + <xsl:sort select="attribute::name"/> + <xsl:if test="purpose"> + <varlistentry> + <term> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </term> + <listitem> + <xsl:apply-templates select="purpose/*"/> + </listitem> + </varlistentry> + </xsl:if> + </xsl:for-each> + </variablelist> + </listitem> + </varlistentry> + </xsl:if> + + <!-- Document rest of function's contract --> + <xsl:for-each select="requires|effects|postconditions|returns|throws|complexity| + notes|rationale"> + <varlistentry> + <term><xsl:call-template name="function.requirement.name"/>:</term> + <listitem> + <xsl:apply-templates select="./*|./text()" mode="annotation"/> + </listitem> + </varlistentry> + </xsl:for-each> + + </variablelist> + </xsl:if> + + <xsl:if test="para"> + <xsl:message> + <xsl:text>Warning: Use of 'para' elements in a function is deprecated. </xsl:text> + <xsl:text> Wrap them in a 'description' element.</xsl:text> + </xsl:message> + <xsl:call-template name="print.warning.context"/> + <xsl:apply-templates select="para"/> + </xsl:if> + + </xsl:template> + + <xsl:template name="function.requirement.name"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="local-name($node)='requires'">Requires</xsl:when> + <xsl:when test="local-name($node)='effects'">Effects</xsl:when> + <xsl:when test="local-name($node)='postconditions'"> + <xsl:text>Postconditions</xsl:text> + </xsl:when> + <xsl:when test="local-name($node)='returns'">Returns</xsl:when> + <xsl:when test="local-name($node)='throws'">Throws</xsl:when> + <xsl:when test="local-name($node)='complexity'">Complexity</xsl:when> + <xsl:when test="local-name($node)='notes'">Notes</xsl:when> + <xsl:when test="local-name($node)='rationale'">Rationale</xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>Error: unhandled node type `</xsl:text> + <xsl:value-of select="local-name($node)"/> + <xsl:text>' in template function.requirement.name.</xsl:text> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Function reference --> + <xsl:template match="function|method" mode="reference"> + <!-- True if we should compact this function --> + <xsl:variable name="compact" + select="not (para|description|requires|effects|postconditions|returns| + throws|complexity|notes|rationale) and + ($boost.compact.function='1') and + not (local-name(.)='method')"/> + + <xsl:if test="not ($compact)"> + <xsl:call-template name="function.documentation"> + <xsl:with-param name="text"> + <para> + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="link-type" select="'anchor'"/> + <xsl:with-param name="standalone" select="true()"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:call-template name="function-requirements"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- Reference for functions at namespace level --> + <xsl:template match="function" mode="namespace-reference"> + <!-- True if we should compact this function --> + <xsl:variable name="compact" + select="not (para|description|requires|effects|postconditions|returns| + throws|complexity|notes|rationale) and + ($boost.compact.function='1')"/> + + <xsl:if test="not ($compact)"> + <xsl:call-template name="reference-documentation"> + <xsl:with-param name="name"> + <xsl:text>Function </xsl:text> + <xsl:if test="template"> + <xsl:text>template </xsl:text> + </xsl:if> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="refname"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/> + <xsl:with-param name="anchor"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="synopsis"> + <xsl:call-template name="header-link"/> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="link-type" select="'none'"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:call-template name="function-requirements"> + <xsl:with-param name="namespace-reference" select="true()"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="overloaded-function" mode="reference"> + <xsl:variable name="name" select="@name"/> + + <!-- True if we should compact this function --> + <xsl:variable name="compact" + select="not (para|description|requires|effects|postconditions|returns| + throws|complexity|notes|rationale) and + ($boost.compact.function='1')"/> + + <xsl:if test="not ($compact)"> + <xsl:call-template name="function.documentation"> + <xsl:with-param name="text"> + <para> + <xsl:attribute name="id"> + <xsl:call-template name="generate.id"/> + </xsl:attribute> + + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:for-each select="signature"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="standalone" select="true()"/> + </xsl:call-template> + </xsl:for-each> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:call-template name="function-requirements"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="overloaded-function" mode="namespace-reference"> + <!-- True if we should compact this function --> + <xsl:variable name="compact" + select="not (para|description|requires|effects|postconditions|returns| + throws|complexity|notes|rationale) and + ($boost.compact.function='1')"/> + + <xsl:variable name="name" select="@name"/> + + <xsl:if test="not ($compact)"> + <xsl:call-template name="reference-documentation"> + <xsl:with-param name="name"> + <xsl:text>Function </xsl:text> + <xsl:if test="template"> + <xsl:text>template </xsl:text> + </xsl:if> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="refname"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/> + <xsl:with-param name="anchor"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="synopsis"> + <xsl:call-template name="header-link"/> + <xsl:for-each select="signature"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="link-type" select="'none'"/> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:for-each> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:call-template name="function-requirements"> + <xsl:with-param name="namespace-reference" select="true()"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="overloaded-method" mode="reference"> + <xsl:variable name="name" select="@name"/> + + <xsl:call-template name="function.documentation"> + <xsl:with-param name="text"> + <para> + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:call-template name="anchor"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + </xsl:call-template> + <xsl:for-each select="signature"> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="name" select="$name"/> + <xsl:with-param name="standalone" select="true()"/> + </xsl:call-template> + </xsl:for-each> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:call-template name="function-requirements"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <!-- Group member functions together under a category name (synopsis)--> + <xsl:template match="method-group" mode="synopsis"> + <xsl:param name="indentation"/> + <xsl:if test="count(child::*) > 0"> + <xsl:text> </xsl:text> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <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"/> + </xsl:apply-templates> + </xsl:if> + </xsl:template> + + <!-- Group member functions together under a category name (reference)--> + <xsl:template match="method-group" mode="reference"> + <xsl:if test="count(child::*) > 0"> + <xsl:call-template name="member-documentation"> + <xsl:with-param name="name"> + <xsl:call-template name="anchor"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="text" select="''"/> + </xsl:call-template> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:value-of select="@name"/> + </xsl:with-param> + <xsl:with-param name="text"> + <orderedlist> + <xsl:apply-templates select="method|overloaded-method" + mode="reference"/> + </orderedlist> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- Group free functions together under a category name (synopsis)--> + <xsl:template match="free-function-group" mode="synopsis"> + <xsl:param name="class"/> + <xsl:param name="indentation"/> + <xsl:text> </xsl:text> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <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> + </xsl:template> + + <!-- Group free functions together under a category name (reference)--> + <xsl:template match="free-function-group" mode="reference"> + <xsl:param name="class"/> + <xsl:call-template name="member-documentation"> + <xsl:with-param name="name"> + <xsl:call-template name="anchor"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="text" select="''"/> + </xsl:call-template> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="$class"/> + </xsl:call-template> + <xsl:value-of select="concat(' ',@name)"/> + </xsl:with-param> + <xsl:with-param name="text"> + <orderedlist> + <xsl:apply-templates select="function|overloaded-function" + mode="reference"/> + </orderedlist> + </xsl:with-param> + </xsl:call-template> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/global.xsl b/src/boost/tools/boostbook/xsl/global.xsl new file mode 100644 index 000000000..bb22160ab --- /dev/null +++ b/src/boost/tools/boostbook/xsl/global.xsl @@ -0,0 +1,80 @@ +<?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" version="1.0"> + <xsl:template name="global-synopsis"> + <xsl:param name="indentation" select="0" /> + <xsl:if test="not(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() > 1)"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation" /> + </xsl:call-template> + <xsl:call-template name="global-synopsis-impl"> + <xsl:with-param name="link-type" select="'link'" /> + </xsl:call-template> + </xsl:template> + <xsl:template name="global-reference"> + <xsl:call-template name="reference-documentation"> + <xsl:with-param name="refname"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="." /> + </xsl:call-template> + <xsl:apply-templates select="specialization" /> + </xsl:with-param> + <xsl:with-param name="purpose" select="purpose/*|purpose/text()" /> + <xsl:with-param name="anchor"> + <xsl:call-template name="generate.id" /> + </xsl:with-param> + <xsl:with-param name="name"> + <xsl:text>Global </xsl:text> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name" /> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="synopsis"> + <xsl:call-template name="header-link"/> + <xsl:call-template name="global-synopsis-impl"> + <xsl:with-param name="link-type" select="'none'" /> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:apply-templates select="description" /> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + <xsl:template name="global-synopsis-impl"> + <xsl:param name="link-type" /> + <xsl:if test="@specifiers"> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="@specifiers" /> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + <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"> + <xsl:call-template name="generate.id" select="." /> + </xsl:with-param> + <xsl:with-param name="text" select="@name" /> + <xsl:with-param name="link-type" select="$link-type" /> + </xsl:call-template> + <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"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/html-base.xsl b/src/boost/tools/boostbook/xsl/html-base.xsl new file mode 100644 index 000000000..a1031710b --- /dev/null +++ b/src/boost/tools/boostbook/xsl/html-base.xsl @@ -0,0 +1,428 @@ +<?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="boost.mathjax" select="0"/> + <xsl:param name="boost.mathjax.script" + select="'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'"/> + <!--See usage below for explanation of this param--> + <xsl:param name="boost.noexpand.chapter.toc" select="0"/> + <!-- Currently just adds a viewport meta tag --> + <xsl:param name="boost.mobile" select="0"/> + + <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">UTF-8</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: " or "$Date:: " --> + <xsl:variable name="text.noprefix" + select="substring-after($text, ': ')"/> + + <!-- 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)"/> + <xsl:if test="$time != ''"> + <xsl:value-of select="concat(' at ', $time, ' ', $timezone)"/> + </xsl:if> + </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 and not($revision-text = '$Date$')"> + <p> + <small> + <xsl:text>Last revised: </xsl:text> + <xsl:choose> + <xsl:when test="not(contains($revision-text, '$Date: ')) and not(contains($revision-text, '$Date:: '))"> + <xsl:value-of select="$revision-text"/> + </xsl:when> + <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 match="*" mode="detect-math"> + <xsl:variable name="is-chunk"> + <xsl:call-template name="chunk"/> + </xsl:variable> + <xsl:if test="$is-chunk = '0'"> + <xsl:apply-templates mode="detect-math"/> + </xsl:if> + </xsl:template> + + <xsl:template match="text()" mode="detect-math"/> + + <xsl:template match="textobject[@role='tex']" mode="detect-math"> + <xsl:text>1</xsl:text> + </xsl:template> + + <xsl:template name="user.head.content"> + <xsl:if test="$boost.mathjax = 1"> + <xsl:variable name="has-math"> + <xsl:apply-templates mode="detect-math" select="*"/> + </xsl:variable> + <xsl:if test="string($has-math) != ''"> + <script type="text/javascript" src="{$boost.mathjax.script}"/> + </xsl:if> + </xsl:if> + <xsl:if test="$boost.mobile = 1"> + <meta name="viewport" content="width=device-width"/> + </xsl:if> + </xsl:template> + + <xsl:template match="inlinemediaobject"> + <xsl:choose> + <xsl:when test="$boost.mathjax = 1 and textobject[@role='tex']"> + <xsl:variable name="content" select="string(textobject[@role='tex'])"/> + <xsl:variable name="plain-content"> + <xsl:choose> + <!--strip $$--> + <xsl:when test="substring($content, 1, 1) = '$' and + substring($content, string-length($content), 1) = '$'"> + <xsl:value-of select="substring($content, 2, string-length($content) - 2)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$content"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <script type="math/tex"> + <xsl:value-of select="$plain-content"/> + </script> + <noscript> + <xsl:apply-imports/> + </noscript> + </xsl:when> + <xsl:otherwise> + <xsl:apply-imports/> + </xsl:otherwise> + </xsl:choose> + </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> + +<xsl:template match="itemizedlist[@role = 'index']" mode="class.value"> + <xsl:value-of select="'index'"/> +</xsl:template> + +<xsl:template match="sidebar[@role = 'blurb']" mode="class.value"> + <xsl:value-of select="'blurb'"/> +</xsl:template> + +<xsl:template match="preface|chapter|appendix|article" mode="toc"> + <xsl:param name="toc-context" select="."/> + + <!-- + When boost.noexpand.chapter.toc is set to 1, then the TOC for + chapters is only one level deep (ie toc.max.depth has no effect) + and nested sections within chapters are not shown. TOC's and LOC's + at other levels are not effected and respond to toc.max.depth as normal. + --> + <xsl:choose> + <xsl:when test="local-name($toc-context) = 'book' and $boost.noexpand.chapter.toc = 1"> + <xsl:call-template name="subtoc"> + <xsl:with-param name="toc-context" select="$toc-context"/> + <xsl:with-param name="nodes" select="foo"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="subtoc"> + <xsl:with-param name="toc-context" select="$toc-context"/> + <xsl:with-param name="nodes" + select="section|sect1|glossary|bibliography|index + |bridgehead[$bridgehead.in.toc != 0]"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +</xsl:stylesheet> + + diff --git a/src/boost/tools/boostbook/xsl/html-help.xsl b/src/boost/tools/boostbook/xsl/html-help.xsl new file mode 100644 index 000000000..2234af36f --- /dev/null +++ b/src/boost/tools/boostbook/xsl/html-help.xsl @@ -0,0 +1,49 @@ +<?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"> + + <!-- Import the HTML chunking stylesheet --> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"/> + + <xsl:param name="admon.style"/> + <xsl:param name="admon.graphics">1</xsl:param> + <xsl:param name="boostbook.verbose" select="0"/> + <xsl:param name="html.stylesheet" select="'boostbook.css'"/> + <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="callout.graphics.number.limit">15</xsl:param> + <xsl:param name="draft.mode">no</xsl:param> + <xsl:param name="admon.graphics" select="1"/> + + <!-- 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:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/html-single.xsl b/src/boost/tools/boostbook/xsl/html-single.xsl new file mode 100644 index 000000000..57547aafb --- /dev/null +++ b/src/boost/tools/boostbook/xsl/html-single.xsl @@ -0,0 +1,38 @@ +<?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"> + + <!-- Import the HTML stylesheet --> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/html/math.xsl"/> + + <xsl:output method="html" encoding="UTF-8" indent="no"/> + + <!-- 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="docbook-layout.xsl"/> + <xsl:include href="admon.xsl"/> + <xsl:include href="xref.xsl"/> + <xsl:include href="relative-href.xsl"/> + <xsl:include href="callout.xsl"/> + + <xsl:param name="admon.style"/> + <xsl:param name="admon.graphics">1</xsl:param> + <xsl:param name="chapter.autolabel" select="0"/> + <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:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/html.xsl b/src/boost/tools/boostbook/xsl/html.xsl new file mode 100644 index 000000000..11a110b9a --- /dev/null +++ b/src/boost/tools/boostbook/xsl/html.xsl @@ -0,0 +1,37 @@ +<?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"> + + <!-- Import the HTML chunking stylesheet --> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/html/math.xsl"/> + + <!-- 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> diff --git a/src/boost/tools/boostbook/xsl/index.xsl b/src/boost/tools/boostbook/xsl/index.xsl new file mode 100644 index 000000000..3a9319395 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/index.xsl @@ -0,0 +1,18 @@ +<?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" + version="1.0"> + <xsl:template match="class-index"> + + </xsl:template> + + <xsl:template match="function-index"> + + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/library.xsl b/src/boost/tools/boostbook/xsl/library.xsl new file mode 100644 index 000000000..4d299feed --- /dev/null +++ b/src/boost/tools/boostbook/xsl/library.xsl @@ -0,0 +1,129 @@ +<?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" + version="1.0"> + <xsl:key name="library-categories" match="library" + use="libraryinfo/librarycategory/@name"/> + + <xsl:template match="librarylist"> + <itemizedlist spacing="compact"> + <xsl:apply-templates select="//library" + mode="build-library-list"> + <xsl:sort select="@name"/> + </xsl:apply-templates> + </itemizedlist> + </xsl:template> + + <xsl:template name="library.link"> + <xsl:param name="node" select="."/> + <xsl:param name="name" select="$node/attribute::name"/> + + <xsl:choose> + <xsl:when test="$node/attribute::html-only = 1"> + <xsl:variable name="url"> + <xsl:choose> + <xsl:when test="$node/attribute::url"> + <xsl:value-of select="$node/attribute::url"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($boost.root, + '/libs/', + $node/attribute::dirname, + '/index.html')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <ulink> + <xsl:attribute name="url"> + <xsl:value-of select="$url"/> + </xsl:attribute> + <xsl:value-of select="$name"/> + </ulink> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:choose> + <xsl:when test="$node/attribute::id"> + <xsl:value-of select="$node/attribute::id"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + <xsl:with-param name="text" select="$name"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="library" mode="build-library-list"> + <listitem> + <simpara> + <xsl:call-template name="library.link"/> + <xsl:text> - </xsl:text> + <xsl:apply-templates select="libraryinfo/librarypurpose" + mode="build-library-list"/> + </simpara> + </listitem> + </xsl:template> + + <xsl:template match="librarypurpose" mode="build-library-list"> + <xsl:apply-templates/> + <xsl:text>, from </xsl:text> + <xsl:apply-templates select="../author" mode="display-author-list"/> + </xsl:template> + + <xsl:template match="author" mode="display-author-list"> + <xsl:if test="(position() > 1) and (count(../author) > 2)"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:if test="(position() = count(../author)) and (position() > 1)"> + <xsl:if test="position() < 3"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:text>and </xsl:text> + </xsl:if> + <xsl:apply-templates select="firstname/text()"/> + <xsl:text> </xsl:text> + <xsl:apply-templates select="surname/text()"/> + <xsl:if test="(position() = count(../author))"> + <xsl:text>.</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="librarycategorylist"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="librarycategorydef"> + <section> + <title><xsl:apply-templates/></title> + <xsl:variable name="name" select="@name"/> + <itemizedlist spacing="compact"> + <xsl:apply-templates select="key('library-categories', $name)" + mode="build-library-list"> + <xsl:sort select="@name"/> + </xsl:apply-templates> + </itemizedlist> + </section> + </xsl:template> + + <xsl:template match="libraryinfo"> + <chapterinfo> + <xsl:apply-templates select="author|authorgroup/author|copyright|legalnotice"/> + </chapterinfo> + </xsl:template> + + <xsl:template match="librarypurpose|librarycategory"/> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/lookup.xsl b/src/boost/tools/boostbook/xsl/lookup.xsl new file mode 100644 index 000000000..91b4a59d4 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/lookup.xsl @@ -0,0 +1,457 @@ +<?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:exsl="http://exslt.org/common" + version="1.0"> + + <!-- Maximum length of directory and file names is 31 characters. + '.html' uses 5 characters. + 31 - 5 = 26 --> + <xsl:param name="boost.max.id.part.length">26</xsl:param> + + <!-- Generate an ID for the entity referenced --> + <xsl:template name="generate.id"> + <xsl:param name="node" select="."/> + <xsl:apply-templates select="$node" mode="generate.id"/> + </xsl:template> + + <xsl:template match="*" mode="generate.id"> + <xsl:variable name="raw.id"><xsl:call-template name="object.id"/></xsl:variable> + <xsl:value-of select="translate($raw.id, '.', '_')"/> + <xsl:text>-bb</xsl:text> + </xsl:template> + + <xsl:template name="postfix.id"> + <xsl:variable name="raw.id"><xsl:call-template name="object.id"/></xsl:variable> + <xsl:choose> + <xsl:when test="starts-with($raw.id, 'id-')"> + <xsl:value-of select="translate(substring-after($raw.id, 'id-'), '.', '_')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$raw.id"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="strip-qualifiers-non-template"> + <xsl:param name="name"/> + <xsl:choose> + <xsl:when test="contains($name, '>')"> + <xsl:call-template name="strip-qualifiers-non-template"> + <xsl:with-param name="name" select="substring-after($name, '>')"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($name, '::')"> + <xsl:call-template name="strip-qualifiers-non-template"> + <xsl:with-param name="name" select="substring-after($name, '::')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="strip-balanced"> + <xsl:param name="name"/> + <xsl:param name="open" select="'<'"/> + <xsl:param name="close" select="'>'"/> + <xsl:param name="depth" select="0"/> + <xsl:choose> + <xsl:when test="contains($name, $open) + and not(contains(substring-before($name, $open), $close))"> + <xsl:call-template name="strip-balanced"> + <xsl:with-param name="name" select="substring-after($name, $open)"/> + <xsl:with-param name="open" select="$open"/> + <xsl:with-param name="close" select="$close"/> + <xsl:with-param name="depth" select="$depth + 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($name, $close) and ($depth > 1)"> + <xsl:call-template name="strip-balanced"> + <xsl:with-param name="name" select="substring-after($name, $close)"/> + <xsl:with-param name="open" select="$open"/> + <xsl:with-param name="close" select="$close"/> + <xsl:with-param name="depth" select="$depth - 1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($name, $close)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="strip-qualifiers-template"> + <xsl:param name="name"/> + <xsl:choose> + <xsl:when test="contains($name, '::') + and not(contains(substring-before($name, '::'), '<'))"> + <xsl:call-template name="strip-qualifiers-template"> + <xsl:with-param name="name" select="substring-after($name, '::')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="rest"> + <xsl:call-template name="strip-balanced"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:variable> + <xsl:choose> + <xsl:when test="$rest != ''"> + <xsl:call-template name="strip-qualifiers-template"> + <xsl:with-param name="name" select="$rest"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Strip the qualifiers off a qualified name and return the unqualified + name. For instance, "boost::python::function" would become just + "function". + Must handle ns::foo -> foo + Must handle ns::foo<bar::baz> -> foo<bar::baz> + Must handle ns::foo<bar::baz>::nested -> nested + Must handle ns::foo<x>::bar<y> -> bar<y> --> + <xsl:template name="strip-qualifiers"> + <xsl:param name="name"/> + <xsl:choose> + <xsl:when test="substring($name, string-length($name)) = '>'"> + <xsl:call-template name="strip-qualifiers-template"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="strip-qualifiers-non-template"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Build the fully-qualified id of the given node --> + <xsl:template name="fully-qualified-id"> + <xsl:param name="node"/> + + <xsl:apply-templates select="$node" mode="fully-qualified-name"> + <xsl:with-param name="is.id" select="true()"/> + </xsl:apply-templates> + </xsl:template> + + <!-- Build the fully-qualified name of the given node --> + <xsl:template name="fully-qualified-name"> + <xsl:param name="node"/> + <xsl:apply-templates select="$node" mode="fully-qualified-name"/> + </xsl:template> + + <!-- Hack to make the node we are building the current node so that the + ancestor:: syntax will work --> + <xsl:template match="*" mode="fully-qualified-name"> + <xsl:param name="is.id" select="false()" /> + <xsl:call-template name="build-fully-qualified-name"> + <xsl:with-param name="is.id" select="$is.id"/> + </xsl:call-template> + </xsl:template> + + <!-- The real routine that builds a fully-qualified name for the current + node. --> + <xsl:template name="build-fully-qualified-name"> + <xsl:param name="is.id" select="false()" /> + + <!-- 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="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:apply-templates select="." mode="print-id-part"> + <xsl:with-param name="is.id" select="$is.id"/> + </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"/> + + <xsl:variable name="part"> + <xsl:apply-templates select="." mode="print-name"/> + </xsl:variable> + + <xsl:variable name="unique-name"> + <xsl:apply-templates select="." mode="unique.name"/> + </xsl:variable> + + <xsl:choose> + <xsl:when test= + "$is.id and ( + string-length($part) > $boost.max.id.part.length or + $unique-name = 0 or + translate($part, '.<>;\:*?"| ', '') != $part + )"> + <xsl:variable name="normalized" select="translate(normalize-space(translate($part, '.<>;\:*?"|_', ' ')), ' ', '_')"/> + <xsl:variable name="id"><xsl:call-template name="postfix.id"/></xsl:variable> + <xsl:value-of select = + "concat( + substring($normalized, 1, $boost.max.id.part.length - string-length($id) - 1), + concat('_', $id))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$part"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Override this if an id might not be unique --> + <xsl:template match="*" mode="unique.name"> + <xsl:value-of select="1"/> + </xsl:template> + + <xsl:template match="function|overloaded-function" mode="unique.name"> + <xsl:variable name="func-name"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:variable> + + <!-- Count the number of elements with the same qualified name --> + <xsl:variable name="count-elements"> + <xsl:for-each select="key('named-entities', translate(@name, $uppercase-letters, $lowercase-letters))"> + <xsl:variable name="other-name"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:variable> + <xsl:if test="$func-name = $other-name"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:variable> + + <xsl:value-of select="number(string-length($count-elements) = 1)"/> + </xsl:template> + + <!-- Print the name of the current node --> + <xsl:template match="*" mode="print-name"> + <xsl:value-of select="@name"/> + </xsl:template> + + <xsl:template match="template-arg" mode="print-name"> + <xsl:if test="position() > 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:value-of select="text()"/> + <xsl:if test="@pack=1"> + <xsl:text>...</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template + match="struct-specialization|class-specialization|union-specialization" + mode="print-name"> + <xsl:value-of select="@name"/> + <xsl:text><</xsl:text> + <xsl:apply-templates select="specialization/template-arg" mode="print-name"/> + <xsl:text>></xsl:text> + </xsl:template> + + <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 context in which this name occurs --> + <xsl:param name="context"/> + + <!-- The node that we are checking against --> + <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"/> + + <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> + + <xsl:template match="*" mode="generate-cxx-links"> + <xsl:param name="name"/> + <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> + <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"> + <!-- The actual lookup node --> + <xsl:param name="lookup"/> + + <!-- The type of name to lookup (e.g., class) --> + <xsl:param name="type"/> + + <!-- The name we are looking for --> + <xsl:param name="name"/> + + <!-- The name we will display --> + <xsl:param name="display-name"/> + + <!-- The name we are looking for (unqualified)--> + <xsl:param name="unqualified-name"/> + + <!-- The list of nodes that match the lookup node in both name and type --> + <xsl:param name="nodes"/> + + <!-- 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="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="count($matches) = 0"> + <xsl:message> + <xsl:text>Cannot find </xsl:text> + <xsl:value-of select="$type"/> + <xsl:text> named '</xsl:text> + <xsl:value-of select="$name"/> + <xsl:text>'</xsl:text> + </xsl:message> + <xsl:value-of select="$display-name"/> + </xsl:when> + <xsl:otherwise> + <!-- 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> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/macro.xsl b/src/boost/tools/boostbook/xsl/macro.xsl new file mode 100644 index 000000000..40457a4e5 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/macro.xsl @@ -0,0 +1,128 @@ +<?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" + version="1.0"> + <xsl:template match="macro" mode="synopsis"> + <xsl:param name="indentation" select="0"/> + + <xsl:text> </xsl:text> + <xsl:if + test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="macro-synopsis"> + <xsl:with-param name="link-type" select="'link'"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="macro" mode="reference"> + <xsl:call-template name="reference-documentation"> + <xsl:with-param name="refname" select="@name"/> + <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/> + <xsl:with-param name="anchor"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="name"> + <xsl:text>Macro </xsl:text> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="synopsis"> + <xsl:call-template name="header-link"/> + <xsl:call-template name="macro-synopsis"> + <xsl:with-param name="link-type" select="'none'"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:apply-templates select="description"/> + + <xsl:if test="macro-parameter/description"> + <variablelist spacing="compact"> + <xsl:processing-instruction name="dbhtml"> + list-presentation="table" + </xsl:processing-instruction> + + <!-- Document parameters --> + <xsl:if test="macro-parameter/description"> + <varlistentry> + <term>Parameters:</term> + <listitem> + <variablelist spacing="compact"> + <xsl:processing-instruction name="dbhtml"> + list-presentation="table" + </xsl:processing-instruction> + <xsl:for-each select="macro-parameter"> + <xsl:sort select="attribute::name"/> + <xsl:if test="description"> + <varlistentry> + <term> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </term> + <listitem> + <xsl:apply-templates select="description/*"/> + </listitem> + </varlistentry> + </xsl:if> + </xsl:for-each> + </variablelist> + </listitem> + </varlistentry> + </xsl:if> + </variablelist> + </xsl:if> + + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template name="macro-synopsis"> + <xsl:param name="link-type"/> + + <xsl:call-template name="link-or-anchor"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id" select="."/> + </xsl:with-param> + <xsl:with-param name="text" select="@name"/> + <xsl:with-param name="link-type" select="$link-type"/> + </xsl:call-template> + + <xsl:if test="@kind='functionlike'"> + <xsl:text>(</xsl:text> + <xsl:for-each select="macro-parameter"> + <xsl:if test="position() > 1"> + <xsl:text>, </xsl:text> + </xsl:if> + <xsl:value-of select="@name"/> + </xsl:for-each> + <xsl:text>)</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="macro" mode="generate.id"> + <xsl:choose> + <xsl:when test="string-length(@name) > $boost.max.id.part.length or + count(key('named-entities', + translate(@name, $uppercase-letters, $lowercase-letters)))!=1"> + <xsl:variable name="raw.id"><xsl:call-template name="postfix.id"/></xsl:variable> + <xsl:value-of select="substring(@name, 1, $boost.max.id.part.length - string-length($raw.id) - 1)"/> + <xsl:text>_</xsl:text> + <xsl:value-of select="$raw.id"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/manpages.xsl b/src/boost/tools/boostbook/xsl/manpages.xsl new file mode 100644 index 000000000..2f781c299 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/manpages.xsl @@ -0,0 +1,195 @@ +<?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" + version="1.0"> + + <!-- Import the man pages stylesheet --> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/> + + <xsl:param name="generate.manifest" select="1"/> + <xsl:param name="manifest">man.manifest</xsl:param> + + <xsl:template match="literallayout"> + <xsl:text> .nf </xsl:text> + <xsl:apply-templates/> + <xsl:text> .fi </xsl:text> + </xsl:template> + + <xsl:template match="para|simpara|remark" mode="list"> + <xsl:variable name="foo"> + <xsl:apply-templates/> + </xsl:variable> + <xsl:choose> + <xsl:when test="literallayout"> + <xsl:copy-of select="$foo"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space($foo)"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> + <xsl:if test="following-sibling::para or following-sibling::simpara or + following-sibling::remark"> + <!-- Make sure multiple paragraphs within a list item don't --> + <!-- merge together. --> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template name="build.refentry.filename"> + <xsl:param name="node" select="."/> + <xsl:variable name="section" select="$node/refmeta/manvolnum"/> + <xsl:variable name="name" select="$node/refnamediv/refname[1]"/> + <xsl:value-of select="concat('man', $section, '/', + translate(normalize-space($name), + '<>', '__'), + '.', $section)"/> + + </xsl:template> + + <xsl:template match="refentry" mode="manifest"> + <xsl:call-template name="build.refentry.filename"/> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="/"> + <xsl:choose> + <xsl:when test="//refentry"> + <xsl:apply-templates select="//refentry"/> + <xsl:if test="$generate.manifest=1"> + <xsl:call-template name="write.text.chunk"> + <xsl:with-param name="filename" select="$manifest"/> + <xsl:with-param name="content"> + <xsl:value-of select="$manifest"/> + <xsl:text> </xsl:text> + <xsl:apply-templates select="//refentry" mode="manifest"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:message>No refentry elements!</xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +<xsl:template match="refentry"> + <xsl:variable name="section" select="refmeta/manvolnum"/> + <xsl:variable name="name" select="refnamediv/refname[1]"/> + + <!-- standard man page width is 64 chars; 6 chars needed for the two + (x) volume numbers, and 2 spaces, leaves 56 --> + <xsl:variable name="twidth" select="(56 - string-length(refmeta/refentrytitle)) div 2"/> + + <xsl:variable name="reftitle" + select="substring(refmeta/refentrytitle, 1, $twidth)"/> + + <xsl:variable name="title"> + <xsl:choose> + <xsl:when test="refentryinfo/title"> + <xsl:value-of select="refentryinfo/title"/> + </xsl:when> + <xsl:when test="../referenceinfo/title"> + <xsl:value-of select="../referenceinfo/title"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="date"> + <xsl:choose> + <xsl:when test="refentryinfo/date"> + <xsl:value-of select="refentryinfo/date"/> + </xsl:when> + <xsl:when test="../referenceinfo/date"> + <xsl:value-of select="../referenceinfo/date"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="productname"> + <xsl:choose> + <xsl:when test="refentryinfo/productname"> + <xsl:value-of select="refentryinfo/productname"/> + </xsl:when> + <xsl:when test="../referenceinfo/productname"> + <xsl:value-of select="../referenceinfo/productname"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:call-template name="write.text.chunk"> + <xsl:with-param name="filename"> + <xsl:call-template name="build.refentry.filename"/> + </xsl:with-param> + <xsl:with-param name="content"> + <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source. +.de Sh \" Subsection +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH "</xsl:text> + <xsl:value-of select="translate($reftitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> + <xsl:text>" </xsl:text> + <xsl:value-of select="refmeta/manvolnum[1]"/> + <xsl:text> "</xsl:text> + <xsl:value-of select="normalize-space($date)"/> + <xsl:text>" "</xsl:text> + <xsl:value-of select="normalize-space($productname)"/> + <xsl:text>" "</xsl:text> + <xsl:value-of select="$title"/> + <xsl:text>" +</xsl:text> + <xsl:apply-templates/> + <xsl:text> </xsl:text> + + <!-- Author section --> + <xsl:choose> + <xsl:when test="refentryinfo//author"> + <xsl:apply-templates select="refentryinfo" mode="authorsect"/> + </xsl:when> + <xsl:when test="/book/bookinfo//author"> + <xsl:apply-templates select="/book/bookinfo" mode="authorsect"/> + </xsl:when> + <xsl:when test="/article/articleinfo//author"> + <xsl:apply-templates select="/article/articleinfo" mode="authorsect"/> + </xsl:when> + </xsl:choose> + + </xsl:with-param> + </xsl:call-template> + <!-- Now generate stub include pages for every page documented in + this refentry (except the page itself) --> + <xsl:for-each select="refnamediv/refname"> + <xsl:if test=". != $name"> + <xsl:call-template name="write.text.chunk"> + <xsl:with-param name="filename" + select="concat(normalize-space(.), '.', $section)"/> + <xsl:with-param name="content" select="concat('.so man', + $section, '/', $name, '.', $section, ' ')"/> + </xsl:call-template> + </xsl:if> + </xsl:for-each> +</xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/navbar.xsl b/src/boost/tools/boostbook/xsl/navbar.xsl new file mode 100644 index 000000000..7c320bbd7 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/navbar.xsl @@ -0,0 +1,425 @@ +<?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" + version="1.0"> + +<!-- Already included in the main style sheet --> +<!-- <xsl:import href="relative-href.xsl"/> --> + + <!-- + boost.defaults: + *none - only use explicitly set parameters + Boost - use standard boost settings, can be overridden + --> + <xsl:param name = "boost.defaults" select = "'none'"/> + + <!-- + how to render the Home | Libraries | ... | More contents + *none - do not display ("standalone" mode) + horizontal - display in old-Boost style format (default for Boost) + vertical - like the new Getting Started layout + --> + <xsl:param name = "nav.layout"> + <xsl:choose> + <xsl:when test = "$boost.defaults='Boost'">horizontal</xsl:when> + <xsl:otherwise>none</xsl:otherwise> + </xsl:choose> + </xsl:param> + <!-- + header border layout + Boost - place the old-Boost border around the header + Fullbleed - Simple CSS based full bleed header image + *none - do not place a border around the header + --> + <xsl:param name = "nav.border" select = "'none'" /> + + <!-- + nav.flow: + none - do not display navigation at the header + DocBook - display the navigation after the header + *Spirit - display "mini" navigation on the right + --> + <xsl:param name = "nav.flow" select = "'Spirit'"/> + + <!-- location of the various Boost elements --> + + <xsl:param name = "boost.root" select = "'../..'"/> + <xsl:param name = "boost.website" select = "'http://www.boost.org'"/> + <!-- Logo image location, leave empty for no logo --> + <xsl:param name = "boost.image.src"> + <xsl:if test = "$boost.defaults = 'Boost'"> + <xsl:value-of select = "concat($boost.root, '/boost.png')"/> + </xsl:if> + </xsl:param> + <xsl:param name = "boost.image.alt"> + <xsl:if test = "$boost.defaults = 'Boost'"> + <xsl:value-of select = "'Boost C++ Libraries'"/> + </xsl:if> + </xsl:param> + <xsl:param name = "boost.image.w"> + <xsl:if test = "$boost.defaults = 'Boost'"> + <xsl:value-of select = "277"/> + </xsl:if> + </xsl:param> + <xsl:param name = "boost.image.h"> + <xsl:if test = "$boost.defaults = 'Boost'"> + <xsl:value-of select = "86"/> + </xsl:if> + </xsl:param> + <xsl:param name = "boost.libraries"> + <xsl:if test = "$boost.defaults = 'Boost'"> + <xsl:value-of select = "concat($boost.root, '/libs/libraries.htm')"/> + </xsl:if> + </xsl:param> + + <!-- header --> + + <xsl:template name = "header.navigation"> + <xsl:param name = "prev" select = "/foo"/> + <xsl:param name = "next" select = "/foo"/> + <xsl:param name = "nav.context"/> + + <xsl:variable name = "home" select = "/*[1]"/> + <xsl:variable name = "up" select = "parent::*"/> + + <xsl:choose> + <xsl:when test = "$nav.border = 'Fullbleed'"> + <xsl:if test = "boolean(normalize-space($boost.image.src))"> + <div class="header-fullbleed"> + <img alt="{$boost.image.alt}" width="{$boost.image.w}" height="{$boost.image.h}"> + <xsl:attribute name="src"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$boost.image.src"/> + </xsl:call-template> + </xsl:attribute> + </img> + </div> + </xsl:if> + </xsl:when> + <xsl:when test = "boolean(normalize-space($boost.image.src)) or $nav.layout != 'none'"> + <table cellpadding = "2" width = "100%"><tr> + <xsl:if test = "$nav.border = 'Boost'"> + <xsl:attribute name = "class">boost-head</xsl:attribute> + </xsl:if> + + <td valign = "top"> + <xsl:if test = "$nav.border = 'Boost'"> + <xsl:attribute name = "style">background-color: white; width: 50%;</xsl:attribute> + </xsl:if> + <xsl:if test = "boolean(normalize-space($boost.image.src))"> + <img alt="{$boost.image.alt}" width="{$boost.image.w}" height="{$boost.image.h}"> + <xsl:attribute name="src"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$boost.image.src"/> + </xsl:call-template> + </xsl:attribute> + </img> + </xsl:if> + </td><xsl:choose> + <xsl:when test = "$nav.layout = 'horizontal'"> + <xsl:call-template name = "header.navdata-horiz"/> + </xsl:when><xsl:when test = "$nav.layout = 'vertical'"> + <xsl:call-template name = "header.navdata-vert"/> + </xsl:when> + </xsl:choose> + </tr></table> + <hr/> + </xsl:when> + </xsl:choose> + <xsl:choose> + <xsl:when test = "$nav.flow = 'DocBook'"> + <table width = "100%" class = "navheader"> + <xsl:call-template name = "navbar.docbook-homeinfo"> + <xsl:with-param name = "prev" select = "$prev"/> + <xsl:with-param name = "next" select = "$next"/> + <xsl:with-param name = "nav.context" select = "$nav.context"/> + </xsl:call-template> + <xsl:call-template name = "navbar.docbook-prevnext"> + <xsl:with-param name = "prev" select = "$prev"/> + <xsl:with-param name = "next" select = "$next"/> + <xsl:with-param name = "nav.context" select = "$nav.context"/> + </xsl:call-template> + </table> + </xsl:when><xsl:when test = "$nav.flow = 'Spirit'"> + <xsl:call-template name = "navbar.spirit"> + <xsl:with-param name = "prev" select = "$prev"/> + <xsl:with-param name = "next" select = "$next"/> + <xsl:with-param name = "nav.context" select = "$nav.context"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:template> + + <xsl:template name = "header.navdata-horiz"> + <xsl:variable name="home_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.root, '/index.html' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="libraries_link"> + <xsl:if test = "boolean($boost.libraries)"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$boost.libraries"/> + </xsl:call-template> + </xsl:if> + </xsl:variable> + <xsl:variable name="people_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.website, '/users/people.html' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="faq_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.website, '/users/faq.html' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="more_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test = "$nav.border = 'Boost'"> + <td align = "center" class = "boost-headtd"><a href = "{$home_link}" class = "boost-headelem">Home</a></td> + <xsl:if test = "boolean($libraries_link)"> + <td align = "center" class = "boost-headtd"><a href = "{$libraries_link}" class = "boost-headelem">Libraries</a></td> + </xsl:if> + <td align = "center" class = "boost-headtd"><a href = "{$people_link}" class = "boost-headelem">People</a></td> + <td align = "center" class = "boost-headtd"><a href = "{$faq_link}" class = "boost-headelem">FAQ</a></td> + <td align = "center" class = "boost-headtd"><a href = "{$more_link}" class = "boost-headelem">More</a></td> + </xsl:when><xsl:otherwise> + <td align = "center"><a href = "{$home_link}">Home</a></td> + <td align = "center"><a href = "{$libraries_link}">Libraries</a></td> + <td align = "center"><a href = "{$people_link}">People</a></td> + <td align = "center"><a href = "{$faq_link}">FAQ</a></td> + <td align = "center"><a href = "{$more_link}">More</a></td> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name = "header.navdata-vert"> + <xsl:variable name="home_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.root, '/index.html' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="libraries_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$boost.libraries"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="people_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.website, '/users/people.html' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="faq_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.website, '/users/faq.html' )"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="more_link"> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="concat( $boost.root, '/more/index.htm' )"/> + </xsl:call-template> + </xsl:variable> + + <td><div> + <xsl:if test = "$nav.border != 'Boost'"> + <xsl:attribute name = "class">boost-toc</xsl:attribute> + </xsl:if> + <div><a href = "{$home_link}">Home</a></div> + <div><a href = "{$libraries_link}">Libraries</a></div> + <div><a href = "{$people_link}">People</a></div> + <div><a href = "{$faq_link}">FAQ</a></div> + <div><a href = "{$more_link}">More</a></div> + </div></td> + </xsl:template> + + + <!-- footer --> + + <xsl:template name = "footer.navigation"> + <xsl:param name = "prev" select = "/foo"/> + <xsl:param name = "next" select = "/foo"/> + <xsl:param name = "nav.context"/> + + <hr/> + <xsl:choose> + <xsl:when test = "$nav.flow = 'DocBook'"> + <table width = "100%" class = "navheader"> + <xsl:call-template name = "navbar.docbook-prevnext"> + <xsl:with-param name = "prev" select = "$prev"/> + <xsl:with-param name = "next" select = "$next"/> + <xsl:with-param name = "nav.context" select = "$nav.context"/> + </xsl:call-template> + <xsl:call-template name = "navbar.docbook-homeinfo"> + <xsl:with-param name = "prev" select = "$prev"/> + <xsl:with-param name = "next" select = "$next"/> + <xsl:with-param name = "nav.context" select = "$nav.context"/> + </xsl:call-template> + </table> + </xsl:when><xsl:when test = "$nav.flow = 'Spirit'"> + <xsl:call-template name = "navbar.spirit"> + <xsl:with-param name = "prev" select = "$prev"/> + <xsl:with-param name = "next" select = "$next"/> + <xsl:with-param name = "nav.context" select = "$nav.context"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> + </xsl:template> + + <!-- navbar --> + + <xsl:template name = "navbar.docbook-homeinfo"> + <xsl:param name = "prev" select = "/foo"/> + <xsl:param name = "next" select = "/foo"/> + <xsl:param name = "nav.context"/> + + <xsl:variable name = "home" select = "/*[1]"/> + <tr> + <td align = "left" width = "40%"> + <xsl:if test = "$navig.showtitles != 0"> <!-- prev:name --> + <xsl:apply-templates select = "$prev" mode = "object.title.markup"/> + </xsl:if> + </td><td align = "center" width = "20%"> + <!-- home --> + <xsl:if test = "$home != . or $nav.context = 'toc'"> + <a accesskey = "h"> + <xsl:attribute name = "href"><xsl:call-template name = "href.target"> + <xsl:with-param name = "object" select = "$home"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'home'"/> + </xsl:call-template> + </a> + <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"> + <xsl:text>|</xsl:text> + </xsl:if> + </xsl:if> + <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t"> + <xsl:attribute name = "href"> + <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/> + <xsl:text>-toc</xsl:text> + <xsl:value-of select = "$html.ext"/> + </xsl:attribute> + <xsl:call-template name = "gentext"> + <xsl:with-param name = "key" select = "'nav-toc'"/> + </xsl:call-template> + </a></xsl:if> + </td><td align = "right" width = "40%"> + <xsl:if test = "$navig.showtitles != 0"> <!-- next:name --> + <xsl:apply-templates select = "$next" mode = "object.title.markup"/> + </xsl:if> + </td> + </tr> + </xsl:template> + + <xsl:template name = "navbar.docbook-prevnext"> + <xsl:param name = "prev" select = "/foo"/> + <xsl:param name = "next" select = "/foo"/> + <xsl:param name = "nav.context"/> + + <xsl:variable name = "up" select = "parent::*"/> + <tr> + <td align = "left" width = "40%"> + <xsl:if test = "count($prev)>0"><a accesskey = "p"> <!-- prev --> + <xsl:attribute name = "href"><xsl:call-template name = "href.target"> + <xsl:with-param name = "object" select = "$prev"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'prev'"/> + </xsl:call-template> + </a></xsl:if> + </td><td align = "center" width = "20%"> + <xsl:if test = "count($up)>0"><a accesskey = "u"> <!-- up --> + <xsl:attribute name = "href"><xsl:call-template name = "href.target"> + <xsl:with-param name = "object" select = "$up"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'up'"/> + </xsl:call-template> + </a></xsl:if> + </td><td align = "right" width = "40%"> + <xsl:if test = "count($next)>0"><a accesskey = "n"> <!-- next --> + <xsl:attribute name = "href"><xsl:call-template name = "href.target"> + <xsl:with-param name = "object" select = "$next"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'next'"/> + </xsl:call-template> + </a></xsl:if> + </td> + </tr> + </xsl:template> + + <xsl:template name = "navbar.spirit"> + <xsl:param name = "prev" select = "/foo"/> + <xsl:param name = "next" select = "/foo"/> + <xsl:param name = "nav.context"/> + + <xsl:variable name = "home" select = "/*[1]"/> + <xsl:variable name = "up" select = "parent::*"/> + + <div class = "spirit-nav"> + <!-- prev --> + <xsl:if test = "count($prev)>0"><a accesskey = "p"> + <xsl:attribute name = "href"><xsl:call-template name = "href.target"> + <xsl:with-param name = "object" select = "$prev"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'prev'"/> + </xsl:call-template> + </a></xsl:if> + <!-- up --> + <xsl:if test = "count($up)>0"><a accesskey = "u"> + <xsl:attribute name = "href"><xsl:call-template name = "href.target"> + <xsl:with-param name = "object" select = "$up"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'up'"/> + </xsl:call-template> + </a></xsl:if> + <!-- home --> + <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"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'home'"/> + </xsl:call-template> + </a> + <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"> + <xsl:text>|</xsl:text> + </xsl:if> + </xsl:if> + <xsl:if test = "$chunk.tocs.and.lots != 0 and $nav.context != 'toc'"><a accesskey = "t"> + <xsl:attribute name = "href"> + <xsl:apply-templates select = "/*[1]" mode = "recursive-chunk-filename"/> + <xsl:text>-toc</xsl:text> + <xsl:value-of select = "$html.ext"/> + </xsl:attribute> + <xsl:call-template name = "gentext"> + <xsl:with-param name = "key" select = "'nav-toc'"/> + </xsl:call-template> + </a></xsl:if> + <!-- next --> + <xsl:if test = "count($next)>0"><a accesskey = "n"> + <xsl:attribute name = "href"><xsl:call-template name = "href.target"> + <xsl:with-param name = "object" select = "$next"/> + </xsl:call-template></xsl:attribute> + <xsl:call-template name = "navig.content"> + <xsl:with-param name = "direction" select = "'next'"/> + </xsl:call-template> + </a></xsl:if> + </div> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/reference.xsl b/src/boost/tools/boostbook/xsl/reference.xsl new file mode 100644 index 000000000..b46e591b3 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/reference.xsl @@ -0,0 +1,198 @@ +<?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" + version="1.0"> + <xsl:include href="annotation.xsl"/> + <xsl:include href="template.xsl"/> + <xsl:include href="function.xsl"/> + <xsl:include href="type.xsl"/> + <xsl:include href="source-highlight.xsl"/> + <xsl:include href="utility.xsl"/> + <xsl:include href="lookup.xsl"/> + <xsl:include href="library.xsl"/> + <xsl:include href="index.xsl"/> + <xsl:include href="error.xsl"/> + <xsl:include href="macro.xsl"/> + <xsl:include href="testing/testsuite.xsl"/> + <xsl:include href="caramel/concept2docbook.xsl"/> + + <xsl:template name="namespace-synopsis"> + <xsl:param name="indentation" select="0"/> + <!-- Open namespace--> + <xsl:call-template name="indent"> + <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:call-template> + + <!-- Emit namespace types --> + <xsl:apply-templates select="class|class-specialization| + struct|struct-specialization| + union|union-specialization| + typedef|enum|data-member" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + + <!-- Emit namespace functions --> + <xsl:apply-templates + select="free-function-group|function|overloaded-function" + mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + + <!-- Emit namespaces --> + <xsl:apply-templates select="namespace" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + + <!-- Close namespace --> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'}'"/> + </xsl:call-template> + </xsl:template> + + <!-- Emit namespace synopsis --> + <xsl:template match="namespace" mode="synopsis"> + <xsl:param name="indentation" select="0"/> + + <xsl:choose> + <xsl:when test="count(ancestor::namespace)=0"> + <xsl:call-template name="namespace-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text> </xsl:text> + <xsl:call-template name="namespace-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Emit namespace reference --> + <xsl:template match="namespace" mode="reference"> + <xsl:apply-templates select="namespace|free-function-group" + mode="reference"> + <xsl:with-param name="indentation" select="0"/> + </xsl:apply-templates> + <xsl:apply-templates select="class|class-specialization| + struct|struct-specialization| + union|union-specialization|enum|function| + overloaded-function|data-member|typedef" + mode="namespace-reference"/> + </xsl:template> + + <!-- Eat extra documentation when in the synopsis or reference sections --> + <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:param name="wrap" select="false()"/> + <xsl:param name="prefix"/> + <xsl:apply-templates mode="comment"> + <xsl:with-param name="wrap" + select="$wrap and count(text()|*) = 1"/> + <xsl:with-param name="prefix" select="$prefix"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="simpara|para" mode="comment"> + <xsl:param name="wrap" select="false()"/> + <xsl:param name="prefix"/> + <xsl:apply-templates select="text()|*" mode="comment"> + <xsl:with-param name="wrap" + select="$wrap and count(text()|*) = 1"/> + <xsl:with-param name="prefix" select="$prefix"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template match="text()" mode="comment"> + <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"> + <xsl:apply-templates select="." mode="annotation"/> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/relative-href.xsl b/src/boost/tools/boostbook/xsl/relative-href.xsl new file mode 100644 index 000000000..8218d2f4c --- /dev/null +++ b/src/boost/tools/boostbook/xsl/relative-href.xsl @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<!-- + 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" + version="1.0"> + +<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/lib/lib.xsl"/> + +<!-- ==================================================================== --> + +<!-- Check if path is absolute + + Not attempting to fully parse or validate absolute vs. relative URI. + Assumes an absolute url when $target matches the regex '^[a-zA-Z.+-]*:' + + According to RFC1808, however, the colon (':') may also appear in a relative + URL. To workaround this limitation for relative links containing colons one + may use the alternatives below, instead. + + For the relative URI this:that use ./this:that or this%3Athat, instead. +--> +<xsl:template name="is.absolute.uri"> + <xsl:param name="uri"/> + + <xsl:variable name="scheme1" select="substring-before($uri, ':')"/> + <xsl:variable name="scheme2" select="translate($scheme1, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.', '')"/> + + <xsl:choose> + <xsl:when test="$scheme1 and not($scheme2)">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="href.target.relative"> + <xsl:param name="target"/> + <xsl:param name="context" select="."/> + + <xsl:variable name="isabsoluteuri"> + <xsl:call-template name="is.absolute.uri"> + <xsl:with-param name="uri" select="$target"/> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$isabsoluteuri='1'"> + <xsl:value-of select="$target"/> + </xsl:when> + + <xsl:otherwise> + <xsl:variable name="href.to.uri" select="$target"/> + <xsl:variable name="href.from.uri"> + <xsl:call-template name="href.target.uri"> + <xsl:with-param name="object" select="$context"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="href.to"> + <xsl:call-template name="trim.common.uri.paths"> + <xsl:with-param name="uriA" select="$href.to.uri"/> + <xsl:with-param name="uriB" select="$href.from.uri"/> + <xsl:with-param name="return" select="'A'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="href.from"> + <xsl:call-template name="trim.common.uri.paths"> + <xsl:with-param name="uriA" select="$href.to.uri"/> + <xsl:with-param name="uriB" select="$href.from.uri"/> + <xsl:with-param name="return" select="'B'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="depth"> + <xsl:call-template name="count.uri.path.depth"> + <xsl:with-param name="filename" select="$href.from"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="href"> + <xsl:call-template name="copy-string"> + <xsl:with-param name="string" select="'../'"/> + <xsl:with-param name="count" select="$depth"/> + </xsl:call-template> + <xsl:value-of select="$href.to"/> + </xsl:variable> + + <xsl:value-of select="$href"/> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/source-highlight.xsl b/src/boost/tools/boostbook/xsl/source-highlight.xsl new file mode 100644 index 000000000..7a34b8fbc --- /dev/null +++ b/src/boost/tools/boostbook/xsl/source-highlight.xsl @@ -0,0 +1,578 @@ +<?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" + version="1.0"> + <xsl:param name="boost.syntax.highlight">1</xsl:param> + + <xsl:template name="source-highlight"> + <xsl:param name="text" select="."/> + <xsl:choose> + <xsl:when test="$boost.syntax.highlight='1'"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <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="' alignas ailgnof asm auto bool break case catch char char16_t char32_t class const const_cast constexpr continue decltype default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new noexcept nullptr operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this thread_local 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> + <xsl:when test="$boost.syntax.highlight='1'"> + <phrase role="string"> + <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-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> + </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> + <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> + <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="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-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-impl-root"> + <xsl:with-param name="text" select="$text"/> + </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:choose> + <xsl:when test="contains($text, '
')"> + <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:otherwise> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="substring($text, 1, 2) = '/*'"> + <xsl:variable name="after-start" select="substring($text, 3)" /> + <xsl:choose> + <xsl:when test="contains($after-start, '*/')"> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text" select="concat('/*', substring-before($after-start, '*/'), '*/')"/> + </xsl:call-template> + <xsl:call-template name="highlight-text-impl-root"> + <xsl:with-param name="text" select="substring-after($after-start, '*/')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </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> + + <!-- Jam syntax highlighting --> + + <xsl:variable name="jam-keywords" select="' actions bind case class default else for if ignore in include local module on piecemeal quietly return rule switch together updated while '"/> + <xsl:variable name="jam-operators" select="' ! != & && ( ) += : ; < <= = > >= ?= [ ] { | || } '"/> + + <xsl:template name="highlight-jam-word"> + <xsl:param name="text"/> + <xsl:choose> + <xsl:when test="contains($jam-keywords, concat(' ', $text, ' '))"> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="$text"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="contains($jam-operators, concat(' ', $text, ' '))"> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="jam-word-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(' 

	', substring($text, $pos, 1))"> + <xsl:value-of select="$pos - 1"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="jam-word-length"> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="pos" select="$pos + 1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="highlight-jam-text"> + <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-jam-text"> + <xsl:with-param name="text" select="substring($text, 2)"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="substring($text, 1, 1) = '#'"> + <xsl:choose> + <xsl:when test="contains($text, '
')"> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text" select="substring-before($text, '
')"/> + </xsl:call-template> + <xsl:call-template name="highlight-jam-text"> + <xsl:with-param name="text" select="concat('
', substring-after($text, '
'))"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="length"> + <xsl:call-template name="jam-word-length"> + <xsl:with-param name="text" select="$text"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="highlight-jam-word"> + <xsl:with-param name="text" select="substring($text, 1, $length)"/> + </xsl:call-template> + <xsl:call-template name="highlight-jam-text"> + <xsl:with-param name="text" select="substring($text, $length + 1)"/> + </xsl:call-template> + </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(.)}"> + <xsl:for-each select="./@*"> + <xsl:choose> + <xsl:when test="local-name(.)='last-revision'"> + <xsl:attribute + name="rev:last-revision" + namespace="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" +> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + <xsl:apply-templates mode="highlight"/> + </xsl:element> + </xsl:template> + + <xsl:template match="text()" mode="highlight"> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="classname|methodname|functionname|libraryname|enumname| + 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:template match="*" mode="highlight-jam"> + <xsl:apply-templates select="." mode="annotation"/> + </xsl:template> + + <xsl:template match="text()" mode="highlight-jam"> + <xsl:call-template name="highlight-jam-text"> + <xsl:with-param name="text" select="."/> + </xsl:call-template> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/template.xsl b/src/boost/tools/boostbook/xsl/template.xsl new file mode 100644 index 000000000..2e7d60993 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/template.xsl @@ -0,0 +1,601 @@ +<?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" + version="1.0"> + + <xsl:param name="template.param.brief" select="false()"/> + + <!-- Determine the length of a template header synopsis --> + <xsl:template name="template.synopsis.length"> + <xsl:variable name="text"> + <xsl:apply-templates select="template" mode="synopsis"> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="wrap" select="false()"/> + <xsl:with-param name="highlight" select="false()"/> + </xsl:apply-templates> + </xsl:variable> + <xsl:value-of select="string-length($text)"/> + </xsl:template> + + <!-- Determine the length of a template header reference --> + <xsl:template name="template.reference.length"> + <xsl:choose> + <xsl:when test="not(template)"> + 0 + </xsl:when> + <xsl:when test="template/*/purpose"> + <!-- TBD: The resulting value need only be greater than the number of + columns. We chose to add 17 because it's funny for C++ + programmers. :) --> + <xsl:value-of select="$max-columns + 17"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="template.synopsis.length"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Output a template header in synopsis mode --> + <xsl:template match="template" mode="synopsis"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="wrap" select="true()"/> + <xsl:param name="highlight" select="true()"/> + + <xsl:call-template name="template.synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="wrap" select="$wrap"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + </xsl:template> + + <!-- Output a template header in reference mode --> + <xsl:template match="template" mode="reference"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="highlight" select="true()"/> + <xsl:call-template name="template.reference"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + </xsl:template> + + <!-- Emit a template header synopsis --> + <xsl:template name="template.synopsis"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="wrap" select="true()"/> + <xsl:param name="highlight" select="true()"/> + + <xsl:choose> + <xsl:when test="$highlight"> + <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: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: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) --> + <xsl:template name="template.synopsis.parameters"> + <xsl:param name="indentation"/> + <xsl:param name="wrap" select="true()"/> + <xsl:param name="highlight" select="true()"/> + + <xsl:param name="column" select="$indentation"/> + <xsl:param name="prefix" select="''"/> + <xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/> + <xsl:param name="first-on-line" select="true()"/> + + <xsl:if test="$parameters"> + <!-- Emit the prefix (either a comma-space, or empty if this is + the first parameter) --> + <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]"/> + <xsl:variable name="rest" select="$parameters[position()!=1]"/> + + <!-- Compute the actual text of this parameter --> + <xsl:variable name="text"> + <xsl:call-template name="template.parameter"> + <xsl:with-param name="parameter" select="$parameter"/> + <xsl:with-param name="is-last" select="not(rest)"/> + <xsl:with-param name="highlight" select="false()"/> + </xsl:call-template> + </xsl:variable> + + <!-- Where will this template parameter finish? --> + <xsl:variable name="end-column" + select="$column + string-length($prefix) + string-length($text)"/> + + <!-- Should the text go on this line or on the next? --> + <xsl:choose> + <xsl:when test="$first-on-line or ($end-column < $max-columns) or + not($wrap)"> + <!-- Print on this line --> + <xsl:call-template name="template.parameter"> + <xsl:with-param name="parameter" select="$parameter"/> + <xsl:with-param name="is-last" select="not($rest)"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + + <!-- Recurse --> + <xsl:call-template name="template.synopsis.parameters"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="wrap" select="$wrap"/> + <xsl:with-param name="highlight" select="$highlight"/> + <xsl:with-param name="column" select="$end-column"/> + <xsl:with-param name="prefix" select="', '"/> + <xsl:with-param name="parameters" select="$rest"/> + <xsl:with-param name="first-on-line" select="false()"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- Print on next line --> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="template.parameter"> + <xsl:with-param name="parameter" select="$parameter"/> + <xsl:with-param name="is-last" select="not($rest)"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + + <xsl:call-template name="template.synopsis.parameters"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="wrap" select="$wrap"/> + <xsl:with-param name="highlight" select="$highlight"/> + <xsl:with-param name="column" + select="$indentation + string-length($text)"/> + <xsl:with-param name="prefix" select="', '"/> + <xsl:with-param name="parameters" select="$rest"/> + <xsl:with-param name="first-on-line" select="false()"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + + <!-- Emit a template header reference --> + <xsl:template name="template.reference"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="highlight" select="true()"/> + + <xsl:if test="template-type-parameter|template-varargs|template-nontype-parameter"> + <xsl:choose> + <xsl:when test="$highlight"> + <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: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: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> + + <!-- Display a set of template parameters for a reference --> + <xsl:template name="template.reference.parameters"> + <xsl:param name="indentation"/> + <xsl:param name="highlight" select="true()"/> + <xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/> + + <xsl:choose> + <xsl:when test="$parameters/purpose and $template.param.brief"> + <xsl:call-template name="template.reference.parameters.comments"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="template.synopsis.parameters"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="wrap" select="true()"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Output template parameters when there are comments with the parameters. + For clarity, we output each template parameter on a separate line. --> + <xsl:template name="template.reference.parameters.comments"> + <xsl:param name="indentation"/> + <xsl:param name="highlight" select="true()"/> + <xsl:param name="parameters" select="template-type-parameter|template-varargs|template-nontype-parameter"/> + + <xsl:if test="$parameters"> + <!-- Get the actual parameter and its attributes --> + <xsl:variable name="parameter" select="$parameters[position()=1]"/> + <xsl:variable name="rest" select="$parameters[position()!=1]"/> + + <!-- Display the parameter --> + <xsl:call-template name="template.parameter"> + <xsl:with-param name="parameter" select="$parameter"/> + <xsl:with-param name="is-last" select="not($rest)"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + + <xsl:if test="$rest"> + <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 --> + <xsl:if test="$parameter/purpose"> + <xsl:variable name="param-text"> + <!-- Display the parameter --> + <xsl:call-template name="template.parameter"> + <xsl:with-param name="parameter" select="$parameter"/> + <xsl:with-param name="is-last" select="not($rest)"/> + <xsl:with-param name="highlight" select="false()"/> + </xsl:call-template> + </xsl:variable> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text> // </xsl:text> + <xsl:apply-templates + select="$parameter/purpose/*|$parameter/purpose/text()" mode="comment"> + <xsl:with-param name="wrap" select="true()"/> + <xsl:with-param name="prefix"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + string-length($param-text)"/> + </xsl:call-template> + <xsl:if test="$rest"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:text> // </xsl:text> + </xsl:with-param> + </xsl:apply-templates> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + + <!-- Indent the next line --> + <xsl:if test="$parameter/purpose or $rest"> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:if> + + <!-- Recurse to print the rest of the parameters --> + <xsl:call-template name="template.reference.parameters.comments"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="highlight" select="$highlight"/> + <xsl:with-param name="parameters" select="$rest"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- Print a template parameter --> + <xsl:template name="template.parameter"> + <xsl:param name="parameter"/> + <xsl:param name="is-last"/> + <xsl:param name="highlight" select="true()"/> + <xsl:apply-templates select="$parameter" + mode="print.parameter"> + <xsl:with-param name="parameter" select="$parameter"/> + <xsl:with-param name="is-last" select="$is-last"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template name="template.parameter.name"> + <xsl:param name="name" select="@name"/> + <xsl:param name="highlight" select="true()"/> + + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="concept.link"> + <xsl:with-param name="name" + select="translate($name, '0123456789', '')"/> + <xsl:with-param name="text" select="$name"/> + <xsl:with-param name="warn" select="false"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$name"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="template-type-parameter" mode="print.parameter"> + <xsl:param name="parameter"/> + <xsl:param name="is-last"/> + <xsl:param name="highlight"/> + + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="'typename'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>typename</xsl:text> + </xsl:otherwise> + </xsl:choose> + <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"> + <xsl:with-param name="name" select="$parameter/@name"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + + <xsl:variable name="def"> + <xsl:choose> + <xsl:when test="$parameter/@default"> + <xsl:message> + <xsl:text>Warning: 'default' attribute of template parameter element is deprecated. Use 'default' element.</xsl:text> + <xsl:call-template name="print.warning.context"/> + </xsl:message> + <xsl:choose> + <xsl:when test="$highlight and false()"> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text"> + <xsl:value-of select="$parameter/@default"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$parameter/@default"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$parameter/default"> + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:apply-templates + select="$parameter/default/*|$parameter/default/text()" + mode="highlight"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string($parameter/default)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:if test="not($def='')"> + <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"/> + + <!-- If this is the last parameter, add an extra space to + avoid printing >> --> + <xsl:if + test="$is-last and (substring($def, string-length($def))='>')"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template match="template-nontype-parameter" mode="print.parameter"> + <xsl:param name="parameter"/> + <xsl:param name="is-last"/> + <xsl:param name="highlight"/> + + <xsl:choose> + <xsl:when test="$highlight"> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text"> + <xsl:apply-templates + select="$parameter/type/*|$parameter/type/text()"/> + </xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$parameter/type/*|$parameter/type/text()"/> + </xsl:otherwise> + </xsl:choose> + <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"> + <xsl:with-param name="name" select="$parameter/@name"/> + <xsl:with-param name="highlight" select="$highlight"/> + </xsl:call-template> + + <xsl:variable name="def"> + <xsl:value-of select="string($parameter/default)"/> + </xsl:variable> + + <xsl:if test="not($def='')"> + <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"> + <xsl:apply-templates select="$parameter/default/*|$parameter/default/text()" mode="highlight"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$def"/> + </xsl:otherwise> + </xsl:choose> + + <!-- If this is the last parameter, add an extra space to + avoid printing >> --> + <xsl:if + test="$is-last and (substring($def, string-length($def))='>')"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:if> + </xsl:template> + + <xsl:template match="template-varargs" mode="print.parameter"> + <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: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: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: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: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> + diff --git a/src/boost/tools/boostbook/xsl/testing/Jamfile.xsl b/src/boost/tools/boostbook/xsl/testing/Jamfile.xsl new file mode 100644 index 000000000..f8648e42f --- /dev/null +++ b/src/boost/tools/boostbook/xsl/testing/Jamfile.xsl @@ -0,0 +1,243 @@ +<?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" + version="1.0"> + <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/html/chunker.xsl"/> + <xsl:include href="http://docbook.sourceforge.net/release/xsl/current/common/common.xsl"/> + + <!-- The root of the Boost directory --> + <xsl:param name="boost.root"/> + + <!-- The number of columns in a source file line --> + <xsl:param name="boost.source.columns" select="78"/> + + <xsl:output method="text"/> + <xsl:template match="/"> + <xsl:if test="$boost.root"> + <!-- Output testsuite Jamfiles --> + <xsl:apply-templates select="//testsuite" mode="Jamfile"/> + + <!-- Output any source files that are written in XML --> + <xsl:apply-templates select="//source" mode="testsuite.generate"/> + </xsl:if> + + <xsl:if test="not($boost.root)"> + <xsl:message> + Please set the XSL stylesheet parameter "boost.root" to the top-level + Boost directory (i.e., BOOST_ROOT) + </xsl:message> + </xsl:if> + </xsl:template> + + <xsl:template match="testsuite" mode="Jamfile"> + <xsl:variable name="subproject" + select="concat('libs/',ancestor::library/attribute::dirname,'/test')"/> + <xsl:variable name="filename" + select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname, + '/test/Jamfile')"/> + <xsl:call-template name="write.text.chunk"> + <xsl:with-param name="filename" select="$filename"/> + <xsl:with-param name="content"> + <xsl:call-template name="source.print.header"> + <xsl:with-param name="prefix" select="'#'"/> + </xsl:call-template> + +# Testing Jamfile autogenerated from XML source +subproject <xsl:value-of select="$subproject"/> ; + +# bring in rules for testing +SEARCH on testing.jam = $(BOOST_BUILD_PATH) ; +include testing.jam ; + +# Make tests run by default. +DEPENDS all : test ; + +{ + # look in BOOST_ROOT for sources first, just in this Jamfile + local SEARCH_SOURCE = $(BOOST_ROOT) $(SEARCH_SOURCE) ; + + test-suite <xsl:value-of select="ancestor::library/attribute::dirname"/> + : <xsl:apply-templates mode="Jamfile"/> ; +} + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="compile-test|link-test|run-test|compile-fail-test|link-fail-test|run-fail-test" + mode="Jamfile"> + <xsl:variable name="fullname" + select="concat(substring-before(local-name(.), '-test'), ' libs/', + ancestor::library/attribute::dirname, '/test/', + @filename)"/> + <xsl:text>[ </xsl:text> + <xsl:value-of select="$fullname"/> + <xsl:apply-templates select="lib" mode="Jamfile"/> + <xsl:text> : </xsl:text> + <!-- ... --> + <xsl:text> : </xsl:text> + <!-- ... --> + <xsl:text> : </xsl:text> + <xsl:apply-templates select="requirement" mode="Jamfile"/> + <!-- ... --> + <xsl:text> : </xsl:text> + <xsl:if test="@name"> + <xsl:value-of select="@name"/> + </xsl:if> + <xsl:text> ]</xsl:text> + </xsl:template> + + <xsl:template match="lib" mode="Jamfile"> + <xsl:text> <lib></xsl:text><xsl:value-of select="text()"/> + </xsl:template> + + <xsl:template match="requirement" mode="Jamfile"> + <xsl:if test="count(preceding-sibling::requirement) > 0"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:value-of select="concat('<', @name, '>')"/> + <xsl:value-of select="."/> + </xsl:template> + + <xsl:template match="source" mode="testsuite.generate"> + <xsl:variable name="filename" + select="concat($boost.root,'/libs/',ancestor::library/attribute::dirname, + '/test/',../@filename)"/> + + <xsl:variable name="prefix" select="'//'"/> + + <xsl:call-template name="write.text.chunk"> + <xsl:with-param name="filename" select="$filename"/> + <xsl:with-param name="content"> + <xsl:call-template name="source.print.header"> + <xsl:with-param name="prefix" select="'//'"/> + </xsl:call-template> + <!-- Source code --> + <xsl:apply-templates mode="testsuite.generate"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="snippet" mode="testsuite.generate"> + <xsl:variable name="snippet-name" select="@name"/> + <xsl:value-of select="//programlisting[@name=$snippet-name]"/> + </xsl:template> + + <!-- Prints a header to a source file containing the library name, + copyright information, license information, and a link to the Boost + web site. The text is output using the "prefix" parameter at the + beginning of each line (it should denote a single-line comment) and + will only print up to boost.source.columns characters per line + (including the prefix). --> + <xsl:template name="source.print.header"> + <xsl:param name="prefix"/> + + <!-- Library name --> + <xsl:value-of select="concat($prefix, ' ', + ancestor::library/attribute::name, + ' library')"/> + <xsl:text> </xsl:text> + + <!-- Copyrights --> + <xsl:apply-templates select="ancestor::library/libraryinfo/copyright" + mode="testsuite.generate"> + <xsl:with-param name="prefix" select="$prefix"/> + </xsl:apply-templates> + + <!-- Legal notice --> + <xsl:apply-templates select="ancestor::library/libraryinfo/legalnotice" + mode="testsuite.generate"> + <xsl:with-param name="prefix" select="$prefix"/> + </xsl:apply-templates> + + <xsl:text> </xsl:text> + + <!-- For more information... --> + <xsl:value-of + select="concat($prefix, + ' For more information, see http://www.boost.org/')"/> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template match="copyright" mode="testsuite.generate"> + <xsl:param name="prefix"/> + + <xsl:text> </xsl:text> + + <xsl:value-of select="concat($prefix, ' Copyright (C) ')"/> + <xsl:call-template name="copyright.years"> + <xsl:with-param name="years" select="year"/> + <xsl:with-param name="print.ranges" select="1"/> + <xsl:with-param name="single.year.ranges" select="1"/> + </xsl:call-template> + + <xsl:text> </xsl:text> + + <xsl:apply-templates select="holder" mode="titlepage.mode"/> + </xsl:template> + + <xsl:template match="legalnotice" mode="testsuite.generate"> + <xsl:param name="prefix"/> + + <xsl:variable name="text" select="normalize-space(.)"/> + + <xsl:text> </xsl:text> + <xsl:value-of select="concat($prefix, ' ')"/> + + <xsl:call-template name="source.print.legalnotice"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="column" select="string-length($prefix) + 1"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="source.print.legalnotice"> + <xsl:param name="prefix"/> + <xsl:param name="text"/> + <xsl:param name="column"/> + + <xsl:if test="contains($text, ' ') or string-length($text) > 0"> + <xsl:variable name="word"> + <xsl:choose> + <xsl:when test="contains($text, ' ')"> + <xsl:value-of select="substring-before($text, ' ')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$text"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="rest" select="substring-after($text, ' ')"/> + + <xsl:choose> + <xsl:when + test="$column + string-length($word) > $boost.source.columns"> + <xsl:text> </xsl:text> + <xsl:value-of select="concat($prefix, ' ')"/> + <xsl:call-template name="source.print.legalnotice"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="text" select="$text"/> + <xsl:with-param name="column" select="string-length($prefix) + 1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat($word, ' ')"/> + <xsl:call-template name="source.print.legalnotice"> + <xsl:with-param name="prefix" select="$prefix"/> + <xsl:with-param name="text" select="$rest"/> + <xsl:with-param name="column" + select="$column + string-length($word) + 1"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:template> + + <xsl:template match="*" mode="testsuite.generate"/> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/testing/testsuite.xsl b/src/boost/tools/boostbook/xsl/testing/testsuite.xsl new file mode 100644 index 000000000..b12eef667 --- /dev/null +++ b/src/boost/tools/boostbook/xsl/testing/testsuite.xsl @@ -0,0 +1,118 @@ +<?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" + version="1.0"> + <xsl:template match="testsuite"> + <section> + <xsl:choose> + <xsl:when test="@id"> + <xsl:attribute name="id"> + <xsl:value-of select="@id"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="../@id"> + <xsl:attribute name="id"> + <xsl:value-of select="concat(../@id, '.tests')"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + + <title>Testsuite</title> + + <xsl:if test="compile-test|link-test|run-test"> + <section> + <xsl:if test="@id"> + <xsl:attribute name="id"> + <xsl:value-of select="@id"/> + <xsl:text>.acceptance</xsl:text> + </xsl:attribute> + </xsl:if> + + <title>Acceptance tests</title> + <informaltable> + <tgroup cols="3"> + <colspec colnum="2" colwidth="1in"/> + <thead> + <row> + <entry>Test</entry> + <entry>Type</entry> + <entry>Description</entry> + <entry>If failing...</entry> + </row> + </thead> + <tbody> + <xsl:apply-templates select="compile-test|link-test|run-test"/> + </tbody> + </tgroup> + </informaltable> + </section> + </xsl:if> + + <xsl:if test="compile-fail-test|link-fail-test|run-fail-test"> + <section> + <xsl:if test="@id"> + <xsl:attribute name="id"> + <xsl:value-of select="@id"/> + <xsl:text>.negative</xsl:text> + </xsl:attribute> + </xsl:if> + <title>Negative tests</title> + <informaltable> + <tgroup cols="3"> + <colspec colnum="2" colwidth="1in"/> + <thead> + <row> + <entry>Test</entry> + <entry>Type</entry> + <entry>Description</entry> + <entry>If failing...</entry> + </row> + </thead> + <tbody> + <xsl:apply-templates + select="compile-fail-test|link-fail-test|run-fail-test"/> + </tbody> + </tgroup> + </informaltable> + </section> + </xsl:if> + </section> + </xsl:template> + + <xsl:template match="compile-test|link-test|run-test| + compile-fail-test|link-fail-test|run-fail-test"> + <row> + <entry> + <simpara> + <ulink> + <xsl:attribute name="url"> + <xsl:value-of + select="concat('../../libs/', + ancestor::library/attribute::dirname, '/test/', + @filename)"/> + </xsl:attribute> + <xsl:value-of select="@filename"/> + </ulink> + </simpara> + </entry> + <entry> + <simpara> + <xsl:value-of select="substring-before(local-name(.), '-test')"/> + </simpara> + </entry> + <entry><xsl:apply-templates select="purpose/*"/></entry> + <entry><xsl:apply-templates select="if-fails/*"/></entry> + </row> + </xsl:template> + + <xsl:template match="snippet"> + <xsl:variable name="snippet-name" select="@name"/> + <xsl:apply-templates select="//programlisting[@name=$snippet-name]"/> + </xsl:template> +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/type.xsl b/src/boost/tools/boostbook/xsl/type.xsl new file mode 100644 index 000000000..affb6aaff --- /dev/null +++ b/src/boost/tools/boostbook/xsl/type.xsl @@ -0,0 +1,1693 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com> + Copyright (c) 2007 Frank Mori Hess <fmhess@users.sourceforge.net> + + 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" + version="1.0"> + + <xsl:include href="global.xsl"/> + <xsl:strip-space elements="inherit purpose"/> + + <!-- When true, the stylesheet will emit compact definitions of + enumerations when the enumeration does not have any detailed + description. A compact definition renders the enum definition along + with a comment for the purpose of the enum (if it exists) directly + within the synopsis. A non-compact definition will create a + separate refentry element for the enum. --> + <xsl:param name="boost.compact.enum">1</xsl:param> + + <!-- When true, the stylesheet will emit compact definitions of + typedefs when the typedef does not have any detailed + description. --> + <xsl:param name="boost.compact.typedef">1</xsl:param> + + <xsl:template match="class|struct|union" mode="generate.id"> + <xsl:call-template name="fully-qualified-id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="class-specialization|struct-specialization|union-specialization" mode="generate.id"> + <xsl:call-template name="fully-qualified-id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="typedef" mode="generate.id"> + <xsl:call-template name="fully-qualified-id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="enum" mode="generate.id"> + <xsl:call-template name="fully-qualified-id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="enumvalue" mode="generate.id"> + <xsl:call-template name="fully-qualified-id"> + <xsl:with-param name="node" select="parent::enum"/> + </xsl:call-template> + <xsl:text>.</xsl:text> + <xsl:value-of select="@name"/> + </xsl:template> + + <!-- Display the full name of the current node, e.g., "Class + template function". --> + <xsl:template name="type.display.name"> + <xsl:choose> + <xsl:when test="contains(local-name(.), 'class')"> + <xsl:text>Class </xsl:text> + </xsl:when> + <xsl:when test="contains(local-name(.), 'struct')"> + <xsl:text>Struct </xsl:text> + </xsl:when> + <xsl:when test="contains(local-name(.), 'union')"> + <xsl:text>Union </xsl:text> + </xsl:when> + <xsl:when test="local-name(.)='enum'"> + <xsl:text>Type </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:message> +Unknown type element "<xsl:value-of select="local-name(.)"/>" in type.display.name + </xsl:message> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="template and count(template/*) > 0"> + <xsl:text>template </xsl:text> + </xsl:if> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text"> + <xsl:value-of select="@name"/> + <xsl:apply-templates select="specialization"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <!-- Determine the class key for the given node --> + <xsl:template name="type.class.key"> + <xsl:param name="node" select="."/> + <xsl:choose> + <xsl:when test="contains(local-name($node), '-specialization')"> + <xsl:value-of select="substring-before(local-name($node), '-')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="local-name($node)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Emit class synopsis --> + <xsl:template match="class|class-specialization| + struct|struct-specialization| + union|union-specialization" mode="synopsis"> + <xsl:param name="indentation"/> + + <!-- The keyword used to declare this class type, e.g., class, + struct, or union. --> + <xsl:variable name="class-key"> + <xsl:call-template name="type.class.key"/> + </xsl:variable> + + <!-- Spacing --> + <xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() > 1)"> + <xsl:text> </xsl:text> + </xsl:if> + + <xsl:text> </xsl:text> + + <!-- Calculate how long this declaration would be if we put it all + on one line --> + <xsl:variable name="full-decl-string"> + <xsl:apply-templates select="template" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="wrap" select="false()"/> + </xsl:apply-templates> + <xsl:value-of select="$class-key"/> + <xsl:text> </xsl:text> + <xsl:value-of select="@name"/> + <xsl:apply-templates select="specialization"/> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:variable> + + <xsl:choose> + <xsl:when test="(string-length($full-decl-string) + + string-length($indentation)) < $max-columns"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:apply-templates select="template" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:apply-templates> + + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="$class-key"/> + </xsl:call-template> + <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"> + <xsl:value-of select="@name"/> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="specialization"/> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:when> + + <xsl:otherwise> + <!-- Template header --> + <xsl:if test="template"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:apply-templates select="template" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:apply-templates> + <xsl:text> </xsl:text> + + <!-- Indent class templates' names in the synopsis --> + <xsl:text> </xsl:text> + </xsl:if> + + <!-- Class name --> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="$class-key"/> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text" select="string(@name)"/> + </xsl:call-template> + <xsl:apply-templates select="specialization"/> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + + <!-- Free functions associated with the class --> + <xsl:apply-templates select="free-function-group" mode="header-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="class" select="@name"/> + </xsl:apply-templates> + </xsl:template> + + <!-- Emit a typedef synopsis --> + <xsl:template name="type.typedef.display.aligned"> + <xsl:param name="compact"/> + <xsl:param name="indentation"/> + <xsl:param name="is-reference"/> + <xsl:param name="max-type-length"/> + <xsl:param name="max-name-length"/> + + <!-- What type of link the typedef name should have. This shall + be one of 'anchor' (the typedef output will be the target of + links), 'link' (the typedef output will link to a definition), or + 'none' (the typedef output will not be either a link or a link + target) --> + <xsl:param name="link-type"> + <xsl:choose> + <xsl:when test="$is-reference"> + <xsl:text>anchor</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>link</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:param> + + <!-- The id we should link to or anchor as --> + <xsl:param name="link-to"> + <xsl:call-template name="generate.id"/> + </xsl:param> + + <!-- The id we should link to or anchor as --> + <xsl:param name="typedef-name"> + <xsl:value-of select="@name"/> + </xsl:param> + + <!-- Padding for the typedef types --> + <xsl:variable name="type-padding"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$max-type-length"/> + </xsl:call-template> + </xsl:variable> + + <!-- Padding for the typedef names --> + <xsl:variable name="name-padding"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$max-name-length"/> + </xsl:call-template> + </xsl:variable> + + <xsl:text> </xsl:text> + <xsl:choose> + <!-- Create a vertical ellipsis --> + <xsl:when test="@name = '...'"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + 3"/> + </xsl:call-template> + <xsl:text>. </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + 3"/> + </xsl:call-template> + <xsl:text>. </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + 3"/> + </xsl:call-template> + <xsl:text>.</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="'typedef'"/> + </xsl:call-template> + <xsl:text> </xsl:text> + + <!-- Length of the type --> + <xsl:variable name="type-length"> + <xsl:choose> + <xsl:when test="@type"> + <xsl:message> + <xsl:text>Warning: `type' attribute of `typedef' element is deprecated. Use 'type' element instead.</xsl:text> + </xsl:message> + <xsl:call-template name="print.warning.context"/> + <xsl:value-of select="string-length(@type)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length(type)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Emit the type --> + <xsl:choose> + <xsl:when test="@type"> + <xsl:value-of select="@type"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="type/*|type/text()" + mode="highlight"/> + <!-- + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text"> + <xsl:apply-templates select="type/*|type/text()"/> + </xsl:with-param> + </xsl:call-template> + --> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="$max-type-length > 0"> + <xsl:value-of select="substring($type-padding, 1, + $max-type-length - $type-length)"/> + <xsl:text> </xsl:text> + <xsl:variable name="truncated-typedef-name" select="substring(@name, + 1, $max-name-length)"/> + <xsl:call-template name="link-or-anchor"> + <xsl:with-param name="to" select="$link-to"/> + <xsl:with-param name="text" select="$truncated-typedef-name"/> + <xsl:with-param name="link-type" select="$link-type"/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:call-template> + <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> + <xsl:call-template name="link-or-anchor"> + <xsl:with-param name="to" select="$link-to"/> + <xsl:with-param name="text" select="$typedef-name"/> + <xsl:with-param name="link-type" select="$link-type"/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:call-template> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="$compact and purpose"> + <xsl:text> </xsl:text> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:apply-templates select="purpose" mode="comment"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="typedef" mode="synopsis"> + <xsl:param name="indentation"/> + <xsl:param name="max-type-length" select="0"/> + <xsl:param name="max-name-length" select="0"/> + <xsl:param name="allow-anchor" select="true()"/> + + <!-- True if we should compact this typedef --> + <xsl:variable name="compact" + select="not (para|description) and ($boost.compact.typedef='1')"/> + + <xsl:choose> + <xsl:when test="$compact"> + <!-- Spacing --> + <xsl:if test="not (local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() > 1)"> + <xsl:text> </xsl:text> + </xsl:if> + + <xsl:call-template name="type.typedef.display.aligned"> + <xsl:with-param name="compact" select="$compact"/> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="is-reference" select="$allow-anchor"/> + <xsl:with-param name="max-type-length" select="$max-type-length"/> + <xsl:with-param name="max-name-length" select="$max-name-length"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="type.typedef.display.aligned"> + <xsl:with-param name="compact" select="$compact"/> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="is-reference" select="false()"/> + <xsl:with-param name="max-type-length" select="$max-type-length"/> + <xsl:with-param name="max-name-length" select="$max-name-length"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Emit a typedef reference entry --> + <xsl:template match="typedef" mode="namespace-reference"> + <!-- True if this typedef was compacted --> + <xsl:variable name="compact" + select="not (para|description) and ($boost.compact.typedef='1')"/> + + <xsl:if test="not ($compact)"> + <xsl:call-template name="reference-documentation"> + <xsl:with-param name="refname" select="@name"/> + <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/> + <xsl:with-param name="anchor"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="name"> + <xsl:text>Type definition </xsl:text> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="synopsis"> + <xsl:call-template name="header-link"/> + <xsl:call-template name="type.typedef.display.aligned"> + <xsl:with-param name="compact" select="false()"/> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="link-type" select="'none'"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:apply-templates select="description"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template match="typedef" mode="reference"> + <!-- True if this typedef was compacted --> + <xsl:variable name="compact" + select="not (para|description) and ($boost.compact.typedef='1')"/> + + <xsl:if test="not ($compact)"> + <listitem> + <para> + <xsl:call-template name="type.typedef.display.aligned"> + <xsl:with-param name="compact" select="false()"/> + <xsl:with-param name="indentation" select="0"/> + <xsl:with-param name="is-reference" select="true()"/> + <xsl:with-param name="link-type" select="'anchor'"/> + </xsl:call-template> + </para> + <xsl:apply-templates select="description"/> + </listitem> + </xsl:if> + </xsl:template> + + <!-- Emit a list of static constants --> + <xsl:template match="static-constant" mode="synopsis"> + <xsl:param name="indentation"/> + <xsl:text> </xsl:text> + + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="'static const '"/> + </xsl:call-template> + + <xsl:apply-templates select="type" mode="highlight"/> + + <xsl:if test="not(@name = '')"> + <xsl:text> </xsl:text> + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + </xsl:if> + + <xsl:text> = </xsl:text> + + <xsl:call-template name="source-highlight"> + <xsl:with-param name="text"> + <xsl:apply-templates select="default/*|default/text()"/> + </xsl:with-param> + </xsl:call-template> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + + <xsl:if test="purpose"> + <xsl:text> </xsl:text> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:apply-templates select="purpose" mode="comment"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- Format base classes on a single line --> + <xsl:template name="print.base.classes.single"> + <xsl:apply-templates select="inherit"/> + </xsl:template> + + <xsl:template name="print.base.classes.multi"> + <xsl:param name="indentation"/> + + <xsl:variable name="n" select="count(inherit)"/> + <xsl:for-each select="inherit"> + <!-- Indentation --> + <xsl:if test="position() > 1"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:if> + + <!-- Output the access specifier --> + <xsl:variable name="access"> + <xsl:choose> + <xsl:when test="@access"> + <xsl:value-of select="@access"/> + </xsl:when> + <xsl:when test="parent::class|parent::class-specialization"> + <xsl:text>private</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>public</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="@access"/> + </xsl:call-template> + <xsl:text> </xsl:text> + + <!-- Output the type --> + <xsl:choose> + <xsl:when test="type"> + <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> + <xsl:text>Warning: missing 'type' element inside 'inherit'</xsl:text> + </xsl:message> + <xsl:call-template name="print.warning.context"/> + <xsl:apply-templates mode="annotation"/> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="@pack=1"><xsl:text>...</xsl:text></xsl:if> + + <!-- Output a comma if not at the end --> + <xsl:if test="position() < $n"> + <xsl:text>,</xsl:text> + </xsl:if> + + <!-- Output a comment if we have one --> + <xsl:if test="purpose"> + <xsl:choose> + <xsl:when test="position() < $n"> + <xsl:text> </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:apply-templates select="purpose" + mode="comment"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + + <xsl:if test="position() < $n"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:template> + + <xsl:template name="print.base.classes"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="base-indentation" select="0"/> + + <xsl:variable name="single-line-candidate" select="not(inherit/purpose)"/> + <xsl:variable name="single-line"> + <xsl:if test="$single-line-candidate"> + <xsl:call-template name="print.base.classes.single"/> + </xsl:if> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$single-line-candidate and + (string-length($single-line) + $indentation + 3 + < $max-columns)"> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' : '"/> + </xsl:call-template> + <xsl:call-template name="print.base.classes.single"/> + <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: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> + <xsl:call-template name="print.base.classes.single"/> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$base-indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="'{'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <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> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$base-indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'{'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Emit a list of base classes without comments and on a single line --> + <xsl:template match="inherit"> + <xsl:choose> + <xsl:when test="position()=1"> + </xsl:when> + <xsl:otherwise> + <xsl:text>, </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="@access"/> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:apply-templates mode="annotation"> + <xsl:with-param name="highlight" select="true()"/> + </xsl:apply-templates> + <xsl:if test="@pack=1"><xsl:text>...</xsl:text></xsl:if> + </xsl:template> + + <!-- Find the maximum length of the types in typedefs --> + <xsl:template name="find-max-type-length"> + <xsl:param name="typedefs" select="typedef"/> + <xsl:param name="max-length" select="0"/> + <xsl:param name="want-name" select="false()"/> + + <xsl:choose> + <xsl:when test="$typedefs"> + <xsl:variable name="typedef" select="$typedefs[position()=1]"/> + <xsl:variable name="rest" select="$typedefs[position()!=1]"/> + + <!-- Find the length of the type --> + <xsl:variable name="length"> + <xsl:choose> + <xsl:when test="$typedef/@name != '...'"> + <xsl:choose> + <xsl:when test="$want-name"> + <xsl:value-of select="string-length($typedef/@name) + 1"/> + </xsl:when> + <xsl:when test="$typedef/@type"> + <xsl:value-of select="string-length($typedef/@type)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="string-length($typedef/type)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + 0 + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Pass on the larger length --> + <xsl:choose> + <xsl:when test="$length > $max-length"> + <xsl:call-template name="find-max-type-length"> + <xsl:with-param name="typedefs" select="$rest"/> + <xsl:with-param name="max-length" select="$length"/> + <xsl:with-param name="want-name" select="$want-name"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="find-max-type-length"> + <xsl:with-param name="typedefs" select="$rest"/> + <xsl:with-param name="max-length" select="$max-length"/> + <xsl:with-param name="want-name" select="$want-name"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$max-length"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="constructor" mode="synopsis"> + <xsl:param name="indentation"/> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="context" select="../@name"/> + <xsl:with-param name="is-reference" select="false()"/> + <xsl:with-param name="constructor-for"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="copy-assignment" mode="synopsis"> + <xsl:param name="indentation"/> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="context" select="../@name"/> + <xsl:with-param name="is-reference" select="false()"/> + <xsl:with-param name="copy-assign-for"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="destructor" mode="synopsis"> + <xsl:param name="indentation"/> + <xsl:call-template name="function"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="context" select="../@name"/> + <xsl:with-param name="is-reference" select="false()"/> + <xsl:with-param name="destructor-for"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template name="class-members-synopsis"> + <xsl:param name="indentation" select="0"/> + <!-- Used to suppress anchors in nested synopsis, so we don't get multiple anchors --> + <xsl:param name="allow-synopsis-anchors" select="false()"/> + + <!-- Typedefs --> + <xsl:if test="typedef"> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:call-template> + <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"/> + </xsl:variable> + <xsl:variable name="max-name-length"> + <xsl:call-template name="find-max-type-length"> + <xsl:with-param name="want-name" select="true()"/> + </xsl:call-template> + </xsl:variable> + <xsl:apply-templates select="typedef" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + <xsl:with-param name="max-type-length" + select="$max-type-length"/> + <xsl:with-param name="max-name-length" + select="$max-name-length"/> + <xsl:with-param name="allow-anchor" select="$allow-synopsis-anchors"/> + </xsl:apply-templates> + </xsl:if> + + <!-- Static constants --> + <xsl:if test="static-constant"> + <xsl:text> </xsl:text> + <xsl:if test="typedef"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:call-template> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text" select="'// static constants'"/> + </xsl:call-template> + <xsl:apply-templates select="static-constant" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + </xsl:if> + + <!-- Nested classes/structs/unions --> + <xsl:if test="class|class-specialization|struct|struct-specialization|union|union-specialization"> + <xsl:text> </xsl:text> + <xsl:if test="typedef|static-constant"> + <xsl:text> </xsl:text> + </xsl:if> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:call-template> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text" select="'// member classes/structs/unions'"/> + </xsl:call-template> + <xsl:apply-templates select="class|class-specialization| + struct|struct-specialization| + union|union-specialization" + mode="reference"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + </xsl:if> + + <!-- Enums --> + <xsl:apply-templates select="enum" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + + <!-- Construct/Copy/Destruct --> + <xsl:call-template name="construct-copy-destruct-synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:call-template> + + <!-- Member functions --> + <xsl:apply-templates + select="method-group|method|overloaded-method" + mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + + <!-- Data members --> + <xsl:if test="data-member"> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:call-template> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:choose> + <xsl:when test="data-member/description"> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + <xsl:text>public-data-members</xsl:text> + </xsl:with-param> + <xsl:with-param name="text" select="'public data members'"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:text>public data members</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + <xsl:apply-templates select="data-member" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation + 2"/> + </xsl:apply-templates> + </xsl:if> + </xsl:template> + + <xsl:template name="print-access-specification"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="specification" select="'public'"/> + + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="$specification"/> + </xsl:call-template> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="':'"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="access" mode="synopsis"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="allow-synopsis-anchors" select="false()"/> + + <xsl:call-template name="print-access-specification"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="specification" select="@name"/> + </xsl:call-template> + <xsl:call-template name="class-members-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="class-type-synopsis"> + <xsl:param name="indentation" select="0"/> + <xsl:param name="allow-synopsis-anchors" select="false()"/> + + <!-- The keyword used to declare this class type, e.g., class, + struct, or union. --> + <xsl:variable name="class-key"> + <xsl:call-template name="type.class.key"/> + </xsl:variable> + + <xsl:if test="ancestor::class|ancestor::class-specialization| + ancestor::struct|ancestor::struct-specialization| + ancestor::union|ancestor::union-specialization"> + <xsl:text> </xsl:text> + + <!-- If this nested class has a "purpose" element, use it as a + comment. --> + <xsl:if test="purpose"> + <xsl:text> </xsl:text> + <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: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> + + <!-- Template header --> + <xsl:if test="template"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:apply-templates select="template" mode="reference"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:apply-templates> + </xsl:if> + <xsl:text> </xsl:text> + + <!-- Class name --> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="$class-key"/> + </xsl:call-template> + <xsl:text> </xsl:text> + + <!-- Make the class name a link to the class reference page (useful for nested classes) --> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:value-of select="@name"/> + </xsl:with-param> + </xsl:call-template> + + <xsl:apply-templates select="specialization"/> + + <xsl:choose> + <xsl:when test="inherit"> + <!-- Base class list (with opening brace) --> + <xsl:call-template name="print.base.classes"> + <xsl:with-param name="indentation" + select="string-length($class-key) + string-length(@name) + + $indentation + 1"/> + <xsl:with-param name="base-indentation" select="$indentation"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <!-- Opening brace --> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="' {'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + + <!-- Default public designator for members not inside explicit <access> elements --> + <xsl:if test="contains(local-name(.), 'class')"> + <xsl:if test="count(static-constant|typedef|enum| + copy-assignment|constructor|destructor|method-group| + method|overloaded-method|data-member| + class|class-specialization| + struct|struct-specialization| + union|union-specialization) > 0"> + <xsl:call-template name="print-access-specification"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:if> + </xsl:if> + + <xsl:call-template name="class-members-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/> + </xsl:call-template> + + <xsl:apply-templates select="access" mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="allow-synopsis-anchors" select="$allow-synopsis-anchors"/> + </xsl:apply-templates> + + <!-- Closing brace --> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="'};'"/> + </xsl:call-template> + </xsl:template> + + <!-- Emit nested class reference documentation --> + <xsl:template match="class|class-specialization| + struct|struct-specialization| + union|union-specialization" mode="reference"> + <xsl:param name="indentation"/> + + <xsl:call-template name="class-type-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:template> + + <!-- Document template parameters --> + <xsl:template name="class-templates-reference"> + <xsl:if test="(template/template-type-parameter/purpose| + template/template-nontype-parameter/purpose) + and not($template.param.brief)"> + <refsect2> + <title>Template Parameters</title> + <orderedlist> + <xsl:for-each select="template/template-type-parameter| + template/template-nontype-parameter"> + <listitem> + <para> + <xsl:variable name="link-to"> + <xsl:call-template name="generate.id"/> + </xsl:variable> + + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:call-template name="template.parameter"> + <xsl:with-param name="parameter" select="."/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:if test="purpose"> + <para> + <xsl:apply-templates select="purpose/*"/> + </para> + </xsl:if> + </listitem> + </xsl:for-each> + </orderedlist> + </refsect2> + </xsl:if> + </xsl:template> + + <xsl:template name="member-typedefs-reference"> + <!-- 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:if test="$have-typedef-references"> + <xsl:call-template name="member-documentation"> + <xsl:with-param name="name"> + <xsl:call-template name="anchor"> + <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="''"/> + </xsl:call-template> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:call-template name="access-name"/> + <xsl:text> types</xsl:text> + </xsl:with-param> + <xsl:with-param name="text"> + <orderedlist> + <xsl:apply-templates select="typedef" mode="reference"/> + </orderedlist> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="data-member-reference"> + <xsl:if test="data-member/description"> + <xsl:call-template name="member-documentation"> + <xsl:with-param name="name"> + <xsl:call-template name="anchor"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + <xsl:text>public-data-members</xsl:text> + </xsl:with-param> + <xsl:with-param name="text" select="''"/> + </xsl:call-template> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text"> + <xsl:call-template name="object-name"/> + </xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:call-template name="access-name"/> + <xsl:text> public data members</xsl:text> + </xsl:with-param> + <xsl:with-param name="text"> + <orderedlist> + <xsl:apply-templates select="data-member" mode="reference"/> + </orderedlist> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <xsl:template name="class-members-reference"> + + <xsl:call-template name="member-typedefs-reference"/> + + <xsl:call-template name="construct-copy-destruct-reference"/> + + <xsl:apply-templates + select="method-group|method|overloaded-method" + mode="reference"/> + + <xsl:call-template name="data-member-reference"/> + + <!-- Emit reference docs for nested classes --> + <xsl:apply-templates + select="class|class-specialization| + struct|struct-specialization| + union|union-specialization" + mode="namespace-reference"/> + + <!-- Emit reference docs for nested enums --> + <xsl:apply-templates + select="enum" + mode="namespace-reference"/> + </xsl:template> + + <xsl:template match="access" mode="namespace-reference"> + <xsl:call-template name="class-members-reference"/> + </xsl:template> + + <!-- Emit namespace-level class reference documentation --> + <xsl:template match="class|class-specialization| + struct|struct-specialization| + union|union-specialization" mode="namespace-reference"> + <xsl:param name="indentation" select="0"/> + + <xsl:call-template name="separator"/> + <xsl:call-template name="reference-documentation"> + <xsl:with-param name="refname"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/> + <xsl:with-param name="anchor"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="name"> + <xsl:call-template name="type.display.name"/> + </xsl:with-param> + <xsl:with-param name="synopsis"> + <xsl:call-template name="header-link"/> + <xsl:call-template name="class-type-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="allow-synopsis-anchors" select="true()"/> + </xsl:call-template> + <!-- Associated free functions --> + <xsl:apply-templates select="free-function-group" + mode="synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="class" select="@name"/> + </xsl:apply-templates> + </xsl:with-param> + <xsl:with-param name="text"> + <!-- Paragraphs go into the top of the "Description" section. --> + <xsl:if test="para"> + <xsl:message> + <xsl:text>Warning: Use of 'para' elements in 'class' element is deprecated. Wrap them in a 'description' element.</xsl:text> + </xsl:message> + <xsl:call-template name="print.warning.context"/> + <xsl:apply-templates select="para" mode="annotation"/> + </xsl:if> + <xsl:apply-templates select="description"/> + <xsl:call-template name="class-templates-reference"/> + <xsl:call-template name="class-members-reference"/> + <xsl:apply-templates select="access" mode="namespace-reference"/> + + <xsl:apply-templates select="free-function-group" mode="reference"> + <xsl:with-param name="class" select="@name"/> + </xsl:apply-templates> + + <!-- Specializations of this class --> + <!-- TBD: fix this. We should key off the class name and match + fully-qualified names --> + <xsl:variable name="name" select="@name"/> + <xsl:if test="local-name(.)='class' and + ../class-specialization[@name=$name]"> + <refsect2> + <title>Specializations</title> + <itemizedlist> + <xsl:apply-templates + select="../class-specialization[@name=$name]" + mode="specialization-list"/> + </itemizedlist> + </refsect2> + </xsl:if> + </xsl:with-param> + </xsl:call-template> + </xsl:template> + + <!-- Output a link to a specialization --> + <xsl:template match="class-specialization| + struct-specialization| + union-specialization" mode="specialization-list"> + <listitem> + <para> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text"> + <xsl:call-template name="type.display.name"/> + </xsl:with-param> + </xsl:call-template> + </para> + </listitem> + </xsl:template> + + <!-- Data member synopsis --> + <xsl:template match="data-member" mode="synopsis"> + <xsl:param name="indentation"/> + + <xsl:choose> + <xsl:when test="ancestor::class|ancestor::class-specialization| + ancestor::struct|ancestor::struct-specialization| + ancestor::union|ancestor::union-specialization"> + + <!-- Spacing --> + <xsl:if + test="not(local-name(preceding-sibling::*[position()=1])=local-name(.)) and (position() > 1)"> + <xsl:text> </xsl:text> + </xsl:if> + + <!-- Indent --> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + + <xsl:if test="@specifiers"> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="@specifiers"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + + <xsl:apply-templates select="type" mode="highlight"/> + <xsl:text> </xsl:text> + <xsl:choose> + <xsl:when test="description"> + <xsl:variable name="link-to"> + <xsl:call-template name="generate.id"/> + </xsl:variable> + <xsl:call-template name="link-or-anchor"> + <xsl:with-param name="to" select="$link-to"/> + <xsl:with-param name="text" select="@name"/> + <xsl:with-param name="link-type" select="'link'"/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="highlight-identifier"> + <xsl:with-param name="identifier" select="@name"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="global-synopsis"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + + <!-- If there is a <purpose>, then add it as an + inline comment immediately following the data + member definition in the synopsis --> + <xsl:if test="purpose"> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:apply-templates select="purpose/*|purpose/text()" + mode="purpose"/> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- Data member reference --> + <xsl:template match="data-member" mode="reference"> + <xsl:choose> + <xsl:when test="ancestor::class|ancestor::class-specialization| + ancestor::struct|ancestor::struct-specialization| + ancestor::union|ancestor::union-specialization"> + <xsl:if test="description"> + <listitem> + <para> + <xsl:variable name="link-to"> + <xsl:call-template name="generate.id"/> + </xsl:variable> + + <xsl:call-template name="preformatted"> + <xsl:with-param name="text"> + <xsl:if test="@specifiers"> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="@specifiers"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:if> + + <xsl:apply-templates select="type" mode="highlight"/> + <xsl:text> </xsl:text> + <xsl:call-template name="link-or-anchor"> + <xsl:with-param name="to" select="$link-to"/> + <xsl:with-param name="text" select="@name"/> + <xsl:with-param name="link-type" select="'anchor'"/> + <xsl:with-param name="highlight" select="true()"/> + </xsl:call-template> + <xsl:call-template name="highlight-special"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:with-param> + </xsl:call-template> + </para> + <xsl:apply-templates select="description"/> + </listitem> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="global-reference"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Enumeration synopsis --> + <xsl:template match="enum" mode="synopsis"> + <xsl:param name="indentation"/> + + <!-- Spacing --> + <xsl:if + test="(not (local-name(preceding-sibling::*[position()=1])=local-name(.)) + and (position() > 1)) or + not (para or description or not ($boost.compact.enum=1))"> + <xsl:text> </xsl:text> + </xsl:if> + + <!-- Indent --> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + + <xsl:choose> + <!-- When there is a detailed description, we only put the + declaration in the synopsis and will put detailed documentation + in either a <refentry/> or in class documentation. --> + <xsl:when test="para or description or not ($boost.compact.enum=1)"> + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="'enum'"/> + </xsl:call-template> + + <xsl:text> </xsl:text> + + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text" select="string(@name)"/> + <xsl:with-param name="higlhight" select="false()"/> + </xsl:call-template> + </xsl:when> + <!-- When there is no detailed description, we put the enum + definition within the synopsis. The purpose of the enum (if + available) is formatted as a comment prior to the + definition. This way, we do not create a separate block of text + for what is generally a very small amount of information. --> + <xsl:otherwise> + <xsl:if test="purpose"> + <xsl:call-template name="highlight-comment"> + <xsl:with-param name="text"> + <xsl:text>// </xsl:text> + <xsl:apply-templates select="purpose" mode="comment"/> + </xsl:with-param> + </xsl:call-template> + + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:if> + + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="'enum'"/> + </xsl:call-template> + + <xsl:text> </xsl:text> + + <xsl:call-template name="anchor"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text" select="@name"/> + <xsl:with-param name="higlhight" select="false()"/> + </xsl:call-template> + + <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:call-template name="highlight-text"> + <xsl:with-param name="text" select="' }'"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="highlight-text"> + <xsl:with-param name="text" select="';'"/> + </xsl:call-template> + </xsl:template> + + <!-- Enumeration reference at namespace level --> + <xsl:template match="enum" mode="namespace-reference"> + <xsl:if test="para or description or not ($boost.compact.enum=1)"> + <xsl:call-template name="reference-documentation"> + <xsl:with-param name="name"> + <xsl:call-template name="type.display.name"/> + </xsl:with-param> + <xsl:with-param name="refname"> + <xsl:call-template name="fully-qualified-name"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/> + <xsl:with-param name="anchor"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="."/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="synopsis"> + <xsl:call-template name="header-link"/> + <xsl:call-template name="type.enum.display"/> + </xsl:with-param> + + <xsl:with-param name="text"> + <!-- Paragraphs go into the top of the "Description" section. --> + <xsl:if test="para"> + <xsl:message> + <xsl:text>Warning: Use of 'para' elements in 'enum' element is deprecated. Wrap them in a 'description' element.</xsl:text> + </xsl:message> + <xsl:call-template name="print.warning.context"/> + <xsl:apply-templates select="para" mode="annotation"/> + </xsl:if> + <xsl:apply-templates select="description"/> + <xsl:if test="enumvalue/purpose | enumvalue/description"> + <variablelist spacing="compact"> + <xsl:apply-templates select="enumvalue" mode="reference"/> + </variablelist> + </xsl:if> + </xsl:with-param> + + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- Output an enumeration along with its values --> + <xsl:template name="type.enum.display"> + <!-- Spacing --> + <xsl:if test="position() > 1"> + <xsl:text> </xsl:text> + </xsl:if> + + <xsl:text> </xsl:text> + + <xsl:call-template name="highlight-keyword"> + <xsl:with-param name="keyword" select="'enum'"/> + </xsl:call-template> + + <!-- Header --> + <xsl:variable name="header" select="concat(' ', @name, ' { ')"/> + <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: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., + enum Name { value1 = foo, value2 = bar, ... }; + This routine prints only the enumeration values; the caller is + responsible for printing everything outside the braces + (inclusive). --> + <xsl:template name="type.enum.list.compact"> + <xsl:param name="indentation"/> + <xsl:param name="compact" select="false()"/> + + <!-- Internal: The column we are on --> + <xsl:param name="column" select="$indentation"/> + + <!-- Internal: The index of the current enumvalue + we're processing --> + <xsl:param name="pos" select="1"/> + + <!-- Internal: a prefix that we need to print prior to printing + this value. --> + <xsl:param name="prefix" select="''"/> + + <xsl:if test="not($pos > count(enumvalue))"> + <xsl:variable name="value" select="enumvalue[position()=$pos]"/> + + <!-- Compute the string to be printed for this value --> + <xsl:variable name="result"> + <xsl:value-of select="$prefix"/> + <xsl:value-of select="$value/attribute::name"/> + + <xsl:if test="$value/default"> + <xsl:text> = </xsl:text> + <xsl:value-of select="$value/default/*|$value/default/text()"/> + </xsl:if> + </xsl:variable> + + <!-- The column we will end on, assuming that this value fits on + this line --> + <xsl:variable name="end" select="$column + string-length($result)"/> + + <!-- The column we will actually end on --> + <xsl:variable name="end2"> + <xsl:choose> + <!-- If the enumeration value fits on this line, put it there --> + <xsl:when test="$end < $max-columns"> + <xsl:value-of select="$end"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$indentation + + string-length($result) + - string-length($prefix)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:value-of select="$prefix"/> + + <!-- If the enumeration value doesn't fit on this line, + put it on a new line --> + <xsl:if test="not($end < $max-columns)"> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation"/> + </xsl:call-template> + </xsl:if> + + <!-- If the enumeration value has a description, link it + to its description. --> + <xsl:choose> + <xsl:when test="($value/purpose or $value/description) and not($compact)"> + <xsl:call-template name="internal-link"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"> + <xsl:with-param name="node" select="$value"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="text" select="$value/attribute::name"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$value/attribute::name"/> + </xsl:otherwise> + </xsl:choose> + + <!-- If the enumeration value has a default, + print it. --> + <xsl:if test="$value/default"> + <xsl:text> = </xsl:text> + <xsl:apply-templates + select="$value/default/*|$value/default/text()"/> + </xsl:if> + + <!-- Recursively generate the rest of the enumeration list --> + <xsl:call-template name="type.enum.list.compact"> + <xsl:with-param name="indentation" select="$indentation"/> + <xsl:with-param name="compact" select="$compact"/> + <xsl:with-param name="column" select="$end2"/> + <xsl:with-param name="pos" select="$pos + 1"/> + <xsl:with-param name="prefix" select="', '"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- Enumeration reference at namespace level --> + <xsl:template match="enumvalue" mode="reference"> + <xsl:if test="purpose or description"> + <varlistentry> + <term> + <xsl:call-template name="monospaced"> + <xsl:with-param name="text" select="@name"/> + </xsl:call-template> + <!-- Note: the anchor must come after the text here, and not + before it; otherwise, FOP goes into an infinite loop. --> + <xsl:call-template name="anchor"> + <xsl:with-param name="to"> + <xsl:call-template name="generate.id"/> + </xsl:with-param> + <xsl:with-param name="text" select="''"/> + </xsl:call-template> + </term> + <listitem> + <xsl:apply-templates select="purpose|description" mode="comment"/> + </listitem> + </varlistentry> + </xsl:if> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/utility.xsl b/src/boost/tools/boostbook/xsl/utility.xsl new file mode 100644 index 000000000..75ae1cafd --- /dev/null +++ b/src/boost/tools/boostbook/xsl/utility.xsl @@ -0,0 +1,52 @@ +<?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" + version="1.0"> + <!-- Indent the current line--> + <xsl:template name="indent"> + <xsl:param name="indentation"/> + <xsl:if test="$indentation > 0"> + <xsl:text> </xsl:text> + <xsl:call-template name="indent"> + <xsl:with-param name="indentation" select="$indentation - 1"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + + <!-- get name of first ancestor-or-self which is a class, struct or union --> + <xsl:template name="object-name"> + <xsl:variable name="ancestors" select="ancestor-or-self::class | + ancestor-or-self::class-specialization | + ancestor-or-self::struct | + ancestor-or-self::struct-specialization | + ancestor-or-self::union | + ancestor-or-self::union-specialization"/> + <xsl:value-of select="$ancestors[last()]/@name"/> + </xsl:template> + + <!-- get name of access specification that we are inside --> + <xsl:template name="access-name"> + <xsl:variable name="ancestors" select="ancestor-or-self::access | + ancestor-or-self::class | + ancestor-or-self::class-specialization | + ancestor-or-self::struct | + ancestor-or-self::struct-specialization | + ancestor-or-self::union | + ancestor-or-self::union-specialization"/> + <xsl:choose> + <xsl:when test="name($ancestors[last()])='access'"> + <xsl:value-of select="$ancestors[last()]/@name"/> + </xsl:when> + <xsl:otherwise> + public + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/boostbook/xsl/xhtml.xsl b/src/boost/tools/boostbook/xsl/xhtml.xsl new file mode 100644 index 000000000..484bb677d --- /dev/null +++ b/src/boost/tools/boostbook/xsl/xhtml.xsl @@ -0,0 +1,37 @@ +<?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"> + + <!-- Import the HTML chunking stylesheet --> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/> + <xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/xhtml/math.xsl"/> + + <!-- 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> diff --git a/src/boost/tools/boostbook/xsl/xref.xsl b/src/boost/tools/boostbook/xsl/xref.xsl new file mode 100644 index 000000000..c6d85953d --- /dev/null +++ b/src/boost/tools/boostbook/xsl/xref.xsl @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<!-- + 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:suwl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.UnwrapLinks" + exclude-result-prefixes="suwl" + version="1.0"> + +<!-- Import the HTML chunking stylesheet --> +<xsl:import + href="http://docbook.sourceforge.net/release/xsl/current/html/xref.xsl"/> + + +<xsl:template name="adjust-url"> + <xsl:param name="target"/> + <xsl:param name="context" select="."/> + + <xsl:choose> + <xsl:when test="contains($target, ':')"> + <xsl:value-of select="$target"/> + </xsl:when> + <xsl:otherwise> + <xsl:call-template name="href.target.relative"> + <xsl:with-param name="target" select="$target"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + +</xsl:template> + + +<xsl:template match="ulink" name="ulink"> + <xsl:variable name="link"> + <a> + <xsl:if test="@id"> + <xsl:attribute name="name"> + <xsl:value-of select="@id"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="href"> + <xsl:call-template name="adjust-url"> + <xsl:with-param name="target" select="@url"/> + </xsl:call-template> + </xsl:attribute> + <xsl:if test="$ulink.target != ''"> + <xsl:attribute name="target"> + <xsl:value-of select="$ulink.target"/> + </xsl:attribute> + </xsl:if> + <xsl:choose> + <xsl:when test="count(child::node())=0"> + <xsl:value-of select="@url"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </a> + </xsl:variable> + + <xsl:choose> + <xsl:when test="function-available('suwl:unwrapLinks')"> + <xsl:copy-of select="suwl:unwrapLinks($link)"/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$link"/> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + +</xsl:stylesheet> |