summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/htmlgenerator.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@digia.com>2015-06-16 14:10:51 +0200
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2015-06-17 16:55:40 +0000
commit997f52b83d41d2ed31a3b36384d1dd3bc78a697c (patch)
tree06084a7ca32fbb97da3e93b5183d9e01eb3c7069 /src/tools/qdoc/htmlgenerator.cpp
parent0e8d657ae05aeab25aa261a88bbdc9aa21ac0e0d (diff)
qdoc: Keep track of attributes written to example manifest files
The content written to example manifest files can be extended with additional metadata in the form of xml attributes. In order to avoid invalid (duplicated) input from generating malformed xml, QDoc now keeps track of the attributes and only writes metadata that hasn't already been written. Task-number: QTBUG-46692 Change-Id: I645935fa8f32b915b7335c400f5a8f2cf72802b7 Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/htmlgenerator.cpp')
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 8d84019ab5..21fffdabc3 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -4456,6 +4456,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
writer.writeAttribute("module", project);
writer.writeStartElement(manifest);
+ QStringList usedAttributes;
i = exampleNodeMap.begin();
while (i != exampleNodeMap.end()) {
const ExampleNode* en = i.value();
@@ -4469,6 +4470,10 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
++i;
continue;
}
+ // attributes that are always written for the element
+ usedAttributes.clear();
+ usedAttributes << "name" << "docUrl" << "projectPath";
+
writer.writeStartElement(element);
writer.writeAttribute("name", en->title());
QString docUrl = manifestDir + fileBase(en) + ".html";
@@ -4502,8 +4507,10 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
writer.writeAttribute("projectPath", examplesPath + proFiles[0]);
}
}
- if (!en->imageFileName().isEmpty())
+ if (!en->imageFileName().isEmpty()) {
writer.writeAttribute("imageUrl", manifestDir + en->imageFileName());
+ usedAttributes << "imageUrl";
+ }
QString fullName = project + QLatin1Char('/') + en->title();
QSet<QString> tags;
@@ -4529,7 +4536,10 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString
if (attrList.count() == 1)
attrList.append(QStringLiteral("true"));
QString attrName = attrList.takeFirst();
- writer.writeAttribute(attrName, attrList.join(div));
+ if (!usedAttributes.contains(attrName)) {
+ writer.writeAttribute(attrName, attrList.join(div));
+ usedAttributes << attrName;
+ }
}
}
}