diff options
| author | Martin Smith <martin.smith@digia.com> | 2012-11-06 13:44:35 +0100 |
|---|---|---|
| committer | Martin Smith <martin.smith@digia.com> | 2012-11-06 14:09:59 +0100 |
| commit | 2efbf2dbbe1ff65c0624ba05a432d0e0e4a7d92f (patch) | |
| tree | 8c698bf1660c7e40a5b12e5452d403fe7c3f505d /src/tools/qdoc/qdocindexfiles.cpp | |
| parent | c808dd27459e030fde0577feb8ba06e3bd465526 (diff) | |
qdoc: Added module attribute to most index elements
The index file generated by qdoc when it is run in
-prepare mode has been modified so that most elements
have a module attribute. The value of the module
attribute either came from an \inmodule command, or
it is the value of the project variable specified in
the qdocconf file that was read by qdoc.
Task number: QTBUG-27626
Change-Id: I44198bbbc1738fafc110c6b905eb1d67bc745323
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src/tools/qdoc/qdocindexfiles.cpp')
| -rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 14dfa334ae1..3f79675b3bc 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -435,7 +435,9 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, else section->setStatus(Node::Commendable); - section->setModuleName(element.attribute("module")); + QString moduleName = element.attribute("module"); + if (!moduleName.isEmpty()) + section->setModuleName(moduleName); if (!indexUrl.isEmpty()) { section->setUrl(indexUrl + QLatin1Char('/') + href); } @@ -660,11 +662,13 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, baseStrings.insert(baseClassNode->name()); } writer.writeAttribute("bases", QStringList(baseStrings.toList()).join(",")); - writer.writeAttribute("module", node->moduleName()); + if (!node->moduleName().isEmpty()) + writer.writeAttribute("module", node->moduleName()); } break; case Node::Namespace: - writer.writeAttribute("module", node->moduleName()); + if (!node->moduleName().isEmpty()) + writer.writeAttribute("module", node->moduleName()); break; case Node::Document: { @@ -672,25 +676,30 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, Document nodes (such as manual pages) contain subtypes, titles and other attributes. */ + bool writeModuleName = false; const DocNode* docNode = static_cast<const DocNode*>(node); switch (docNode->subType()) { case Node::Example: writer.writeAttribute("subtype", "example"); + writeModuleName = true; break; case Node::HeaderFile: writer.writeAttribute("subtype", "header"); + writeModuleName = true; break; case Node::File: writer.writeAttribute("subtype", "file"); break; case Node::Group: writer.writeAttribute("subtype", "group"); + writeModuleName = true; break; case Node::Module: writer.writeAttribute("subtype", "module"); break; case Node::Page: writer.writeAttribute("subtype", "page"); + writeModuleName = true; break; case Node::ExternalPage: writer.writeAttribute("subtype", "externalpage"); @@ -708,6 +717,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("fulltitle", docNode->fullTitle()); writer.writeAttribute("subtitle", docNode->subTitle()); writer.writeAttribute("location", docNode->doc().location().fileName()); + if (!node->moduleName().isEmpty() && writeModuleName) { + writer.writeAttribute("module", node->moduleName()); + } } break; case Node::Function: |
