diff options
Diffstat (limited to 'src/boost/tools/docca')
21 files changed, 3315 insertions, 0 deletions
diff --git a/src/boost/tools/docca/CHANGELOG.md b/src/boost/tools/docca/CHANGELOG.md new file mode 100644 index 000000000..637b66c87 --- /dev/null +++ b/src/boost/tools/docca/CHANGELOG.md @@ -0,0 +1 @@ +* Version 1 diff --git a/src/boost/tools/docca/LICENSE_1_0.txt b/src/boost/tools/docca/LICENSE_1_0.txt new file mode 100644 index 000000000..36b7cd93c --- /dev/null +++ b/src/boost/tools/docca/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/src/boost/tools/docca/README.md b/src/boost/tools/docca/README.md new file mode 100644 index 000000000..b2002d0f5 --- /dev/null +++ b/src/boost/tools/docca/README.md @@ -0,0 +1,20 @@ +# docca + +Docca is a set of XSLT transformations which converts Doxygen +XML extracted from Javadoc comments in C++ source code, into +Boost.Quickbook output + +These scripts are used by +[Boost.Beast](https://github.com/boostorg/beast/) +to generate the reference. +For example, this +[Javadoc comment](https://github.com/boostorg/beast/blob/b7230f12f16fe7a9f7a1ece5be1f607c8552448a/include/boost/beast/core/buffers_cat.hpp#L68]) +is extracted by Doxygen into an intermediate XML representation, +then processed by the XSLT script via Saxon-HE to produce this +[Boost.Quickbook page](https://www.boost.org/doc/libs/1_71_0/libs/beast/doc/html/beast/ref/boost__beast__buffers_cat.html). + +## License + +Distributed under the Boost Software License, Version 1.0. +(See accompanying file [LICENSE_1_0.txt](LICENSE_1_0.txt) or copy at +https://www.boost.org/LICENSE_1_0.txt) diff --git a/src/boost/tools/docca/example/Jamfile b/src/boost/tools/docca/example/Jamfile new file mode 100644 index 000000000..61d564f07 --- /dev/null +++ b/src/boost/tools/docca/example/Jamfile @@ -0,0 +1,65 @@ +# +# Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot 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) +# + +import os ; + +local broot = [ os.environ BOOST_ROOT ] ; + +project docca/doc ; + +using boostbook ; +using quickbook ; +using doxygen ; + +xml docca_bb : main.qbk ; + +path-constant out : . ; + +install stylesheets + : + $(broot)/doc/src/boostbook.css + : + <location>$(out)/html + ; + +explicit stylesheets ; + +install images + : + [ glob $(broot)/doc/src/images/*.png ] + : + <location>$(out)/html/images + ; + +explicit images ; + +install callouts + : + [ glob $(broot)/doc/src/images/callouts/*.png ] + : + <location>$(out)/html/images/callouts + ; + +explicit callout ; + +boostbook doc + : + docca_bb + : + <xsl:param>chapter.autolabel=0 + <xsl:param>boost.root=$(broot) + <xsl:param>chapter.autolabel=0 + <xsl:param>chunk.first.sections=1 # Chunk the first top-level section? + <xsl:param>chunk.section.depth=8 # Depth to which sections should be chunked + <xsl:param>generate.section.toc.level=1 # Control depth of TOC generation in sections + <xsl:param>toc.max.depth=2 # How many levels should be created for each TOC? + <xsl:param>toc.section.depth=2 # How deep should recursive sections appear in the TOC? + : + <location>temp + <dependency>stylesheets + <dependency>images + ; diff --git a/src/boost/tools/docca/example/boostbook.dtd b/src/boost/tools/docca/example/boostbook.dtd new file mode 100644 index 000000000..bd4c3f871 --- /dev/null +++ b/src/boost/tools/docca/example/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/docca/example/include/docca/example.hpp b/src/boost/tools/docca/example/include/docca/example.hpp new file mode 100644 index 000000000..f15913573 --- /dev/null +++ b/src/boost/tools/docca/example/include/docca/example.hpp @@ -0,0 +1,857 @@ +// +// Copyright (c) 2015-2016 Vinnie Falco (vinnie dot falco at gmail dot 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) +// + +#ifndef EXAMPLE_HPP +#define EXAMPLE_HPP + +#include <cstddef> +#include <string> + +// This is a sample header file to show docca XLST results +// +// namespace, enum, type alias, global, static global, +// function, static function, struct/class + +namespace example { + +/** Enum + + Description +*/ +enum enum_t +{ + /// 0 + zero, + + /// 1 + one, + + /// 2 + two +}; + +/** Enum class + + Description +*/ +enum class enum_c +{ + /// aaa + aaa, + + /// bbb + bbb, + + /// ccc + ccc +}; + +/** Type alias + + Description +*/ +using type = std::string; + +/** Template type alias + + Description +*/ +template<class T> +using t_type = std::vector<T>; + +/** Void or deduced + + Description +*/ +using vod = __deduced__; + +/** See below + + Description +*/ +using sb = __see_below__; + +/** Implementation-defined + + Description +*/ +using impdef = __implementation_defined__; + +/** Variable + + Description +*/ +extern std::size_t var; + +/** Static variable + + Description +*/ +static std::size_t s_var = 0; + +/** Brief with @b bold text. + + Function returning @ref type. + + @return The type + + @see t_func. + + @throw std::exception on error + @throw std::domain_error on bad parameters + + @par Thread Safety + + Cannot be called concurrently. + + @note Additional notes. + + @param arg1 Function parameter 1 + @param arg2 Function parameter 2 +*/ +type +func(int arg1, std::string arg2); + +/** Brief for function starting with _ + + @return @ref type + + @see func +*/ +type +_func(float arg1, std::size arg2); + +/** Brief. + + Function description. + + See @ref func. + + @tparam T Template parameter 1 + @tparam U Template parameter 2 + @tparam V Template parameter 3 + + @param t Function parameter 1 + @param u Function parameter 2 + @param v Function parameter 3 + + @return nothing +*/ +template<class T, class U> +void +t_func(T t, U const& u, V&& v); + +/** Overloaded function 1 + + Description + + @param arg1 Parameter 1 +*/ +void +overload(int arg1); + +/** Overloaded function 2 + + Description + + @param arg1 Parameter 1 + @param arg2 Parameter 2 +*/ +void +overload(int arg1, int arg2); + +/** Overloaded function 3 + + Description + + @param arg1 Parameter 1 + @param arg2 Parameter 2 + @param arg3 Parameter 3 +*/ +void +overload(int arg1, int arg2, int arg3); + +/** Markdown examples + + @par List + + 1. Lists with extra long lines that can *span* multiple lines + and overflow even the longest of buffers. + 2. With Numbers + + Or not + + Nesting + 1. Deeply + + And returning `here`. + + Another list I enjoy: + + -# 1 + - 1.a + -# 1.a.1 + -# 1.a.2 + - 1.b + -# 2 + - 2.a + - 2.b + -# 2.b.1 + -# 2.b.2 + - 2.b.2.a + - 2.b.2.b + + @par Table + + First Header | Second Header + ------------- | ------------- + Content Cell | Content Cell + Content Cell | Content Cell +*/ +void markdown(); + +//------------------------------------------------------------------------------ + +namespace detail { + +/** Detail class + + Description +*/ +struct detail_type +{ +}; + +/** Detail function + + Description +*/ +void +detail_function(); + +} // detail + +//------------------------------------------------------------------------------ + +/// Nested namespace +namespace nested { + +/** Enum + + Description +*/ +enum enum_t +{ + /// 0 + zero, + + /// 1 + one, + + /// 2 + two +}; + +/** Enum class + + Description +*/ +enum class enum_c +{ + /// aaa + aaa, + + /// bbb + bbb, + + /// ccc + ccc +}; + +/** Type alias + + Description +*/ +using type = std::string; + +/** Template type alias + + Description +*/ +template<class T> +using t_type = std::vector<T>; + +/** Variable + + Description +*/ +extern std::size_t var; + +/** Static variable + + Description +*/ +static std::size_t s_var = 0; + +/** Brief with @b bold text. + + Function returning @ref type. + + @return The type + + @see t_func. + + @throw std::exception on error + @throw std::domain_error on bad parameters + + @par Thread Safety + + Cannot be called concurrently. + + @note Additional notes. + + @param arg1 Function parameter 1 + @param arg2 Function parameter 2 +*/ +type +func(int arg1, std::string arg2); + +/** Brief for function starting with _ + +@return @ref type + +@see func +*/ +type +_func(float arg1, std::size arg2); + +/** Brief. + + Function description. + + See @ref func. + + @tparam T Template parameter 1 + @tparam U Template parameter 2 + @tparam V Template parameter 3 + + @param t Function parameter 1 + @param u Function parameter 2 + @param v Function parameter 3 + + @return nothing +*/ +template<class T, class U> +void +t_func(T t, U const& u, V&& v); + +/** Overloaded function 1 + + Description + + @param arg1 Parameter 1 +*/ +void +overload(int arg1); + +/** Overloaded function 2 + + Description + + @param arg1 Parameter 1 + @param arg2 Parameter 2 +*/ +void +overload(int arg1, int arg2); + +/** Overloaded function 3 + + Description + + @param arg1 Parameter 1 + @param arg2 Parameter 2 + @param arg3 Parameter 3 +*/ +void +overload(int arg1, int arg2, int arg3); + +} // nested + +/// Overloads operators +struct Num +{ + + /// Addition + friend + Num + operator +(Num, Num); + + /// Subtraction + friend + Num + operator -(Num, Num); + + /// Multiplication + friend + Num + operator *(Num, Num); + + /// Division + friend + Num + operator /(Num, Num); + +}; + +/// @ref Num addition +Num +operator +(Num, Num); + +/// @ref Num subtraction +Num +operator -(Num, Num); + +/// @ref Num multiplication +Num +operator *(Num, Num); + +/// @ref Num division +Num +operator /(Num, Num); + +/** Template class type. + + Description. + + @tparam T Template parameter 1 + @tparam U Template parameter 2 +*/ +template<class T, class U> +class class_type +{ +public: + /** Enum + + Description + */ + enum enum_t + { + /// 0 + zero, + + /// 1 + one, + + /// 2 + two, + + /// _3 + _three + }; + + /** Enum class + + Description + */ + enum class enum_c + { + /// aaa + aaa, + + /// bbb + bbb, + + /// ccc + ccc, + + /// _ddd + _ddd + }; + + /** Type alias + + Description + */ + using type = std::string; + + /** Template type alias + + Description + */ + template<class T> + using t_type = std::vector<T>; + + /** Variable + + Description + */ + extern std::size_t var; + + /** Static variable + + Description + */ + static std::size_t s_var = 0; + + /** Default Ctor + + Description + */ + class_type(); + + /** Dtor + + Description + */ + ~class_type(); + + /** Brief with @b bold text. + + Function returning @ref type. + + @return The type + + @see t_func. + + @throw std::exception on error + @throw std::domain_error on bad parameters + + @par Thread Safety + + Cannot be called concurrently. + + @note Additional notes. + + @param arg1 Function parameter 1 + @param arg2 Function parameter 2 + */ + type + func(int arg1, std::string arg2); + + /** Brief. + + Function description. + + See @ref func. + + @tparam T Template parameter 1 + @tparam U Template parameter 2 + @tparam V Template parameter 3 + + @param t Function parameter 1 + @param u Function parameter 2 + @param v Function parameter 3 + + @return nothing + */ + template<class T, class U> + void + t_func(T t, U const& u, V&& v); + + /** Overloaded function 1 + + Description + + @param arg1 Parameter 1 + */ + void + overload(int arg1); + + /** Overloaded function 2 + + Description + + @param arg1 Parameter 1 + @param arg2 Parameter 2 + */ + void + overload(int arg1, int arg2); + + /** Overloaded function 3 + + Description + + @param arg1 Parameter 1 + @param arg2 Parameter 2 + @param arg3 Parameter 3 + */ + void + overload(int arg1, int arg2, int arg3); + + /** Less-than operator + + Description + */ + bool + operator< (class_type const& rhs) const; + + /** Greater-than operator + + Description + */ + bool + operator> (class_type const& rhs) const; + + /** Less-than-or-equal-to operator + + Description + */ + bool + operator<= (class_type const& rhs) const; + + /** Greater-than-or-equal-to operator + + Description + */ + bool + operator>= (class_type const& rhs) const; + + /** Equality operator + + Description + */ + bool + operator== (class_type const& rhs) const; + + /** Inequality operator + + Description + */ + bool + operator!= (class_type const& rhs) const; + + /** Arrow operator + + Description + */ + std::size_t operator->() const; + + /** Index operator + + Description + */ + enum_c& operator[](std::size_t); + + /** Index operator + + Description + */ + enum_c operator[](std::size_t) const; + + /// Public data + std::size_t pub_data_; + + /// Public static data + static std::size_t pub_sdata_; + +protected: + /** Protected data + + Description + */ + std::size_t prot_data_; + + /** Protected enum + + Description + */ + enum_c _prot_enum; + + /** Static protected data + + Description + */ + static std::size_t prot_sdata_; + + /** Protected type + + Description + */ + struct prot_type + { + }; + + /** Protected function + + Description + */ + void prot_memfn(); + + /** Protected function returning @ref prot_type + + Description + */ + prot_type prot_rvmemfn(); + + /** Protected static member function + + Description + */ + static void static_prot_memfn(); + +private: + /** Private data + + Description + */ + std::size_t priv_data_; + + /** Static private data + + Description + */ + static std::size_t priv_sdata_; + + /** Private type + + Description + */ + struct priv_type + { + }; + + /** Private function + + Description + */ + void priv_memfn(); + + /** Private function returning *ref priv_type + + Description + */ + priv_type priv_rvmemfn(); + + /** Static private member function + + Description + */ + static void static_priv_memfn(); + + /** Friend class + + Description + */ + friend friend_class; +}; + +/// Other base class 1 +class other_base_class1 +{ +}; + +/// Other base class 2 +class other_base_class2 +{ +}; + +/** Derived type + + Description +*/ +template<class T, class U> +class derived_type : + public class_type<T, U>, + protected other_base_class1, + private other_base_class2 +{ +}; + +/** References to all identifiers: + + Description one @ref one + + @par See Also + + @li @ref type + + @li @ref t_type + + @li @ref vod + + @li @ref impdef + + @li @ref var + + @li @ref s_var + + @li @ref func + + @li @ref t_func + + @li @ref overload + + @li @ref nested::enum_t : @ref nested::zero @ref nested::one @ref nested::two + + @li @ref nested::enum_c : nested::enum_c::aaa @ref nested::enum_c::bbb @ref nested::enum_c::ccc + + @li @ref nested::type + + @li @ref nested::t_type + + @li @ref nested::var + + @li @ref nested::s_var + + @li @ref nested::func + + @li @ref nested::t_func + + @li @ref nested::overload + + @li @ref class_type + + @li @ref class_type::enum_t : @ref class_type::zero @ref class_type::one @ref class_type::two @ref class_type::_three + + @li @ref class_type::enum_c : class_type::enum_c::aaa @ref class_type::enum_c::bbb @ref class_type::enum_c::ccc class_type::enum_c::_ddd + + @li @ref class_type::type + + @li @ref class_type::t_type + + @li @ref class_type::var + + @li @ref class_type::s_var + + @li @ref class_type::class_type + + @li @ref class_type::func + + @li @ref class_type::t_func + + @li @ref class_type::overload + + @li @ref class_type::pub_data_ + + @li @ref class_type::pub_sdata_ + + @li @ref class_type::_prot_enum + + @li @ref class_type::prot_type + + @li @ref class_type::priv_type + + @li @ref derived_type + + @li @ref Num + +*/ +void all_ref(); + +} // example + +namespace other { + +/// other function +void func(); + +/// other class +struct class_type +{ +}; + + +} // other + +#endif diff --git a/src/boost/tools/docca/example/index.xml b/src/boost/tools/docca/example/index.xml new file mode 100644 index 000000000..c364e4ed2 --- /dev/null +++ b/src/boost/tools/docca/example/index.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "boostbook.dtd"> + +<!-- + Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot 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) +--> + +<section id="docca.index"> + <title>Index</title> + <index/> +</section> diff --git a/src/boost/tools/docca/example/main.qbk b/src/boost/tools/docca/example/main.qbk new file mode 100644 index 000000000..43ddf6ae1 --- /dev/null +++ b/src/boost/tools/docca/example/main.qbk @@ -0,0 +1,28 @@ +[/ + Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot 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) +] + +[library docca + [quickbook 1.6] + [copyright 2016 Vinnie Falco] + [purpose Documentation Library] + [license + 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]) + ] + [category template] + [category generic] +] + +[template mdash[] '''— '''] +[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>'''] +[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>'''] + +[section:ref Reference] +[include reference.qbk] +[endsect] +[xinclude index.xml] diff --git a/src/boost/tools/docca/example/makeqbk.sh b/src/boost/tools/docca/example/makeqbk.sh new file mode 100644 index 000000000..e6fa0c30a --- /dev/null +++ b/src/boost/tools/docca/example/makeqbk.sh @@ -0,0 +1,13 @@ +#!/usr/bin/bash + +# Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot 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) + +mkdir -p temp +doxygen source.dox +cd temp +xsltproc combine.xslt index.xml > all.xml +xsltproc ../reference.xsl all.xml > ../reference.qbk + diff --git a/src/boost/tools/docca/example/reference.xsl b/src/boost/tools/docca/example/reference.xsl new file mode 100644 index 000000000..de5675294 --- /dev/null +++ b/src/boost/tools/docca/example/reference.xsl @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + +<!-- Variables (Edit for your project) --> +<xsl:variable name="doc-ref" select="'docca.ref.'"/> +<xsl:variable name="doc-ns" select="'example'"/> +<xsl:variable name="debug" select="0"/> +<xsl:variable name="private" select="0"/> +<!-- End Variables --> + +<xsl:include href="../include/docca/doxygen.xsl"/> + +</xsl:stylesheet> + diff --git a/src/boost/tools/docca/example/source.dox b/src/boost/tools/docca/example/source.dox new file mode 100644 index 000000000..c55616ee7 --- /dev/null +++ b/src/boost/tools/docca/example/source.dox @@ -0,0 +1,333 @@ +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "docca" +PROJECT_NUMBER = +PROJECT_BRIEF = Documentation Library +PROJECT_LOGO = +OUTPUT_DIRECTORY = +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = +ALWAYS_DETAILED_SEC = YES +INLINE_INHERITED_MEMB = YES +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = include/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = YES +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = YES +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +TCL_SUBST = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +HIDE_COMPOUND_REFERENCE= NO +SHOW_INCLUDE_FILES = NO +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = NO +SORT_MEMBER_DOCS = NO +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = YES +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = NO +GENERATE_TESTLIST = NO +GENERATE_BUGLIST = NO +GENERATE_DEPRECATEDLIST= NO +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = NO +SHOW_FILES = NO +SHOW_NAMESPACES = NO +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = include/docca/example.hpp + +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = YES +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +CLANG_ASSISTED_PARSING = NO +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 1 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = NO +HTML_OUTPUT = dhtm +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = NO +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4 +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_SUBDIR = +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = YES +XML_OUTPUT = temp/ +XML_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = DOXYGEN \ + GENERATING_DOCS \ + _MSC_VER + +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = +DIA_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_PATH = +DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/src/boost/tools/docca/include/docca/assemble-quickbook.xsl b/src/boost/tools/docca/include/docca/assemble-quickbook.xsl new file mode 100644 index 000000000..fe39870a0 --- /dev/null +++ b/src/boost/tools/docca/include/docca/assemble-quickbook.xsl @@ -0,0 +1,20 @@ +<!-- Concatenate all the text files from a directory into one big file --> +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + exclude-result-prefixes="xs"> + + <xsl:output method="text"/> + + <!-- TODO: remove this coupling; should be configured in the build file somehow + (add support for Saxon parameter-passing in the build?) --> + <xsl:param name="input-dir" select="'stage2/results'"/> + + <xsl:template match="page"> + <xsl:copy-of select="unparsed-text(concat($input-dir, '/', @href))"/> + <xsl:apply-templates select="page"/> + <!-- Two line breaks before to ensure it doesn't get absorbed into a preceding list --> + <xsl:text>

[endsect]
</xsl:text> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/base-extract-xml-pages.xsl b/src/boost/tools/docca/include/docca/base-extract-xml-pages.xsl new file mode 100644 index 000000000..685380c4d --- /dev/null +++ b/src/boost/tools/docca/include/docca/base-extract-xml-pages.xsl @@ -0,0 +1,427 @@ +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:d="http://github.com/vinniefalco/docca" + exclude-result-prefixes="xs d" + expand-text="yes"> + + <!-- TODO: make sure this doesn't screw up any formatting --> + <!-- NEW TODO: verify we don't need/want this --> + <!-- + <xsl:output indent="yes"/> + --> + + <xsl:include href="common.xsl"/> + + <xsl:key name="visible-memberdefs-by-id" + match="memberdef[$include-private-members or not(@prot eq 'private')]" + use="@id"/> + + <xsl:key name="elements-by-refid" match="compound | member" use="@refid"/> + + <xsl:variable name="index-xml" select="/"/> + + <xsl:template match="/"> + <index> + <xsl:apply-templates select="/doxygenindex/compound"/> + </index> + <!-- Testing the ID-related functions + <xsl:value-of select="replace(d:extract-ns('put'), '::$', '')"/> + <xsl:text>
</xsl:text> + <xsl:value-of select="replace(d:extract-ns('foobar::parser::put'), '::$', '')"/> + <xsl:text>
</xsl:text> + <xsl:value-of select="d:extract-ns('foobar::parser::put<foo::bar, bat::bang>')"/> + <xsl:text>
</xsl:text> + <xsl:value-of select="d:strip-ns('boost::beast::http::parser::basic_parser< foo::isRequest, bar::parser >')"/> + <xsl:text>
</xsl:text> + <xsl:value-of select="d:strip-doc-ns('boost::beast::http::parser::basic_parser< foo::isRequest, bar::parser >')"/> + <xsl:text>
</xsl:text> + <xsl:text>
</xsl:text> + <xsl:value-of select="d:make-id('boost::beast::http::parser::basic_parser< foo::isRequest, bar::parser >')"/> + --> + </xsl:template> + + <!-- Default implementation; can be customized/overridden --> + <xsl:function name="d:should-ignore-compound"> + <xsl:param name="compound" as="element(compound)"/> + <xsl:sequence select="false()"/> + </xsl:function> + + <xsl:template match="compound[d:should-ignore-compound(.)]"/> + <xsl:template match="compound"> + <!-- Load each input file only once --> + <xsl:variable name="source-doc" select="d:get-source-doc(.)"/> + <!-- Ignore private classes unless private members are enabled --> + <xsl:if test="$include-private-members or not($source-doc/doxygen/compounddef/@prot eq 'private')"> + <!-- Look up memberdefs (and constrain by visibility) only once --> + <xsl:variable name="memberdefs" select="key('visible-memberdefs-by-id', member/@refid, $source-doc)"/> + <!-- Create a filtered copy of members within their minimal context, listing only the visible ones --> + <xsl:variable name="visible-members" as="element(member)*"> + <xsl:variable name="compound" as="element()"> + <compound kind="{@kind}" refid="{@refid}"> + <name>{name}</name> + <xsl:copy-of select="member[@refid = $memberdefs/@id]"/> + </compound> + </xsl:variable> + <xsl:sequence select="$compound/member"/> + </xsl:variable> + <xsl:apply-templates mode="create-page" select="."> + <xsl:with-param name="source-doc" select="$source-doc" tunnel="yes"/> + <xsl:with-param name="memberdefs" select="$memberdefs" tunnel="yes"/> + <xsl:with-param name="visible-members" select="$visible-members" tunnel="yes"/> + </xsl:apply-templates> + </xsl:if> + </xsl:template> + + <xsl:function name="d:get-source-doc" as="document-node()"> + <xsl:param name="compound" as="element(compound)"/> + <xsl:sequence select="document($compound/@refid||'.xml', $index-xml)"/> + </xsl:function> + + <!-- Split up the content into class, struct, and member pages --> + <xsl:template mode="create-page" match="*"/> + <xsl:template mode="create-page" match="compound[@kind = 'namespace']"> + <xsl:apply-templates mode="child-pages" select="."/> + </xsl:template> + <xsl:template mode="create-page" match="compound[@kind = ('class','struct')] + | compound/member"> + <xsl:variable name="page-id" as="xs:string"> + <xsl:apply-templates mode="page-id" select="."/> + </xsl:variable> + <page id="{$page-id}" href="{$page-id}.xml"> + <xsl:result-document href="xml-pages/{$page-id}.xml"> + <xsl:apply-templates mode="page-content" select="."> + <xsl:with-param name="page-id" select="$page-id" tunnel="yes"/> + </xsl:apply-templates> + </xsl:result-document> + <xsl:apply-templates mode="child-pages" select="."/> + </page> + </xsl:template> + + <!-- Create the member page for each child (or, if overloaded, the overload-list page) --> + <xsl:template mode="child-pages" match="compound"> + <xsl:param name="visible-members" tunnel="yes"/> + <!-- Create a page for each unique member name --> + <xsl:for-each select="$visible-members[not(name = preceding-sibling::member/name)]"> + <xsl:apply-templates mode="create-page" select="."> + <xsl:with-param name="is-overload-list-page" select="d:is-overloaded(.)" tunnel="yes"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:template> + + <!-- A member page doesn't have children, unless it is an overload-list page --> + <xsl:template mode="child-pages" match="compound/member"> + <xsl:param name="is-overload-list-page" tunnel="yes"/> + <xsl:if test="$is-overload-list-page"> + <xsl:apply-templates mode="create-page" select="d:overloaded-members(.)"> + <xsl:with-param name="is-overload-list-page" select="false()" tunnel="yes"/> + </xsl:apply-templates> + </xsl:if> + </xsl:template> + + + <xsl:template mode="page-id" match="compound">{d:make-id(name)}</xsl:template> + <xsl:template mode="page-id" match="member"> + <xsl:param name="is-overload-list-page" tunnel="yes"/> + <xsl:value-of> + <xsl:apply-templates mode="base-member-page-id" select="."/> + <!-- Append the overload-specific suffix, if applicable --> + <xsl:if test="d:is-overloaded(.) and not($is-overload-list-page)"> + <xsl:value-of select="d:make-id('.overload'||d:overload-position(.))"/> + </xsl:if> + </xsl:value-of> + </xsl:template> + + <xsl:function name="d:is-overloaded" as="xs:boolean"> + <xsl:param name="member" as="element(member)"/> + <xsl:sequence select="exists(d:overloaded-members($member)[2])"/> + </xsl:function> + + <xsl:function name="d:overload-position" as="xs:integer"> + <xsl:param name="member" as="element(member)"/> + <xsl:sequence select="1 + count($member/preceding-sibling::member[name eq $member/name])"/> + </xsl:function> + + <xsl:function name="d:overloaded-members" as="element(member)+"> + <xsl:param name="member" as="element(member)"/> + <xsl:sequence select="$member/../member[name eq $member/name]"/> + </xsl:function> + + + <xsl:template mode="base-member-page-id" priority="1" + match="compound[@kind eq 'namespace'] + /member">{d:make-id(../name||'::'||name)}</xsl:template> + <xsl:template mode="base-member-page-id" match="compound/member">{d:make-id(../name||'.' ||name)}</xsl:template> + + + <!-- The content for a class or struct is the original source document, pared down some --> + <xsl:template mode="page-content" match="compound"> + <xsl:param name="source-doc" tunnel="yes"/> + <xsl:apply-templates mode="compound-page" select="$source-doc"/> + </xsl:template> + + <!-- By default, copy everything --> + <xsl:template mode="compound-page" match="@* | node()" name="copy-in-compound-page"> + <xsl:copy> + <xsl:apply-templates mode="#current" select="@*"/> + <xsl:apply-templates mode="compound-page-insert" select="."/> + <xsl:apply-templates mode="#current"/> + </xsl:copy> + </xsl:template> + + <!-- By default, don't insert anything --> + <xsl:template mode="compound-page-insert" match="*"/> + + <xsl:template mode="compound-page" match="listofallmembers"/> + + <xsl:template mode="compound-page" match="memberdef/@*"/> + + <!-- But directly inside <memberdef>, don't copy anything... --> + <xsl:template mode="compound-page" match="memberdef/node()"/> + + <!-- ...except for <name>, <briefdescription>, and <type> --> + <xsl:template mode="compound-page" match="memberdef/name + | memberdef/briefdescription + | memberdef/type" priority="1"> + <xsl:call-template name="copy-in-compound-page"/> + </xsl:template> + + <!-- Insert a reference to each child member's page ID --> + <xsl:template mode="compound-page-insert" match="memberdef"> + <xsl:attribute name="d:page-refid" select="d:make-id(/doxygen/compounddef/compoundname||'.'||name)"/> + </xsl:template> + + <!-- Alternative implementation in case we need to start controlling whitespace more + <xsl:template mode="compound-page" match="memberdef"> + <memberdef> + <xsl:text>
</xsl:text> + <xsl:copy-of select="name"/> + <xsl:text>
</xsl:text> + <xsl:copy-of select="briefdescription"/> + </memberdef> + </xsl:template> + --> + + <!-- The content for a member page is a subset of the source document --> + <xsl:template mode="page-content" match="compound/member"> + <xsl:param name="is-overload-list-page" tunnel="yes"/> + <xsl:choose> + <xsl:when test="$is-overload-list-page"> + <!-- For the overload list page, include the content for every like-named member --> + <xsl:apply-templates mode="list-page" select="."> + <xsl:with-param name="applicable-members" select="d:overloaded-members(.)" tunnel="yes"/> + </xsl:apply-templates> + </xsl:when> + <xsl:otherwise> + <!-- Otherwise, this page is just for one implementation (whether overloaded or not) --> + <xsl:apply-templates mode="member-page" select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template mode="list-page member-page" match="member" priority="2"> + <xsl:param name="applicable-members" as="element(member)+" select="." tunnel="yes"/> + <xsl:param name="source-doc" tunnel="yes"/> + <xsl:param name="memberdefs" tunnel="yes"/> + <xsl:apply-templates mode="#current" select="$source-doc"> + <xsl:with-param name="target-memberdefs" + select="$memberdefs[@id = $applicable-members/@refid]" + tunnel="yes"/> + <xsl:with-param name="member" select="." tunnel="yes"/> + </xsl:apply-templates> + </xsl:template> + + <!-- Always copy the name of the parent compound --> + <xsl:template mode="list-page member-page" match="compoundname" priority="2"> + <xsl:copy-of select="."/> + </xsl:template> + + <!-- Otherwise, only copy an element if it's the target member or one of its ancestors --> + <xsl:template mode="list-page member-page" match="*" priority="1"> + <xsl:param name="target-memberdefs" tunnel="yes"/> + <xsl:if test=". intersect $target-memberdefs/ancestor-or-self::*"> + <xsl:next-match/> + </xsl:if> + </xsl:template> + + <!-- By default, copy everything --> + <xsl:template mode="list-page" match="@* | node()"> + <xsl:copy> + <xsl:apply-templates mode="#current" select="@*"/> + <xsl:apply-templates mode="list-page-insert" select="."/> + <xsl:apply-templates mode="#current"/> + </xsl:copy> + </xsl:template> + + <!-- By default, don't insert anything --> + <xsl:template mode="list-page-insert" match="*"/> + + + <!-- By default, copy everything --> + <xsl:template mode="member-page + copy-member-content" match="@* | node()"> + <xsl:copy> + <xsl:apply-templates mode="#current" select="@*"/> + <xsl:apply-templates mode="member-page-insert" select="."/> + <xsl:apply-templates mode="#current"/> + <xsl:apply-templates mode="member-page-append" select="."/> + </xsl:copy> + </xsl:template> + + <!-- By default, don't insert or append anything --> + <xsl:template mode="member-page-insert + member-page-append" match="*"/> + + <!-- Strip out extraneous whitespace --> + <xsl:template mode="list-page member-page" match="compounddef/text() | sectiondef/text()"/> + + <!-- Switch to an unfiltered copy once we're done filtering out the undesired elements --> + <xsl:template mode="list-page member-page" match="memberdef/node()" priority="2"> + <xsl:apply-templates mode="copy-member-content" select="."/> + </xsl:template> + + <!-- Add the page ID to the top of all page types --> + <xsl:template mode="compound-page-insert + member-page-insert + list-page-insert" match="/doxygen" priority="2"> + <xsl:param name="page-id" tunnel="yes"/> + <xsl:attribute name="d:page-id" select="$page-id"/> + <xsl:next-match/> + </xsl:template> + + <!-- Also, if applicable, insert the overload position and/or base compound reference of this member --> + <xsl:template mode="member-page-insert" match="/doxygen" priority="1"> + <xsl:param name="member" tunnel="yes"/> + <xsl:if test="d:is-overloaded($member)"> + <xsl:attribute name="d:overload-position" select="d:overload-position($member)"/> + <xsl:attribute name="d:overload-size" select="count(d:overloaded-members($member))"/> + </xsl:if> + <xsl:if test="$member[not(starts-with(@refid, ../@refid))]"> + <xsl:variable name="base-compound" select="$index-xml/*/compound[starts-with($member/@refid, @refid)] + [not(d:should-ignore-compound(.))]"/> + <xsl:apply-templates mode="base-compound-atts" select="$base-compound"/> + </xsl:if> + <xsl:next-match/> + </xsl:template> + + <xsl:template mode="base-compound-atts" match="compound"> + <xsl:attribute name="d:base-compound-name" select="d:strip-doc-ns(name)"/> + <xsl:attribute name="d:base-compound-refid"> + <xsl:apply-templates mode="page-id" select="."/> + </xsl:attribute> + </xsl:template> + + <!-- Make data available for the typedef tables, if applicable --> + <xsl:template mode="member-page-append" match="memberdef[@kind eq 'typedef'] + [type/ref] + [not(contains(type, '*'))]"> + <xsl:for-each select="type/ref"> + <d:referenced-typedef-class> + <xsl:variable name="compound" select="d:get-target-element(.)[self::compound]"/> + <xsl:apply-templates mode="compound-page" select="$compound ! d:get-source-doc(.)/*/compounddef"/> + </d:referenced-typedef-class> + </xsl:for-each> + </xsl:template> + + <!-- Finally, add the page type --> + <xsl:template mode="compound-page-insert" match="/doxygen"> + <xsl:attribute name="d:page-type" select="'compound'"/> + </xsl:template> + <xsl:template mode="member-page-insert" match="/doxygen"> + <xsl:attribute name="d:page-type" select="'member'"/> + </xsl:template> + <xsl:template mode="list-page-insert" match="/doxygen"> + <xsl:attribute name="d:page-type" select="'overload-list'"/> + </xsl:template> + + <!-- For overload-list pages, include the page id for each member --> + <xsl:template mode="list-page-insert" match="memberdef"> + <xsl:param name="applicable-members" tunnel="yes"/> + <xsl:variable name="this-id" select="@id"/> + <xsl:variable name="original-member" select="$applicable-members[@refid eq $this-id]"/> + <xsl:attribute name="d:page-refid"> + <xsl:apply-templates mode="page-id" select="$original-member"> + <xsl:with-param name="is-overload-list-page" select="false()" tunnel="yes"/> + </xsl:apply-templates> + </xsl:attribute> + </xsl:template> + + <!-- For public innerclasses, insert the referenced class inline --> + <xsl:template mode="compound-page-insert" match="innerclass[@prot eq 'public']"> + <xsl:attribute name="d:page-refid" select="d:make-id(.)"/> + <d:referenced-inner-class> + <xsl:variable name="compound" select="d:get-target-element(.)" as="element(compound)"/> + <xsl:apply-templates mode="compound-page" select="d:get-source-doc($compound)/*/compounddef"/> + </d:referenced-inner-class> + </xsl:template> + + <!-- TODO: refactor this rule --> + <!-- Resolve the referenced page IDs for later link generation --> + <xsl:template mode="compound-page-insert member-page-insert" match="ref" name="insert-referenced-page-id"> + <xsl:attribute name="d:refid"> + <xsl:apply-templates mode="page-id" select="d:get-target-element(.)"/> + </xsl:attribute> + </xsl:template> + + <xsl:function name="d:get-target-element" as="element()?"> <!-- to allow for partial builds --> + <!-- + <xsl:function name="d:get-target-element" as="element()"> + --> + <xsl:param name="ref" as="element()"/> <!-- <ref> or <innerclass> or... --> + <xsl:variable name="referenced-elements" select="key('elements-by-refid', $ref/@refid, $index-xml)"/> + <xsl:variable name="result" as="element()?"> + <xsl:choose> + <!-- Handle the case where the referenced element appears two or more times in index.xml --> + <!-- If there's no ambiguity, we're done! --> + <xsl:when test="count($referenced-elements) eq 1"> + <xsl:apply-templates mode="find-target-element" select="$referenced-elements"/> + </xsl:when> + <xsl:otherwise> + <!-- Otherwise, see if a namespace in the link text successfully disambiguates --> + <xsl:variable name="qualified-reference" as="element()*"> + <xsl:variable name="parent-in-link-text" + select="if (contains($ref,'::')) + then d:extract-ns-without-suffix($ref) + else ''"/> + <xsl:sequence select="$referenced-elements[ends-with(parent::compound/name, '::'||$parent-in-link-text)]"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="count($qualified-reference) eq 1"> + <xsl:apply-templates mode="find-target-element" select="$qualified-reference"/> + </xsl:when> + <xsl:otherwise> + <!-- Otherwise, favor the member that's in the same class or namespace as the current page --> + <xsl:variable name="sibling-reference" as="element()*"> + <xsl:variable name="compound-for-current-page" select="root($ref)/doxygen/compounddef/compoundname/string()"/> + <xsl:sequence select="$referenced-elements[parent::compound/name eq $compound-for-current-page]"/> + </xsl:variable> + <xsl:choose> + <xsl:when test="count($sibling-reference) eq 1"> + <xsl:apply-templates mode="find-target-element" select="$sibling-reference"/> + </xsl:when> + <!-- If all else fails, give up and just use the first one --> + <xsl:otherwise> + <xsl:apply-templates mode="find-target-element" select="$referenced-elements[1]"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="not($result)"> + <xsl:message>Unable to find referenced ID: <xsl:value-of select="$ref/@refid"/></xsl:message> + </xsl:if> + <xsl:sequence select="$result"/> + </xsl:function> + + <xsl:template mode="find-target-element" match="compound | member"> + <xsl:sequence select="."/> + </xsl:template> + + <!-- In the index XML, enumvalue "members" immediately follow the corresponding enum member --> + <xsl:template mode="find-target-element" match="member[@kind eq 'enumvalue']"> + <xsl:sequence select="preceding-sibling::member[@kind eq 'enum'][1]"/> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/base-stage1.xsl b/src/boost/tools/docca/include/docca/base-stage1.xsl new file mode 100644 index 000000000..6e5d47977 --- /dev/null +++ b/src/boost/tools/docca/include/docca/base-stage1.xsl @@ -0,0 +1,590 @@ +<!DOCTYPE xsl:stylesheet [ +<!-- TODO: complete this list --> +<!ENTITY BLOCK_LEVEL_ELEMENT "programlisting + | itemizedlist + | orderedlist + | parameterlist + | simplesect + | para + | table + | linebreak"> +]> +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:d="http://github.com/vinniefalco/docca" + exclude-result-prefixes="xs d" + expand-text="yes"> + + <xsl:include href="common.xsl"/> + + <xsl:output indent="yes"/> + + <xsl:template match="/doxygen" priority="1"> + <page id="{@d:page-id}" type="{@d:page-type}"> + <xsl:apply-templates mode="index-term-atts" select="."/> + <title> + <xsl:apply-templates mode="page-title" select="."/> + </title> + <xsl:apply-templates select="@d:base-compound-refid"/> + <xsl:next-match/> + </page> + </xsl:template> + + <xsl:template match="@d:base-compound-refid"> + <div>(Inherited from <ref d:refid="{.}">{../@d:base-compound-name}</ref>)</div> + </xsl:template> + + <!-- Put an index term on every page except class (compound) and overloaded-member pages --> + <xsl:template mode="index-term-atts" match="doxygen[@d:page-type eq 'compound' or @d:overload-position]"/> + <xsl:template mode="index-term-atts" match="doxygen"> + <xsl:attribute name="primary-index-term"> + <xsl:apply-templates mode="primary-index-term" select="."/> + </xsl:attribute> + <xsl:apply-templates mode="secondary-index-term-att" select="."/> + </xsl:template> + + <!-- By default, use the member name as the primary term... --> + <xsl:template mode="primary-index-term" match="doxygen"> + <xsl:apply-templates mode="member-name" select="."/> + </xsl:template> + <!-- ...and the compound name as the secondary term. --> + <xsl:template mode="secondary-index-term-att" match="doxygen"> + <xsl:attribute name="secondary-index-term"> + <xsl:apply-templates mode="compound-name" select="."/> + </xsl:attribute> + </xsl:template> + + <!-- But with namespace members, use the fully-qualified name as the primary term... --> + <xsl:template mode="primary-index-term" match="doxygen[compounddef/@kind eq 'namespace']"> + <xsl:apply-templates mode="compound-and-member-name" select="."/> + </xsl:template> + <!-- ...and no secondary term. --> + <xsl:template mode="secondary-index-term-att" match="doxygen[compounddef/@kind eq 'namespace']"/> + + <xsl:template mode="compound-name" match="doxygen" + >{d:strip-doc-ns(compounddef/compoundname)}</xsl:template> + + <xsl:template mode="member-name" match="doxygen" + >{(compounddef/sectiondef/memberdef/name)[1]}</xsl:template> + + <xsl:template mode="compound-and-member-name" match="doxygen"> + <xsl:variable name="compound-name" as="xs:string"> + <xsl:apply-templates mode="compound-name" select="."/> + </xsl:variable> + <xsl:if test="$compound-name">{$compound-name}::</xsl:if> + <xsl:apply-templates mode="member-name" select="."/> + </xsl:template> + + <xsl:template mode="page-title" match="doxygen[@d:page-type eq 'compound']"> + <xsl:apply-templates mode="compound-name" select="."/> + </xsl:template> + <xsl:template mode="page-title" match="doxygen"> + <xsl:apply-templates mode="compound-and-member-name" select="."/> + <xsl:apply-templates mode="overload-qualifier" select="."/> + </xsl:template> + + <xsl:template mode="overload-qualifier" match="doxygen"/> + <xsl:template mode="overload-qualifier" match="doxygen[@d:overload-position]"> + <xsl:text> (</xsl:text> + <xsl:value-of select="@d:overload-position"/> + <xsl:text> of </xsl:text> + <xsl:value-of select="@d:overload-size"/> + <xsl:text> overloads)</xsl:text> + </xsl:template> + + + <xsl:template match="/doxygen[@d:page-type eq 'compound']"> + <xsl:apply-templates select="compounddef"/> + </xsl:template> + + <xsl:template match="/doxygen[@d:page-type eq 'member']"> + <xsl:apply-templates select="compounddef/sectiondef/memberdef"/> <!-- should just be one --> + </xsl:template> + + <xsl:template match="/doxygen[@d:page-type eq 'overload-list']"> + <xsl:apply-templates select="(compounddef/sectiondef/memberdef)[1]"/> + </xsl:template> + + <xsl:template match="compounddef | memberdef" priority="2"> + <xsl:next-match/> + <xsl:apply-templates mode="includes" select="."> + <xsl:with-param name="is-footer" select="true()"/> + </xsl:apply-templates> + </xsl:template> + + <!-- For convenience, pre-calculate some member sequences and tunnel them through --> + <xsl:template match="compounddef" priority="1"> + <xsl:next-match> + <xsl:with-param name="public-types" + select="sectiondef[@kind eq 'public-type']/memberdef + | innerclass[@prot eq 'public'][not(d:should-ignore-inner-class(.))]" + tunnel="yes"/> + <xsl:with-param name="friends" + select="sectiondef[@kind eq 'friend']/memberdef[not(type eq 'friend class')] + [not(d:should-ignore-friend(.))]" + tunnel="yes"/> + </xsl:next-match> + </xsl:template> + + <xsl:template match="compounddef"> + <xsl:param name="public-types" tunnel="yes"/> + <xsl:param name="friends" tunnel="yes"/> + + <xsl:apply-templates select="briefdescription"/> + + <xsl:apply-templates mode="section" + select="., + + ( $public-types/self::memberdef/.. + | $public-types/self::innerclass + )[1], + + sectiondef[@kind = ( 'public-func', 'public-static-func')], + sectiondef[@kind = ('protected-func','protected-static-func')], + sectiondef[@kind = ( 'private-func', 'private-static-func')][$include-private-members], + + sectiondef[@kind = ( 'public-attrib', 'public-static-attrib')], + sectiondef[@kind = ('protected-attrib','protected-static-attrib')], + sectiondef[@kind = ( 'private-attrib', 'private-static-attrib')][$include-private-members], + + $friends/.., + + sectiondef[@kind eq 'related'], + + detaileddescription + "/> + </xsl:template> + + <xsl:template match="memberdef"> + <xsl:apply-templates select="briefdescription"/> + <xsl:apply-templates mode="section" select="., detaileddescription"/> + </xsl:template> + + <xsl:template match="memberdef[@kind eq 'enum']"> + <xsl:apply-templates select="briefdescription"/> + <xsl:apply-templates mode="section" select="., parent::sectiondef, detaileddescription"/> + </xsl:template> + + <xsl:template match="memberdef[/doxygen/@d:page-type eq 'overload-list']"> + <xsl:apply-templates mode="overload-list" select="../../sectiondef/memberdef"/> + </xsl:template> + + <xsl:template mode="overload-list" match="memberdef"> + <xsl:apply-templates select="briefdescription[not(. = ../preceding-sibling::*/briefdescription)]"/> + <overloaded-member> + <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> + <xsl:apply-templates mode="modifier" select="(@explicit, @friend, @static)[. eq 'yes'], + @virt[. eq 'virtual']"/> + <xsl:apply-templates select="type"/> + <ref d:refid="{@d:page-refid}">{name}</ref> + <params> + <xsl:apply-templates select="param"/> + </params> + <xsl:apply-templates mode="modifier" select="@const[. eq 'yes']"/> + </overloaded-member> + </xsl:template> + + <xsl:template mode="modifier" match="@*"> + <modifier>{local-name(.)}</modifier> + </xsl:template> + <xsl:template mode="modifier" match="@virt"> + <modifier>virtual</modifier> + </xsl:template> + + + <xsl:template match="type"> + <type> + <xsl:value-of select="d:cleanup-type(normalize-space(.))"/> + </type> + </xsl:template> + + <!-- d:cleanup-param() may not be needed, and the above may suffice. (TODO: confirm this and remove d:cleanup-param() if so) + <xsl:template match="param/type"> + <type> + <xsl:value-of select="d:cleanup-param(.)"/> + </type> + </xsl:template> + --> + + <!-- TODO: Should this be a custom rule or built-in? --> + <xsl:template mode="section" match="simplesect[matches(title,'Concepts:?')]"/> + + <xsl:template mode="section" match="*"> + <section> + <heading> + <xsl:apply-templates mode="section-heading" select="."/> + </heading> + <xsl:apply-templates mode="section-body" select="."/> + </section> + </xsl:template> + + <xsl:template match="simplesect | parameterlist"> + <xsl:apply-templates mode="section" select="."/> + </xsl:template> + + <xsl:template mode="section-heading" match="memberdef | + compounddef ">Synopsis</xsl:template> + <xsl:template mode="section-heading" match="detaileddescription">Description</xsl:template> + + <xsl:template mode="section-heading" match="simplesect[@kind eq 'note' ]">Remarks</xsl:template> + <xsl:template mode="section-heading" match="simplesect[@kind eq 'see' ]">See Also</xsl:template> + <xsl:template mode="section-heading" match="simplesect[@kind eq 'return']">Return Value</xsl:template> + <xsl:template mode="section-heading" match="simplesect" >{title}</xsl:template> + + <xsl:template mode="section-heading" match="parameterlist[@kind eq 'exception' ]">Exceptions</xsl:template> + <xsl:template mode="section-heading" match="parameterlist[@kind eq 'templateparam']">Template Parameters</xsl:template> + <xsl:template mode="section-heading" match="parameterlist ">Parameters</xsl:template> + + <xsl:template mode="section-heading" match="innerclass + | sectiondef[@kind eq 'public-type']">Types</xsl:template> + <xsl:template mode="section-heading" match="sectiondef[@kind eq 'friend' ]">Friends</xsl:template> + <xsl:template mode="section-heading" match="sectiondef[@kind eq 'related' ]">Related Functions</xsl:template> + + <xsl:template mode="section-heading" match="sectiondef[@kind eq 'enum']">Values</xsl:template> + + <xsl:template mode="section-heading" match="sectiondef"> + <xsl:apply-templates mode="access-level" select="@kind"/> + <xsl:apply-templates mode="member-kind" select="@kind"/> + </xsl:template> + + <xsl:template mode="access-level" match="@kind[starts-with(.,'public' )]"/> + <xsl:template mode="access-level" match="@kind[starts-with(.,'protected')]">Protected </xsl:template> + <xsl:template mode="access-level" match="@kind[starts-with(.,'private' )]">Private </xsl:template> + + <xsl:template mode="member-kind" match="@kind[ends-with(.,'func' )]">Member Functions</xsl:template> + <xsl:template mode="member-kind" match="@kind[ends-with(.,'attrib')]">Data Members</xsl:template> + + <xsl:template mode="section-body" match="sectiondef | innerclass | parameterlist"> + <table> + <tr> + <th> + <xsl:apply-templates mode="column-1-name" select="."/> + </th> + <th> + <xsl:apply-templates mode="column-2-name" select="."/> + </th> + </tr> + <xsl:apply-templates mode="table-body" select="."/> + </table> + </xsl:template> + + <xsl:template mode="column-1-name" match="*">Name</xsl:template> + <xsl:template mode="column-2-name" match="*">Description</xsl:template> + + <xsl:template mode="column-1-name" + match="parameterlist[@kind = ('exception','templateparam')]">Type</xsl:template> + + <xsl:template mode="column-2-name" match="parameterlist[@kind eq 'exception']">Thrown On</xsl:template> + + + <xsl:template mode="table-body" match="parameterlist"> + <xsl:apply-templates mode="parameter-row" select="parameteritem"/> + </xsl:template> + + <xsl:template mode="parameter-row" match="parameteritem"> + <tr> + <td> + <code> + <!-- ASSUMPTION: <parameternamelist> only ever has one <parametername> child --> + <xsl:apply-templates select="parameternamelist/parametername/node()"/> + </code> + </td> + <td> + <xsl:apply-templates select="parameterdescription/node()"/> + </td> + </tr> + </xsl:template> + + <xsl:template mode="table-body" match="sectiondef[@kind eq 'enum']"> + <xsl:apply-templates mode="enum-row" select="memberdef/enumvalue"/> <!-- Use input order for enum values --> + </xsl:template> + + <xsl:template mode="enum-row" match="enumvalue"> + <tr> + <td> + <code>{name}</code> + </td> + <td> + <xsl:apply-templates select="briefdescription, detaileddescription"/> + </td> + </tr> + </xsl:template> + + <xsl:template mode="table-body" match="sectiondef | innerclass"> + <xsl:variable name="member-nodes" as="element()*"> + <xsl:apply-templates mode="member-nodes" select="."/> + </xsl:variable> + <xsl:apply-templates mode="member-row" select="$member-nodes"> + <xsl:sort select="d:member-name(.)"/> + </xsl:apply-templates> + </xsl:template> + + <xsl:template mode="member-nodes" match="innerclass | sectiondef[@kind eq 'public-type']"> + <xsl:param name="public-types" tunnel="yes"/> + <xsl:sequence select="$public-types"/> + </xsl:template> + + <xsl:template mode="member-nodes" match="sectiondef[@kind eq 'friend']"> + <xsl:param name="friends" tunnel="yes"/> + <xsl:sequence select="$friends"/> + </xsl:template> + + <xsl:template mode="member-nodes" match="sectiondef"> + <xsl:sequence select="memberdef"/> + </xsl:template> + + + <xsl:function name="d:member-name"> + <xsl:param name="element"/> + <xsl:apply-templates mode="member-name" select="$element"/> + </xsl:function> + + <xsl:template mode="member-name" match="memberdef"> + <xsl:sequence select="name"/> + </xsl:template> + <xsl:template mode="member-name" match="innerclass"> + <xsl:sequence select="d:referenced-inner-class/compounddef/compoundname ! d:strip-ns(.)"/> + </xsl:template> + + + <!-- Only output a table row for the first instance of each name (ignore overloads) --> + <xsl:template mode="member-row" match="memberdef[name = preceding-sibling::memberdef/name]"/> + <xsl:template mode="member-row" match="*"> + <tr> + <td> + <bold> + <ref d:refid="{@d:page-refid}">{d:member-name(.)}</ref> + </bold> + </td> + <td> + <xsl:apply-templates mode="member-description" select="."/> + </td> + </tr> + </xsl:template> + + <xsl:template mode="member-description" match="innerclass"> + <xsl:apply-templates select="d:referenced-inner-class/compounddef/briefdescription"/> + </xsl:template> + <xsl:template mode="member-description" match="memberdef"> + <xsl:variable name="descriptions" select="../memberdef[name eq current()/name]/briefdescription"/> + <!-- Pull in any overload descriptions but only if they vary --> + <xsl:for-each select="distinct-values($descriptions)"> + <xsl:apply-templates select="$descriptions[. eq current()][1]"/> + </xsl:for-each> + </xsl:template> + + + <xsl:template mode="section-body" match="detaileddescription | simplesect"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template mode="section-body" match="compounddef | memberdef" priority="1"> + <xsl:apply-templates mode="includes" select="."/> + <xsl:next-match/> + </xsl:template> + + <xsl:template mode="section-body" match="compounddef"> + <compound> + <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> + <kind>{@kind}</kind> + <name>{d:strip-ns(compoundname)}</name> + <xsl:for-each select="basecompoundref[not(d:should-ignore-base(.))]"> + <base> + <prot>{@prot}</prot> + <name>{d:strip-doc-ns(.)}</name> + </base> + </xsl:for-each> + </compound> + </xsl:template> + + <xsl:template mode="section-body" match="memberdef[@kind eq 'typedef']"> + <typedef> + <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> + <xsl:apply-templates select="name, type"/> + </typedef> + <!-- Nested compounddefs were derived from refs in the typedef's type --> + <xsl:apply-templates select="d:referenced-typedef-class/compounddef"/> + </xsl:template> + + <!-- Suppress the display of several aspects of referenced typedef classes --> + + <!-- Don't show the briefdescription --> + <xsl:template match="d:referenced-typedef-class/compounddef/briefdescription"/> + + <!-- Don't show the Synopsis --> + <xsl:template mode="section" match="d:referenced-typedef-class/compounddef"/> + + <!-- Exclude the "Description" heading (only show the body) --> + <xsl:template mode="section" match="d:referenced-typedef-class/compounddef/detaileddescription"> + <xsl:apply-templates mode="section-body" select="."/> + </xsl:template> + + <!-- Don't show the includes header or footer --> + <xsl:template mode="includes" match="d:referenced-typedef-class/compounddef"/> + + + <xsl:template mode="section-body" match="memberdef[@kind eq 'enum']"> + <enum> + <xsl:apply-templates select="name"/> + </enum> + </xsl:template> + + <xsl:template mode="section-body" match="memberdef[@kind eq 'variable']"> + <variable> + <xsl:apply-templates mode="modifier" select="@static[. eq 'yes']"/> + <xsl:apply-templates select="type, name"/> + <xsl:apply-templates select="initializer[count(../initializer) eq 1]"/> + </variable> + </xsl:template> + + <xsl:template mode="section-body" match="memberdef[@kind = ('function','friend')]"> + <function> + <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> + <xsl:apply-templates mode="modifier" select="@static[. eq 'yes'], + @virt [. eq 'virtual']"/> + <xsl:apply-templates select="type, name"/> + <params> + <xsl:apply-templates select="param"/> + </params> + <xsl:apply-templates mode="modifier" select="@const[. eq 'yes']"/> + </function> + </xsl:template> + + <!-- TODO: make sure this is robust and handles all the possible cases well --> + <xsl:template mode="normalize-params" match="templateparamlist/param/type[not(../declname)] + [starts-with(.,'class ')]" + priority="1"> + <type>class</type> + <declname>{substring-after(.,'class ')}</declname> + </xsl:template> + + <xsl:template mode="normalize-params" match="templateparamlist/param/type[not(../declname)]"> + <ERROR message="param neither has a declname nor a 'class ' prefix in the type"/> + </xsl:template> + + <xsl:template mode="normalize-params" match="templateparamlist/param/defname"/> + + + <!-- We only need to keep the @file attribute --> + <xsl:template match="location/@*[. except ../@file]"/> + + <xsl:template match="briefdescription | detaileddescription"> + <div> + <xsl:apply-templates/> + </div> + </xsl:template> + + <xsl:template match="simplesect/title"/> + + <!-- TODO: verify we don't need this; it was causing duplicate headings in simplesect sections + <xsl:template match="title"> + <heading> + <xsl:apply-templates/> + </heading> + </xsl:template> + --> + + <!-- By default, don't output an includes header or footer --> + <xsl:template mode="includes" match="*"/> + + <!-- TODO: Review; this is meant to effect what the previous code did, but I'm not sure it captures the original intentions --> + <xsl:template mode="includes" match="compounddef + | memberdef[@kind eq 'friend' or ../../@kind eq 'namespace'] + [not(/doxygen/@d:page-type eq 'overload-list')]"> + <xsl:param name="is-footer"/> + <para> + <xsl:choose> + <xsl:when test="$is-footer"> + <footer> + <xsl:apply-templates select="location"/> + </footer> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="location"/> + </xsl:otherwise> + </xsl:choose> + </para> + </xsl:template> + + <!-- Strip the project namespace prefix from link display names + (matching the text node so this will still work with the strip-leading-space mode/process below) --> + <!-- TODO: figure out if we need anything like this (maybe not). + <xsl:template match="ref/text()[starts-with(.,$doc-ns)]"> + <xsl:value-of select="d:strip-doc-ns(.)"/> + </xsl:template> + --> + + + <!-- When a <para> directly contains a mix of inline nodes and block-level elements, normalize its content --> + <xsl:template match="para[&BLOCK_LEVEL_ELEMENT;]"> + <para> + <xsl:for-each-group select="* | text()" group-adjacent="d:is-inline(.)"> + <xsl:apply-templates mode="capture-ranges" select="."/> + </xsl:for-each-group> + </para> + </xsl:template> + + <xsl:function name="d:is-inline"> + <xsl:param name="node"/> + <xsl:sequence select="not($node/../(&BLOCK_LEVEL_ELEMENT;)[. is $node])"/> + </xsl:function> + + <!-- Process the block-level elements as usual --> + <xsl:template mode="capture-ranges" match="node()"> + <xsl:apply-templates select="current-group()"/> + </xsl:template> + + <!-- Wrap contiguous ranges of inline children in a nested <para> --> + <xsl:template mode="capture-ranges" match="node()[d:is-inline(.)]"> + <xsl:choose> + <!-- But only if it has text or if the group has more than one node --> + <xsl:when test="normalize-space(.) or current-group()[2]"> + <para> + <xsl:apply-templates mode="strip-leading-space" select="."/> + </para> + </xsl:when> + <xsl:otherwise> + <xsl:next-match/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + <!-- Strip leading whitespace from the nested paragraphs to prevent eventual interpretation as a code block --> + <xsl:template mode="strip-leading-space" match="*"> + <xsl:copy> + <xsl:apply-templates mode="#current" select="@* | node()[1]"/> + </xsl:copy> + <xsl:apply-templates mode="#current" select="following-sibling::node()[1] + [ancestor-or-self::node() intersect current-group()]"/> + </xsl:template> + + <xsl:template mode="strip-leading-space" match="@*"> + <xsl:copy/> + </xsl:template> + + <xsl:template mode="strip-leading-space" match="text()"> + <xsl:param name="done-stripping" tunnel="yes" select="false()"/> + <xsl:choose> + <xsl:when test="$done-stripping"> + <xsl:apply-templates select="."/> + </xsl:when> + <xsl:otherwise> + <xsl:sequence select="replace(.,'^\s+','')"/> + </xsl:otherwise> + </xsl:choose> + <xsl:apply-templates mode="#current" select="following-sibling::node()[1] + [ancestor-or-self::node() intersect current-group()]"> + <xsl:with-param name="done-stripping" select="$done-stripping or normalize-space(.)" tunnel="yes"/> + </xsl:apply-templates> + </xsl:template> + + + <xsl:template mode="#default normalize-params" match="@* | node()"> + <xsl:copy copy-namespaces="no"> + <xsl:apply-templates mode="#current" select="@* | node()"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/common.xsl b/src/boost/tools/docca/include/docca/common.xsl new file mode 100644 index 000000000..b9b02c5a6 --- /dev/null +++ b/src/boost/tools/docca/include/docca/common.xsl @@ -0,0 +1,107 @@ +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:d="http://github.com/vinniefalco/docca" + exclude-result-prefixes="xs d"> + + <xsl:variable name="nl" select="'
'"/> + + <xsl:variable name="leading-ns-regex" select="'^([^:<]+::)+'"/> + + <xsl:function name="d:extract-ns-without-suffix"> + <xsl:param name="name"/> + <xsl:sequence select="replace(d:extract-ns($name), '::$', '')"/> + </xsl:function> + + <xsl:function name="d:extract-ns"> + <xsl:param name="name"/> + <xsl:sequence select="replace($name, '('||$leading-ns-regex||').*', '$1')"/> + </xsl:function> + + <!-- Strip all C++ namespace prefixes that come at the beginning --> + <xsl:function name="d:strip-ns"> + <xsl:param name="name"/> + <xsl:sequence select="replace($name, $leading-ns-regex, '')"/> + </xsl:function> + + <!-- Strip the common C++ namespace prefix for the docs as a whole --> + <!-- ASSUMPTION: $doc-ns is defined in the customizing stylesheet --> + <xsl:function name="d:strip-doc-ns"> + <xsl:param name="name"/> + <xsl:sequence select="if ($name eq $doc-ns) + then '' + else replace($name, '^'||$doc-ns||'::', '')"/> + </xsl:function> + + <xsl:function name="d:make-id"> + <xsl:param name="name"/> + <xsl:sequence select="d:perform-replacements($name, $id-replacements)"/> + </xsl:function> + + <xsl:function name="d:perform-replacements"> + <xsl:param name="name"/> + <xsl:param name="replacements"/> + <xsl:variable name="next" select="head($replacements)"/> + <xsl:variable name="rest" select="tail($replacements)"/> + <xsl:sequence select="if (exists($next)) + then d:perform-replacements(replace($name, $next/@pattern, $next/@with), $rest) + else $name"/> + </xsl:function> + + <xsl:variable name="id-replacements" select="$additional-id-replacements, $base-id-replacements"/> + + <!-- Can be overridden by a customizing stylesheet --> + <xsl:variable name="additional-id-replacements" as="element(replace)*" select="()"/> + + <xsl:variable name="base-id-replacements" as="element(replace)+"> + <replace pattern="::" with="__"/> + <replace pattern="=" with="_eq_"/> + <replace pattern="!" with="_not_"/> + <replace pattern="->" with="_arrow_"/> + <replace pattern="<" with="_lt_"/> + <replace pattern=">" with="_gt_"/> + <replace pattern="^~" with="_dtor_"/> <!-- destructor --> + <replace pattern="~" with="_"/> + <replace pattern="\[" with="_lb_"/> + <replace pattern="\]" with="_rb_"/> + <replace pattern="\(" with="_lp_"/> + <replace pattern="\)" with="_rp_"/> + <replace pattern="\+" with="_plus_"/> + <replace pattern="-" with="_minus_"/> + <replace pattern="\*" with="_star_"/> + <replace pattern="/" with="_slash_"/> + <replace pattern=" " with="_"/> + </xsl:variable> + + <xsl:function name="d:cleanup-param"> + <xsl:param name="name"/> + <xsl:sequence select="d:perform-replacements($name, $param-replacements)"/> + </xsl:function> + + <xsl:function name="d:cleanup-type"> + <xsl:param name="name"/> + <xsl:sequence select="d:perform-replacements($name, $type-replacements)"/> + </xsl:function> + + <xsl:variable name="param-replacements" select="$additional-param-replacements, $base-param-replacements"/> + + <!-- Can be overridden by a customizing stylesheet --> + <xsl:variable name="additional-param-replacements" as="element(replace)*" select="()"/> + + <xsl:variable name="base-param-replacements" as="element(replace)*"> + <!-- Reformats '*', '&', and '...' in parameters, e.g. "void const*" --> + <replace pattern=" \*$" with="*"/> + <replace pattern=" (&&?)(\.{{3}})?$" with="$1$2"/> + </xsl:variable> + + <!-- NOTE: $type-replacements includes $param-replacements --> + <xsl:variable name="type-replacements" select="$additional-type-replacements, $base-type-replacements, $param-replacements"/> + + <!-- Can be overridden by a customizing stylesheet --> + <xsl:variable name="additional-type-replacements" as="element(replace)*" select="()"/> + + <xsl:variable name="base-type-replacements" as="element(replace)*"> + <replace pattern="^virtual$" with=""/> + </xsl:variable> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/config.xsl b/src/boost/tools/docca/include/docca/config.xsl new file mode 100644 index 000000000..bb2ce8aab --- /dev/null +++ b/src/boost/tools/docca/include/docca/config.xsl @@ -0,0 +1,47 @@ +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:d="http://github.com/vinniefalco/docca" + exclude-result-prefixes="xs d" + expand-text="yes"> + +<!-- CONFIG_TEMPLATE --> + + <xsl:variable name="additional-id-replacements" as="element(replace)*"> + <replace pattern="boost::asio::error" with=""/> + </xsl:variable> + + <xsl:variable name="additional-type-replacements" as="element(replace)*"> + <replace pattern="BOOST_ASIO_DECL ?(.*)" with="$1"/> + </xsl:variable> + + <xsl:variable name="include-private-members" select="false()"/> + + <!-- TODO: refactor the stage-two-specific rules into a separate module that can't intefere with stage one --> + <xsl:template mode="includes-template" match="location" + >Defined in header [include_file {substring-after(@file, 'include/')}] + </xsl:template> + +<!-- INCLUDES_FOOT_TEMPLATE --> + + <xsl:function name="d:should-ignore-compound"> + <xsl:param name="element" as="element(compound)"/> + <xsl:sequence select="contains($element/name, '::detail')"/> <!-- TODO: Confirm this should be custom and not built-in behavior --> + </xsl:function> + + <xsl:function name="d:should-ignore-base"> + <xsl:param name="element" as="element(basecompoundref)"/> + <xsl:sequence select="contains($element, '::detail')"/> <!-- TODO: Confirm this should be custom and not built-in behavior --> + </xsl:function> + + <xsl:function name="d:should-ignore-inner-class"> + <xsl:param name="element" as="element(innerclass)"/> + <xsl:sequence select="contains($element, '_handler')"/> + </xsl:function> + + <xsl:function name="d:should-ignore-friend"> + <xsl:param name="element" as="element(memberdef)"/> + <xsl:sequence select="contains($element, '_helper')"/> + </xsl:function> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/debug-friendly-quickbook.xsl b/src/boost/tools/docca/include/docca/debug-friendly-quickbook.xsl new file mode 100644 index 000000000..4d2cb7393 --- /dev/null +++ b/src/boost/tools/docca/include/docca/debug-friendly-quickbook.xsl @@ -0,0 +1,23 @@ +<!-- + All this stylesheet does is output a .txt file for each (erroneously-but-unavoidably-named) + .xml file that actually contains a fragment of Quickbook content. This isn't needed for the + regular build, but it's useful for viewing in the browser when debugging. +--> +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + exclude-result-prefixes="xs"> + + <xsl:output method="text"/> + + <xsl:param name="input-dir"/> + + <xsl:template match="page"> + <xsl:variable name="input-uri" select="$input-dir||'/'||@href"/> + <xsl:result-document href="{replace($input-uri, '\.xml$', '.txt')}"> + <xsl:copy-of select="unparsed-text($input-uri)"/> + </xsl:result-document> + <xsl:apply-templates select="page"/> + </xsl:template> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/emphasized-types.xsl b/src/boost/tools/docca/include/docca/emphasized-types.xsl new file mode 100644 index 000000000..e3ea174ad --- /dev/null +++ b/src/boost/tools/docca/include/docca/emphasized-types.xsl @@ -0,0 +1,43 @@ +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + exclude-result-prefixes="xs"> + + <xsl:variable name="emphasized-template-parameter-types" select=" + 'Allocator', + 'AsyncStream', + 'AsyncReadStream', + 'AsyncWriteStream', + 'Body', + 'BufferSequence', + 'BufferSequence', (: TODO: Was this intended to be 'BufferSequence_' ?? :) + 'CompletionCondition', + 'CompletionHandler', + 'CompletionToken', + 'ConnectCondition', + 'ConnectHandler', + 'ConstBufferSequence', + 'DynamicBuffer', + 'EndpointSequence', + 'ExecutionContext', + 'Executor', + 'Executor_', + 'Executor1', + 'Executor2', + 'Fields', + 'Handler', + 'Handler_', + 'IteratorConnectHandler', + 'MutableBufferSequence', + 'Protocol', + 'RangeConnectHandler', + 'RatePolicy', + 'ReadHandler', + 'Stream', + 'SyncStream', + 'SyncReadStream', + 'SyncWriteStream', + 'WriteHandler' + "/> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/extract-xml-pages.xsl b/src/boost/tools/docca/include/docca/extract-xml-pages.xsl new file mode 100644 index 000000000..cb6d1497c --- /dev/null +++ b/src/boost/tools/docca/include/docca/extract-xml-pages.xsl @@ -0,0 +1,12 @@ +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:d="http://github.com/vinniefalco/docca" + exclude-result-prefixes="xs d"> + + <xsl:import href="base-extract-xml-pages.xsl"/> + + <!-- TODO: consider refactoring to stage-specific configurations --> + <xsl:include href="config.xsl"/> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/stage1.xsl b/src/boost/tools/docca/include/docca/stage1.xsl new file mode 100644 index 000000000..ac44de5af --- /dev/null +++ b/src/boost/tools/docca/include/docca/stage1.xsl @@ -0,0 +1,11 @@ +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + exclude-result-prefixes="xs" + expand-text="yes"> + + <xsl:import href="base-stage1.xsl"/> + + <xsl:include href="config.xsl"/> + +</xsl:stylesheet> diff --git a/src/boost/tools/docca/include/docca/stage2.xsl b/src/boost/tools/docca/include/docca/stage2.xsl new file mode 100644 index 000000000..211beb438 --- /dev/null +++ b/src/boost/tools/docca/include/docca/stage2.xsl @@ -0,0 +1,228 @@ +<!DOCTYPE xsl:stylesheet [ +<!ENTITY SYNTAX_BLOCK "*[ self::compound + | self::function + | self::typedef + | self::enum + | self::variable + | self::overloaded-member + ]"> +]> +<xsl:stylesheet version="3.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:d="http://github.com/vinniefalco/docca" + expand-text="yes"> + + <xsl:output method="text"/> + + <xsl:import href="common.xsl"/> + + <xsl:include href="config.xsl"/> + <xsl:include href="emphasized-types.xsl"/> + + <xsl:param name="DEBUG" select="false()"/> + + <xsl:variable name="list-indent-width" select="4"/> + + <xsl:template mode="before" match="/page"> + <xsl:text>{$nl}</xsl:text> + <xsl:text>[section:{tokenize(@id,'\.')[last()]} {d:qb-escape(title)}]</xsl:text> + <xsl:apply-templates mode="indexterm" select="."/> + </xsl:template> + + <xsl:template mode="indexterm" match="page"/> + <xsl:template mode="indexterm" match="page[@primary-index-term]" + >{$nl}[indexterm1 {d:qb-escape(@primary-index-term)}]{$nl}</xsl:template> + <xsl:template mode="indexterm" match="page[@secondary-index-term]" priority="1" + >{$nl}[indexterm2 {d:qb-escape(@primary-index-term)}..{ + d:qb-escape(@secondary-index-term)}]{$nl}</xsl:template> + + <!-- Title is already included in section header --> + <xsl:template match="/page/title"/> + + <xsl:template match="heading">{$nl}[heading {.}]</xsl:template> + + <xsl:template match="location"> + <xsl:apply-templates mode="includes-template" select="."/> + </xsl:template> + + <xsl:template match="footer/location"> + <xsl:apply-templates mode="includes-template-footer" select="."/> + </xsl:template> + + <xsl:template mode="before" match="&SYNTAX_BLOCK;">{$nl}```{$nl}</xsl:template> + <xsl:template mode="after" match="&SYNTAX_BLOCK;">{$nl}```{$nl}</xsl:template> + + <!-- Merge adjacent overloaded-members into one syntax block, separated by one blank line --> + <xsl:template mode="after" match="overloaded-member[following-sibling::*[1]/self::overloaded-member]" priority="1"/> + <xsl:template mode="before" match="overloaded-member[preceding-sibling::*[1]/self::overloaded-member]" priority="1" + >{$nl}{$nl}</xsl:template> + + <xsl:template mode="after" match="overloaded-member/type[normalize-space(.)] + | function/type[normalize-space(.)]">{$nl}</xsl:template> + + <xsl:template mode="append" match="function">;</xsl:template> + + <xsl:template mode="append" match="overloaded-member"> + <xsl:text>;{$nl}</xsl:text> + <xsl:variable name="more-link" as="element()"> + <emphasis>'''&raquo;''' <ref d:refid="{ref/@d:refid}">more...</ref></emphasis> + </xsl:variable> + <xsl:text> ``</xsl:text> + <xsl:apply-templates select="$more-link"/> + <xsl:text>``</xsl:text> + </xsl:template> + + <xsl:template priority="1" + match="&SYNTAX_BLOCK;//ref">``[link {$doc-ref}.{@d:refid} {d:qb-escape(.)}]``</xsl:template> + <xsl:template match="td[1]//ref" >[link {$doc-ref}.{@d:refid} {d:qb-escape(.)}]</xsl:template> + <xsl:template match="ref" >[link {$doc-ref}.{@d:refid} `{d:qb-escape(.)}`]</xsl:template> + + <xsl:template mode="before" match="computeroutput[not(ref)] | code">`</xsl:template> + <xsl:template mode="after" match="computeroutput[not(ref)] | code">`</xsl:template> + + <xsl:template mode="before" match="enum/name">enum </xsl:template> + + <xsl:template mode="before" match="typedef/name">using </xsl:template> + <xsl:template mode="after" match="typedef/name"> = </xsl:template> + <xsl:template mode="after" match="typedef/type">;</xsl:template> + + <xsl:template match="type[. eq '__implementation_defined__' ]">``['implementation-defined]``</xsl:template> + <xsl:template match="type[. eq '__see_below__' ]">``['see-below]``</xsl:template> + <xsl:template match="type[. = ('__deduced__','void_or_deduced')]">``__deduced__``</xsl:template> + + <xsl:template mode="before" match="variable/name | variable/initializer">{' '}</xsl:template> + <xsl:template mode="append" match="variable">;</xsl:template> + + <xsl:template mode="after" match="compound/kind">{' '}</xsl:template> + + <xsl:template mode="before" match="base[1]"> :{$nl} </xsl:template> + <xsl:template mode="before" match="base" >{$nl} </xsl:template> + <xsl:template mode="after" match="base[position() ne last()]">,</xsl:template> + + <xsl:template mode="after" match="base/prot">{' '}</xsl:template> + + <xsl:template mode="before" match="templateparamlist">template<</xsl:template> + <xsl:template mode="after" match="templateparamlist">>{$nl}</xsl:template> + + <xsl:template mode="before" match="param">{$nl} </xsl:template> + <xsl:template mode="after" match="param[position() ne last()]">,</xsl:template> + + <xsl:template mode="after" match="param[declname]/type">{' '}</xsl:template> + + + <xsl:template mode="before" match="params">(</xsl:template> + <xsl:template mode="after" match="params">)</xsl:template> + + <xsl:template match="templateparamlist/param/declname[. = $emphasized-template-parameter-types]" + >__{translate(.,'_','')}__</xsl:template> + + <xsl:template mode="before" match="defval"> = </xsl:template> + + <xsl:template mode="before" match="modifier[. eq 'const']">{' '}</xsl:template> + <xsl:template mode="after" match="modifier[. eq 'const']"/> + + <xsl:template mode="after" match="modifier">{$nl}</xsl:template> + + + <xsl:template mode="#all" match="ERROR">[role red error.{@message}]</xsl:template> + + <xsl:template mode="before" match="table">{$nl}[table </xsl:template> + <xsl:template mode="after" match="table">{$nl}]</xsl:template> + + <!-- ASSUMPTION: table rows have either <th> or <td>, not both --> + <xsl:template mode="before" match="tr[th] | th">[</xsl:template> + <xsl:template mode="after" match="tr[th] | th">]</xsl:template> + + <xsl:template mode="before" match="tr">{$nl} [</xsl:template> + <xsl:template mode="after" match="tr">{$nl} ]</xsl:template> + + <xsl:template mode="before" match="td">{$nl} [</xsl:template> + <xsl:template mode="after" match="td">{$nl} ]</xsl:template> + + <xsl:template mode="before" match="bold">[*</xsl:template> + <xsl:template mode="after" match="bold">]</xsl:template> + + <xsl:template mode="before" match="emphasis">['</xsl:template> + <xsl:template mode="after" match="emphasis">]</xsl:template> + + <xsl:template mode="before" match="ulink">[@{@url} </xsl:template> + <xsl:template mode="after" match="ulink">]</xsl:template> + + <xsl:template mode="after" match="itemizedlist | orderedlist">{$nl}</xsl:template> + + <xsl:template match="listitem"> + <xsl:text>{$nl}</xsl:text> + <xsl:apply-templates mode="list-item-indent" select="."/> + <xsl:apply-templates mode="list-item-label" select=".."/> + <xsl:text> </xsl:text> + <!-- ASSUMPTION: <para> always appears as a child of list items --> + <xsl:apply-templates select="para/node()"/> + </xsl:template> + + <!-- TODO: verify this works as expected (find an example of a nested list) --> + <xsl:template mode="list-item-indent" + match="listitem">{ancestor::listitem ! (1 to $list-indent-width) ! ' '}</xsl:template> + + <xsl:template mode="list-item-label" match="itemizedlist">*</xsl:template> + <xsl:template mode="list-item-label" match="orderedlist" >#</xsl:template> + + <xsl:template mode="append" match="/page/div[1]"> + <xsl:if test="$DEBUG"> + <xsl:text>['</xsl:text> + <xsl:text>[role red \[Page type: [*{/*/@type}]\]] </xsl:text> + <xsl:text>[role green \[[@../../doc/html/{translate($doc-ref,'.','/')}/{ + translate(/page/@id,'.','/')}.html [role green doc_build_html]]\]] </xsl:text> + <xsl:text>[@../build/xml-pages/{/page/@id}.xml [role blue [*\[doxygen_page_xml\]]]]</xsl:text> + <xsl:text>[@../build/stage1_visualized/visualized/{/page/@id}.html [role magenta ---stage1_visualized-->]]</xsl:text> + <xsl:text>[@../build/stage1_visualized/results/{ /page/@id}.xml [role blue [*\[docca_page_xml\]]]]</xsl:text> + <xsl:text>[@../build/stage2_visualized/visualized/{/page/@id}.html [role magenta ---stage2_visualized-->]]</xsl:text> + <xsl:text>[@../build/stage2_visualized/results/{ /page/@id}.txt [role blue [*\[quickbook_result\]]]]</xsl:text> + <xsl:text>]</xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template mode="before" match="para | div">{$nl}</xsl:template> + + <xsl:template match="sp">{' '}</xsl:template> + + <xsl:template match="linebreak">{$nl}{$nl}</xsl:template> + + <xsl:template mode="before" match="programlisting">{$nl}```{$nl}</xsl:template> + <xsl:template mode="after" match="programlisting" >```{$nl}</xsl:template> + + <xsl:template mode="after" match="codeline">{$nl}</xsl:template> + + <!-- Ignore whitespace-only text nodes --> + <xsl:template match="text()[not(normalize-space())]"/> + + <!-- Boilerplate default rules for elements --> + <!-- Convention of this stylesheet is to favor use of just "before" and "after" + and to utilize "append" (and maybe "insert") only when a distinction is needed --> + <xsl:template match="*" priority="10"> + <xsl:apply-templates mode="before" select="."/> + <!-- enable if needed/desired + <xsl:apply-templates mode="insert" select="."/> --> + <xsl:next-match/> + <xsl:apply-templates mode="append" select="."/> + <xsl:apply-templates mode="after" select="."/> + </xsl:template> + + <!-- Default before/after/insert/append rules are to do nothing --> + <xsl:template mode="before" match="*"/> + <!-- enable if needed/desired + <xsl:template mode="insert" match="*"/> --> + <xsl:template mode="append" match="*"/> + <xsl:template mode="after" match="*"/> + + + <xsl:function name="d:qb-escape"> + <xsl:param name="string"/> + <xsl:sequence select="replace( + replace($string, '\[', '\\['), + '\]', + '\\]' + )"/> + </xsl:function> + +</xsl:stylesheet> |