From 257eef7e80793913a3da304eec5ef48ca56e9fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Tue, 5 Apr 2022 15:51:08 +0200 Subject: qdoc: Do not generate tags from titles anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qt Creator nowadays searches itself for matches in the title and description, so no point in automatically generating tags from titles anymore. Change-Id: I4aa9912f7bb6dd293b5de8ebff7e751956e6856d Reviewed-by: Eike Ziller Reviewed-by: Topi Reiniƶ (cherry picked from commit f3c96dc9fd0dce00df7ae60f9a1c4ba86eaa2d70) Reviewed-by: Qt Cherry-pick Bot --- src/qdoc/manifestwriter.cpp | 41 ---------------------- src/qdoc/manifestwriter.h | 2 -- .../expected_output/demos-manifest.xml | 2 +- .../expected_output/examples-manifest.xml | 4 +-- .../testdata/qml/componentset/examples.qdoc | 2 +- 5 files changed, 4 insertions(+), 47 deletions(-) diff --git a/src/qdoc/manifestwriter.cpp b/src/qdoc/manifestwriter.cpp index 3d3d9e86a..571128c71 100644 --- a/src/qdoc/manifestwriter.cpp +++ b/src/qdoc/manifestwriter.cpp @@ -266,8 +266,6 @@ void ManifestWriter::generateManifestFile(const QString &manifest, const QString warnAboutUnusedAttributes(usedAttributes.keys(), example); writeDescription(&writer, example); addWordsFromModuleNamesAsTags(); - addTitleWordsToTags(example); - cleanUpTags(); writeTagsElement(&writer); const QString exampleName = example->name().mid(example->name().lastIndexOf('/') + 1); @@ -302,45 +300,6 @@ void ManifestWriter::writeTagsElement(QXmlStreamWriter *writer) writer->writeEndElement(); // tags } -/*! - \internal - - Clean up tags, exclude invalid and common words. - */ -void ManifestWriter::cleanUpTags() -{ - QSet cleanedTags; - - for (auto tag : m_tags) { - // strip punctuation characters from start and end - while (!tag.isEmpty() && tag.at(0).isPunct()) - tag.remove(0, 1); - while (!tag.isEmpty() && tag.back().isPunct()) - tag.chop(1); - - if (tag.length() < 2 || tag.at(0).isDigit() - || tag == QLatin1String("qt") || tag == QLatin1String("the") - || tag == QLatin1String("and") || tag == QLatin1String("doc") - || tag.startsWith(QLatin1String("example")) || tag.startsWith(QLatin1String("chapter"))) - continue; - cleanedTags << tag; - } - m_tags = cleanedTags; -} - -/*! - \internal - - Add the example's title as tags. - */ -void ManifestWriter::addTitleWordsToTags(const ExampleNode *example) -{ - Q_ASSERT(example); - - const auto &titleWords = example->title().toLower().split(QLatin1Char(' ')); - m_tags += QSet(titleWords.cbegin(), titleWords.cend()); -} - /*! \internal diff --git a/src/qdoc/manifestwriter.h b/src/qdoc/manifestwriter.h index 75e78ed27..fc6392afd 100644 --- a/src/qdoc/manifestwriter.h +++ b/src/qdoc/manifestwriter.h @@ -62,10 +62,8 @@ private: QDocDatabase *m_qdb { nullptr }; QList m_manifestMetaContent {}; - void addTitleWordsToTags(const ExampleNode *example); void addWordsFromModuleNamesAsTags(); void includeTagsAddedWithMetaCommand(const ExampleNode *example); - void cleanUpTags(); void writeTagsElement(QXmlStreamWriter *writer); template void processManifestMetaContent(const QString &fullName, F matchFunc); diff --git a/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml b/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml index 60da1bca7..5cbdf3f62 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml @@ -3,7 +3,7 @@ - demo,test + test diff --git a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml index 4d8a61cfb..bbce463eb 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/examples-manifest.xml @@ -3,12 +3,12 @@ - cmake,project,test + test test/cmaketest/main.cpp - documentation,qml,sample,test + sample,test tutorials/componentset/componentset.qml diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/componentset/examples.qdoc b/tests/auto/qdoc/generatedoutput/testdata/qml/componentset/examples.qdoc index 9c499713d..9ca0db891 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/qml/componentset/examples.qdoc +++ b/tests/auto/qdoc/generatedoutput/testdata/qml/componentset/examples.qdoc @@ -32,7 +32,7 @@ \testnoautolist - \meta tag {test,sample,(Qt)} + \meta tag {test,sample} \meta installpath tutorials This example demonstrates one of the ways to document QML types. It also -- cgit v1.2.3