qdoc: Include words from the module name as tags in example manifest
This change adds words from the module name (QHP 'project' name defined in .qdocconf files) as tags for the module's examples. This makes searching for examples easier in Qt Creator: For example, typing 'multimedia' will list all examples in Qt Multimedia and Qt Multimedia Widgets modules. Other minor changes: - Exclude 'qt' as a tag (not needed) - Exclude one-character strings as tags Task-number: QTBUG-28720 Change-Id: I53751b7a87ff39ee7b648f865c9090c52444de76 Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
parent
e9b2d029f9
commit
8597458ceb
@ -4182,15 +4182,28 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
|
||||
else
|
||||
writer.writeCDATA(QString("No description available"));
|
||||
writer.writeEndElement(); // description
|
||||
|
||||
// Add words from module name as tags (QtQuickControls -> qt,quick,controls)
|
||||
QRegExp re("([A-Z][a-z0-9]+)");
|
||||
int pos = 0;
|
||||
while ((pos = re.indexIn(project, pos)) != -1) {
|
||||
tags << re.cap(1).toLower();
|
||||
pos += re.matchedLength();
|
||||
}
|
||||
tags += QSet<QString>::fromList(en->title().toLower().split(QLatin1Char(' ')));
|
||||
if (!tags.isEmpty()) {
|
||||
writer.writeStartElement("tags");
|
||||
bool wrote_one = false;
|
||||
// Exclude invalid and common words
|
||||
foreach (QString tag, tags) {
|
||||
if (tag.length() < 2)
|
||||
continue;
|
||||
if (tag.at(0).isDigit())
|
||||
continue;
|
||||
if (tag.at(0) == '-')
|
||||
continue;
|
||||
if (tag == QStringLiteral("qt"))
|
||||
continue;
|
||||
if (tag.startsWith("example"))
|
||||
continue;
|
||||
if (tag.startsWith("chapter"))
|
||||
|
Loading…
Reference in New Issue
Block a user