summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2016-06-29 17:03:26 +0200
committerKai Koehne <kai.koehne@qt.io>2016-08-08 11:47:20 +0000
commitd3f3e98ee39f03d15d15ca664a104c1238ecf0c4 (patch)
tree9ee908aa8ed591f04f819128f32db9b35f95b71b /src
parentacb38b386969a9e03faa117fabc6c82e59003de5 (diff)
downloadqttools-d3f3e98ee39f03d15d15ca664a104c1238ecf0c4.tar.gz
qdoc: Add support for attribution pages
"\page xx attribution" now marks a page as describing a code attribution, and \generatelist{attributions} generates an overview of all attribution pages. Originally code attributions were meant to be handled by \legalese ... \endlegalese and \generatelist{legalese}. Anyhow, this fails giving more details than the pure license text. Change-Id: I3543f077051b361ce59fe27e50f9719dfa52ced3 Reviewed-by: Topi Reiniƶ <topi.reinio@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/qdoc/cppcodeparser.cpp2
-rw-r--r--src/qdoc/doc/qdoc-manual-markupcmds.qdoc17
-rw-r--r--src/qdoc/htmlgenerator.cpp8
-rw-r--r--src/qdoc/node.cpp2
-rw-r--r--src/qdoc/node.h2
-rw-r--r--src/qdoc/qdocdatabase.cpp31
-rw-r--r--src/qdoc/qdocdatabase.h3
7 files changed, 65 insertions, 0 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 5b7792d32..f985226dd 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -522,6 +522,8 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
ptype = Node::FAQPage;
else if (t == "ditamap")
ptype = Node::DitaMapPage;
+ else if (t == "attribution")
+ ptype = Node::AttributionPage;
}
DocumentNode* dn = 0;
if (ptype == Node::DitaMapPage)
diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc
index 2b78aef4e..edd64b741 100644
--- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc
+++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc
@@ -3408,6 +3408,18 @@
navigation.landingpage configuration variable. The \e landingpage
variable is used as a title for a header that precedes each table.
+ \section2 \c annotatedattributions
+
+ The \c annotatedattributions argument provides a complete list of all
+ attributions as a set of tables containing the titles of all the
+ attributions, and a description of each attribution. Each title is a
+ link to the attribution's page.
+
+ A separate table for each module (that has attributions)
+ is generated, provided that the module has defined a
+ navigation.landingpage configuration variable. The \e landingpage
+ variable is used as a title for a header that precedes each table.
+
\target list example
\section2 \c {classes <prefix>}
@@ -3586,6 +3598,11 @@
* /
\endcode
+ \section2 \c attributions
+
+ The \c attributions argument is used to tell QDoc to generate a list
+ of attributions in the documentation.
+
\section2 \c related
The \c related argument is used in combination with the \l
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index b358c9f6e..5f7c9edab 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -684,6 +684,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
else if (atom->string() == QLatin1String("annotatedexamples")) {
generateAnnotatedLists(relative, marker, qdb_->getExamples());
}
+ else if (atom->string() == QLatin1String("annotatedattributions")) {
+ generateAnnotatedLists(relative, marker, qdb_->getAttributions());
+ }
else if (atom->string() == QLatin1String("classes")) {
generateCompactList(Generic, relative, qdb_->getCppClasses(), true, QStringLiteral(""));
}
@@ -704,6 +707,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
genus = Node::QML;
else if (atom->string().startsWith(QLatin1String("js")))
genus = Node::JS;
+ else if (atom->string().startsWith(QLatin1String("groups")))
+ genus = Node::DOC;
QDocDatabase* qdb = QDocDatabase::qdocDB();
const CollectionNode* cn = qdb->getCollectionNode(moduleName, genus);
if (cn) {
@@ -736,6 +741,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
else if (atom->string() == QLatin1String("functionindex")) {
generateFunctionIndex(relative);
}
+ else if (atom->string() == QLatin1String("attributions")) {
+ generateAnnotatedList(relative, marker, qdb_->getAttributions());
+ }
else if (atom->string() == QLatin1String("legalese")) {
generateLegaleseList(relative, marker);
}
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 33bcae4fa..3adaf207a 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -379,6 +379,8 @@ QString Node::pageTypeString() const
QString Node::pageTypeString(unsigned char t)
{
switch ((PageType)t) {
+ case Node::AttributionPage:
+ return "attribution";
case Node::ApiPage:
return "api";
case Node::ArticlePage:
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index 4b3549961..b30182cdd 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -92,6 +92,7 @@ public:
enum DocSubtype {
NoSubtype,
+ Attribution,
Example,
HeaderFile,
File,
@@ -133,6 +134,7 @@ public:
enum PageType {
NoPageType,
+ AttributionPage,
ApiPage,
ArticlePage,
ExamplePage,
diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp
index 09471c6e3..63564bd4b 100644
--- a/src/qdoc/qdocdatabase.cpp
+++ b/src/qdoc/qdocdatabase.cpp
@@ -955,6 +955,18 @@ NodeMultiMap& QDocDatabase::getExamples()
}
/*!
+ Construct the data structures for attributions, if they
+ have not already been constructed. Returns a reference to
+ the multimap of attribution nodes.
+ */
+NodeMultiMap& QDocDatabase::getAttributions()
+{
+ if (attributions_.isEmpty())
+ processForest(&QDocDatabase::findAllAttributions);
+ return attributions_;
+}
+
+/*!
Construct the data structures for obsolete things, if they
have not already been constructed. Returns a reference to
the map of obsolete C++ clases.
@@ -1055,6 +1067,25 @@ void QDocDatabase::findAllFunctions(Aggregate* node)
}
/*!
+ Finds all the attribution pages and collects them per module
+ */
+void QDocDatabase::findAllAttributions(Aggregate* node)
+{
+ NodeList::ConstIterator c = node->childNodes().constBegin();
+ while (c != node->childNodes().constEnd()) {
+ if ((*c)->access() != Node::Private) {
+ if ((*c)->docSubtype() == Node::Page
+ && (*c)->pageType() == Node::AttributionPage) {
+ attributions_.insertMulti((*c)->tree()->indexTitle(), *c);
+ } else if ((*c)->isAggregate()) {
+ findAllAttributions(static_cast<Aggregate*>(*c));
+ }
+ }
+ ++c;
+ }
+}
+
+/*!
Finds all the nodes containing legalese text and puts them
in a map.
*/
diff --git a/src/qdoc/qdocdatabase.h b/src/qdoc/qdocdatabase.h
index 8b1184853..e65dfd0bf 100644
--- a/src/qdoc/qdocdatabase.h
+++ b/src/qdoc/qdocdatabase.h
@@ -263,6 +263,7 @@ class QDocDatabase
private:
void findAllClasses(Aggregate *node);
void findAllFunctions(Aggregate *node);
+ void findAllAttributions(Aggregate *node);
void findAllLegaleseTexts(Aggregate *node);
void findAllNamespaces(Aggregate *node);
void findAllObsoleteThings(Aggregate* node);
@@ -281,6 +282,7 @@ class QDocDatabase
NodeMultiMap& getQmlBasicTypes();
NodeMultiMap& getQmlTypes();
NodeMultiMap& getExamples();
+ NodeMultiMap& getAttributions();
NodeMapMap& getFunctionIndex();
TextToNodeMap& getLegaleseTexts();
const NodeMap& getClassMap(const QString& key);
@@ -450,6 +452,7 @@ class QDocDatabase
NodeMultiMap qmlBasicTypes_;
NodeMultiMap qmlTypes_;
NodeMultiMap examples_;
+ NodeMultiMap attributions_;
NodeMapMap newClassMaps_;
NodeMapMap newQmlTypeMaps_;
NodeMultiMapMap newSinceMaps_;