diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-02-18 20:03:20 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-18 20:03:20 +0100 |
commit | 3654a4a3c1cb2ac9bb8b486877d9f1e6a6b220be (patch) | |
tree | 611c16caa5096bd1348f188c9072354f1e613a9f /src/tools/qdoc/htmlgenerator.cpp | |
parent | c04f3584abd621f09e8f2c81b9c6c87212a993a3 (diff) | |
parent | f4900d340a4c620b56871995741696d28e53c167 (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/tools/qdoc/htmlgenerator.cpp')
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 8052558dc6..2666f10eb4 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -223,6 +223,7 @@ void HtmlGenerator::initializeGenerator(const Config &config) QString prefix = CONFIG_QHP + Config::dot + project + Config::dot; manifestDir = "qthelp://" + config.getString(prefix + "namespace"); manifestDir += QLatin1Char('/') + config.getString(prefix + "virtualFolder") + QLatin1Char('/'); + readManifestMetaContent(config); examplesPath = config.getString(CONFIG_EXAMPLESINSTALLPATH); if (!examplesPath.isEmpty()) examplesPath += QLatin1Char('/'); @@ -3869,7 +3870,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* qcn, CodeMarker* mar { if (!qcn) return; - const DocNode* base = qcn->qmlBase(); + const DocNode* base = qcn->qmlBaseNode(); if (base) { Text text; text << Atom::ParaLeft << "Inherits "; @@ -3991,10 +3992,11 @@ void HtmlGenerator::generateManifestFiles() generateManifestFile("examples", "example"); generateManifestFile("demos", "demo"); ExampleNode::exampleNodeMap.clear(); + manifestMetaContent.clear(); } /*! - This function is called by generaqteManiferstFile(), once + This function is called by generateManifestFiles(), once for each manifest file to be generated. \a manifest is the type of manifest file. */ @@ -4086,6 +4088,36 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) } if (!en->imageFileName().isEmpty()) writer.writeAttribute("imageUrl", manifestDir + en->imageFileName()); + + QString fullName = project + QLatin1Char('/') + en->title(); + QSet<QString> tags; + for (int idx=0; idx < manifestMetaContent.size(); ++idx) { + foreach (const QString &name, manifestMetaContent[idx].names) { + bool match = false; + int wildcard = name.indexOf(QChar('*')); + switch (wildcard) { + case -1: // no wildcard, exact match + match = (fullName == name); + break; + case 0: // '*' matches all + match = true; + break; + default: // match with wildcard at the end + match = fullName.startsWith(name.left(wildcard)); + } + if (match) { + tags += manifestMetaContent[idx].tags; + foreach (const QString &attr, manifestMetaContent[idx].attributes) { + QStringList attrList = attr.split(QLatin1Char(':'), QString::SkipEmptyParts); + if (attrList.count() == 1) + attrList.append(QStringLiteral("true")); + if (attrList.count() == 2) + writer.writeAttribute(attrList[0], attrList[1]); + } + } + } + } + writer.writeStartElement("description"); Text brief = en->doc().briefText(); if (!brief.isEmpty()) @@ -4093,12 +4125,11 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) else writer.writeCDATA(QString("No description available")); writer.writeEndElement(); // description - QStringList tags = en->title().toLower().split(QLatin1Char(' ')); + tags += QSet<QString>::fromList(en->title().toLower().split(QLatin1Char(' '))); if (!tags.isEmpty()) { writer.writeStartElement("tags"); bool wrote_one = false; - for (int n=0; n<tags.size(); ++n) { - QString tag = tags.at(n); + foreach (QString tag, tags) { if (tag.at(0).isDigit()) continue; if (tag.at(0) == '-') @@ -4109,7 +4140,7 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) continue; if (tag.endsWith(QLatin1Char(':'))) tag.chop(1); - if (n>0 && wrote_one) + if (wrote_one) writer.writeCharacters(","); writer.writeCharacters(tag); wrote_one = true; @@ -4163,6 +4194,25 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) } /*! + Reads metacontent - additional attributes and tags to apply + when generating manifest files, read from config. Takes the + configuration class \a config as a parameter. + */ +void HtmlGenerator::readManifestMetaContent(const Config &config) +{ + QStringList names = config.getStringList(CONFIG_MANIFESTMETA + Config::dot + QStringLiteral("filters")); + + foreach (const QString &manifest, names) { + ManifestMetaFilter filter; + QString prefix = CONFIG_MANIFESTMETA + Config::dot + manifest + Config::dot; + filter.names = config.getStringSet(prefix + QStringLiteral("names")); + filter.attributes = config.getStringSet(prefix + QStringLiteral("attributes")); + filter.tags = config.getStringSet(prefix + QStringLiteral("tags")); + manifestMetaContent.append(filter); + } +} + +/*! Find global entities that have documentation but no \e{relates} comand. Report these as errors if they are not also marked \e {internal}. |