summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/ditaxmlgenerator.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2014-07-30 13:44:15 +0200
committerMartin Smith <martin.smith@digia.com>2014-08-22 18:23:39 +0200
commita5570bbf9af05fa33cfcc9f167786e8d2ca1e32e (patch)
tree40749767c38c88e6a52f66572664df5df61ab908 /src/tools/qdoc/ditaxmlgenerator.cpp
parent701b72c261922a2f96e3433f1f82646b1b339ff0 (diff)
qdoc: Remove all collision node stuff from qdoc
Now that the qdoc link command has ability to tell qdoc which module contains a link target or whether to link to a QML or CPP entity, collision pages should no longer be necessary. In fact, qdoc hasn't been generating any collisions for some time. This task removes all the collision node code from qdoc. Task-number: QTBUG-40506 Change-Id: I34d1980ca1c0fe4bb5ad27dd4b00e61fa7e6e335 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/tools/qdoc/ditaxmlgenerator.cpp')
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.cpp171
1 files changed, 11 insertions, 160 deletions
diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp
index 83d89d0187..9cc44d7000 100644
--- a/src/tools/qdoc/ditaxmlgenerator.cpp
+++ b/src/tools/qdoc/ditaxmlgenerator.cpp
@@ -671,10 +671,8 @@ GuidMap* DitaXmlGenerator::lookupGuidMap(const QString& fileName)
*/
void DitaXmlGenerator::generateDocs()
{
- if (!runPrepareOnly()) {
+ if (!runPrepareOnly())
Generator::generateDocs();
- generateCollisionPages();
- }
if (!runGenerateOnly()) {
QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-'));
@@ -2275,10 +2273,6 @@ void DitaXmlGenerator::generateDocNode(DocNode* dn, CodeMarker* marker)
QList<Section>::const_iterator s;
QString fullTitle = dn->fullTitle();
- if (dn->subType() == Node::Collision) {
- fullTitle = "Name Collision: " + fullTitle;
- }
-
generateHeader(dn, fullTitle);
generateBrief(dn, marker); // <shortdesc>
writeProlog(dn);
@@ -2553,9 +2547,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name)
case Node::ExternalPage: // not used
outputclass = "externalpage";
break;
- case Node::Collision:
- outputclass = "collision";
- break;
default:
outputclass = "page";
}
@@ -5277,27 +5268,16 @@ DitaXmlGenerator::generateInnerNode(InnerNode* node)
*/
CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath());
if (node->parent() != 0) {
- /*
- Skip name collision nodes here and process them
- later in generateCollisionPages(). Each one is
- appended to a list for later.
- */
- if (node->isCollisionNode()) {
- NameCollisionNode* ncn = static_cast<NameCollisionNode*>(node);
- collisionNodes.append(const_cast<NameCollisionNode*>(ncn));
- }
- else {
- if (!node->name().endsWith(".ditamap"))
- beginSubPage(node, fileName(node));
- if (node->isNamespace() || node->isClass() || node->isQmlType() || node->isHeaderFile())
- generateClassLikeNode(node, marker);
- else if (node->isDocNode())
- generateDocNode(static_cast<DocNode*>(node), marker);
- else if (node->isQmlBasicType())
- generateQmlBasicTypePage(static_cast<QmlBasicTypeNode*>(node), marker);
- if (!node->name().endsWith(".ditamap"))
- endSubPage();
- }
+ if (!node->name().endsWith(".ditamap"))
+ beginSubPage(node, fileName(node));
+ if (node->isNamespace() || node->isClass() || node->isQmlType() || node->isHeaderFile())
+ generateClassLikeNode(node, marker);
+ else if (node->isDocNode())
+ generateDocNode(static_cast<DocNode*>(node), marker);
+ else if (node->isQmlBasicType())
+ generateQmlBasicTypePage(static_cast<QmlBasicTypeNode*>(node), marker);
+ if (!node->name().endsWith(".ditamap"))
+ endSubPage();
}
NodeList::ConstIterator c = node->childNodes().constBegin();
@@ -5363,13 +5343,6 @@ Node* DitaXmlGenerator::collectNodesByTypeAndSubtype(const InnerNode* parent)
QString message;
for (int i=0; i<children.size(); ++i) {
Node* child = children[i];
- if (child->isCollisionNode()) {
- const DocNode* fake = static_cast<const DocNode*>(child);
- Node* n = collectNodesByTypeAndSubtype(fake);
- if (n)
- rootPageNode = n;
- continue;
- }
if (!child || child->isInternal() || child->doc().isEmpty() || child->isIndexNode())
continue;
@@ -5428,10 +5401,6 @@ Node* DitaXmlGenerator::collectNodesByTypeAndSubtype(const InnerNode* parent)
if (!isDuplicate(nodeSubtypeMaps[Node::ExternalPage],child->title(),child))
nodeSubtypeMaps[Node::ExternalPage]->insert(child->title(),child);
break;
- case Node::Collision:
- if (!isDuplicate(nodeSubtypeMaps[Node::Collision],child->title(),child))
- nodeSubtypeMaps[Node::Collision]->insert(child->title(),child);
- break;
default:
break;
}
@@ -6029,122 +5998,4 @@ QString DitaXmlGenerator::stripMarkup(const QString& src) const
return text;
}
-/*!
- We delayed generation of the collision pages until now, after
- all the other pages have been generated. We do this because we might
- encounter a link command that tries to link to a target on a QML
- type page, but the link doesn't specify the module identifer
- for the QML type, and the QML type name without a module
- identifier is ambiguous. When such a link is found, qdoc can't find
- the target, so it appends the target to the NameCollisionNode. After
- the tree has been traversed and all these ambiguous links have been
- added to the name collision nodes, this function is called. The list
- of collision nodes is traversed here, and the collision page for
- each collision is generated. The collision page will not only
- disambiguate links to the QML type pages, but it will also disambiguate
- links to properties, section headers, etc.
- */
-void DitaXmlGenerator::generateCollisionPages()
-{
- if (collisionNodes.isEmpty())
- return;
-
- for (int i=0; i<collisionNodes.size(); ++i) {
- NameCollisionNode* ncn = collisionNodes.at(i);
- if (!ncn)
- continue;
-
- NodeList collisions;
- const NodeList& nl = ncn->childNodes();
- if (!nl.isEmpty()) {
- NodeList::ConstIterator it = nl.constBegin();
- while (it != nl.constEnd()) {
- if (!(*it)->isInternal())
- collisions.append(*it);
- ++it;
- }
- }
- if (collisions.size() <= 1)
- continue;
-
- beginSubPage(ncn, Generator::fileName(ncn));
- QString fullTitle = ncn->fullTitle();
- QString ditaTitle = fullTitle;
- CodeMarker* marker = CodeMarker::markerForFileName(ncn->location().filePath());
- if (ncn->isQmlNode()) {
- // Replace the marker with a QML code marker.
- if (ncn->isQmlNode())
- marker = CodeMarker::markerForLanguage(QLatin1String("QML"));
- }
-
- generateHeader(ncn, ditaTitle);
- writeProlog(ncn);
- writeStartTag(DT_body);
- enterSection(QString(), QString());
-
- NodeMap nm;
- for (int i=0; i<collisions.size(); ++i) {
- Node* n = collisions.at(i);
- QString t;
- if (!n->qmlModuleName().isEmpty())
- t = n->qmlModuleName() + QLatin1Char(' ');
- t += protectEnc(fullTitle);
- nm.insertMulti(t,n);
- }
- generateAnnotatedList(ncn, marker, nm);
-
- QList<QString> targets;
- if (!ncn->linkTargets().isEmpty()) {
- QMap<QString,QString>::ConstIterator t = ncn->linkTargets().constBegin();
- while (t != ncn->linkTargets().constEnd()) {
- int count = 0;
- for (int i=0; i<collisions.size(); ++i) {
- InnerNode* n = static_cast<InnerNode*>(collisions.at(i));
- if (n->findChildNode(t.key(), Node::DontCare)) {
- ++count;
- if (count > 1) {
- targets.append(t.key());
- break;
- }
- }
- }
- ++t;
- }
- }
- if (!targets.isEmpty()) {
- QList<QString>::ConstIterator t = targets.constBegin();
- while (t != targets.constEnd()) {
- writeStartTag(DT_p);
- writeGuidAttribute(Doc::canonicalTitle(*t));
- xmlWriter().writeAttribute("outputclass","h2");
- writeCharacters(protectEnc(*t));
- writeEndTag(); // </p>
- writeStartTag(DT_ul);
- for (int i=0; i<collisions.size(); ++i) {
- InnerNode* n = static_cast<InnerNode*>(collisions.at(i));
- Node* p = n->findChildNode(*t, Node::DontCare);
- if (p) {
- QString link = linkForNode(p,0);
- QString label;
- if (!n->qmlModuleName().isEmpty())
- label = n->qmlModuleName() + "::";
- label += n->name() + "::" + p->name();
- writeStartTag(DT_li);
- writeStartTag(DT_xref);
- xmlWriter().writeAttribute("href", link);
- writeCharacters(protectEnc(label));
- writeEndTag(); // </xref>
- writeEndTag(); // </li>
- }
- }
- writeEndTag(); // </ul>
- ++t;
- }
- }
- leaveSection(); // </section>
- writeEndTag(); // </body>
- endSubPage();
- }
-}
-
QT_END_NAMESPACE