|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82443 - sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk
From: adam.wulkiewicz_at_[hidden]
Date: 2013-01-10 20:07:39
Author: awulkiew
Date: 2013-01-10 20:07:38 EST (Thu, 10 Jan 2013)
New Revision: 82443
URL: http://svn.boost.org/trac/boost/changeset/82443
Log:
doxygen_xml2qbk moddified.
Paragraphs and precondition are no longer stored in qbk_markups - stored in separate members.
Added support for bold, verbatim, emphasis, computeroutput.
Text files modified:
sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp | 9 +++++
sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp | 71 +++++++++++++++++++++++++--------------
sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp | 36 ++++++++++++++++---
3 files changed, 84 insertions(+), 32 deletions(-)
Modified: sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp
==============================================================================
--- sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp (original)
+++ sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_elements.hpp 2013-01-10 20:07:38 EST (Thu, 10 Jan 2013)
@@ -85,6 +85,12 @@
}
};
+struct paragraph
+{
+ std::string title;
+ std::string text;
+};
+
// Base of a class/struct, function, define
struct element : public base_element
{
@@ -103,6 +109,8 @@
std::vector<parameter> template_parameters;
std::vector<parameter> parameters;
+ std::vector<paragraph> paragraphs;
+
element()
: line(0)
{}
@@ -114,6 +122,7 @@
function_type type;
std::string definition, argsstring;
std::string return_type, return_description;
+ std::string precondition;
bool unique;
Modified: sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp
==============================================================================
--- sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp (original)
+++ sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/doxygen_xml_parser.hpp 2013-01-10 20:07:38 EST (Thu, 10 Jan 2013)
@@ -77,28 +77,56 @@
}
else if ( boost::equals(name, "itemizedlist") )
{
- contents += "\n\n";
+ contents += "\n";
parse_para(node->first_node(), contents, skip);
- contents += "\n[/]";
+ contents += "\n";
parse_para(node->next_sibling(), contents, skip);
return;
}
else if ( boost::equals(name, "listitem") )
{
contents += "* ";
- rapidxml::xml_node<>* li = node->first_node("para");
- contents += li ? li->value() : "";
+ parse_para(node->first_node(), contents, skip);
contents += "\n";
- parse_para(node->next_sibling(), contents, skip);
+ parse_para(node->next_sibling(), contents, skip);
+ return;
+ }
+ else if ( boost::equals(name, "verbatim") )
+ {
+ contents += "\n``\n";
+ parse_para(node->first_node(), contents, skip, false);
+ contents += "``\n";
+ parse_para(node->next_sibling(), contents, skip, false);
+ return;
+ }
+ else if ( boost::equals(name, "bold") )
+ {
+ contents += "[*";
+ parse_para(node->first_node(), contents, skip, false);
+ contents += "]";
+ parse_para(node->next_sibling(), contents, skip, false);
+ return;
+ }
+ else if ( boost::equals(name, "emphasis") )
+ {
+ contents += "['";
+ parse_para(node->first_node(), contents, skip, false);
+ contents += "]";
+ parse_para(node->next_sibling(), contents, skip, false);
+ return;
+ }
+ else if ( boost::equals(name, "computeroutput") )
+ {
+ contents += "[^";
+ parse_para(node->first_node(), contents, skip, false);
+ contents += "]";
+ parse_para(node->next_sibling(), contents, skip, false);
return;
}
else if (! (
(boost::equals(name, "para") && first)
|| boost::equals(name, "ref")
|| boost::equals(name, "defval")
- || boost::equals(name, "verbatim")
- || boost::equals(name, "bold")
- || boost::equals(name, "emphasis")
|| boost::equals(name, "linebreak")
))
{
@@ -364,26 +392,15 @@
std::string kind = get_attribute(node, "kind");
if (kind == "par")
{
+ paragraph p;
+
rapidxml::xml_node<> * title_node = node->first_node("title");
- std::string title = title_node ? title_node->value() : "";
-
- std::string m;
if ( title_node )
- m = std::string("[heading ") + title + "]\n";
- else
- m = "\n\n";
+ p.title = title_node->value();
- parse_para(node->first_node("para"), m, el.skip);
- m += "\n";
-
- el.qbk_markup.push_back(markup(m));
- }
- else if (kind == "pre")
- {
- std::string para;
- parse_para(node->first_node("para"), para, el.skip);
+ parse_para(node->first_node("para"), p.text, el.skip);
- el.qbk_markup.push_back(markup(std::string("[heading Precondition]\n") + para));
+ el.paragraphs.push_back(p);
}
}
else if (full == ".param")
@@ -432,12 +449,16 @@
std::string kind = get_attribute(node, "kind");
if (kind == "return")
{
- get_contents(node->first_node(), f.return_description);
+ parse_para(node->first_node(), f.return_description, f.skip);
}
/*else if (kind == "param")
{
get_contents(node->first_node(), f.paragraphs);
}*/
+ else if (kind == "pre")
+ {
+ parse_para(node->first_node(), f.precondition, f.skip);
+ }
}
else if (full == ".detaileddescription.para.image")
{
Modified: sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp
==============================================================================
--- sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp (original)
+++ sandbox-branches/geometry/index/doc/src/tools/doxygen_xml2qbk/quickbook_output.hpp 2013-01-10 20:07:38 EST (Thu, 10 Jan 2013)
@@ -741,7 +741,7 @@
out << "`";
if ( !config.index_id_path.empty() )
out << "]";
- out << "][" << replace_brackets(f.brief_description) << "]]" << std::endl;
+ out << "][" << f.brief_description << "]]" << std::endl;
}
}
out << "]" << std::endl
@@ -763,7 +763,7 @@
// Section
std::stringstream ss;
quickbook_synopsis_short(f, ss);
- out << "[section:" << qbk_id_prefix << i << " " << replace_brackets(ss.str()) << "]" << std::endl;
+ out << "[section:" << qbk_id_prefix << i << " " << replace_brackets(ss.str()) << "]" << std::endl;
// Brief description
out << f.brief_description << std::endl;
@@ -785,18 +785,26 @@
// Parameters
if ( !f.parameters.empty() )
{
- out << "[heading Parameters]" << std::endl;
+ out << "[heading Parameter(s)]" << std::endl;
out << "[table " << std::endl;
out << "[[Type][Name][Description]]" << std::endl;
BOOST_FOREACH(parameter const& p, f.parameters)
{
if (!p.skip)
{
- out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << replace_brackets(p.brief_description) << "]]"<< std::endl;
+ out << "[[ `" << p.fulltype << "` ][ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl;
}
}
out << "]" << std::endl;
- }
+ }
+
+ // Precondition
+ if ( !f.precondition.empty() )
+ {
+ out << "[heading Precondition(s)]" << std::endl;
+ out << f.precondition << std::endl;
+ out << std::endl;
+ }
// Return
if ( !f.return_description.empty() )
@@ -804,6 +812,20 @@
out << "[heading Returns]" << std::endl;
out << f.return_description << std::endl;
}
+
+ // Additional paragraphs
+ if ( !f.paragraphs.empty() )
+ {
+ BOOST_FOREACH(paragraph const& p, f.paragraphs)
+ {
+ if ( !p.title.empty() )
+ out << "[heading " << p.title << "]" << std::endl;
+ else
+ out << "\n\n" << std::endl;
+ out << p.text << std::endl;
+ out << std::endl;
+ }
+ }
// QBK markup
quickbook_markup(f.qbk_markup, markup_any, markup_default, out);
@@ -942,7 +964,7 @@
out << p.fulltype.substr(6);
else
out << p.fulltype;
- out << "`][" << replace_brackets(p.brief_description) << "]]" << std::endl;
+ out << "`][" << p.brief_description << "]]" << std::endl;
}
out << "]" << std::endl
<< std::endl;
@@ -966,7 +988,7 @@
continue;
out << "[[`" << e.name;
- out << "`][" << replace_brackets(e.brief_description) << "]]" << std::endl;
+ out << "`][" << e.brief_description << "]]" << std::endl;
}
out << "]" << std::endl
<< std::endl;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk