diff options
author | Kai Köhne <kai.koehne@qt.io> | 2022-04-05 15:51:08 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-04-28 10:03:54 +0000 |
commit | 257eef7e80793913a3da304eec5ef48ca56e9fd1 (patch) | |
tree | 9c133195e1c84367c31b7c57814935fbb1bceaf3 | |
parent | 8a8897fe35f7fb526a2a6e601a21615170be6a87 (diff) |
qdoc: Do not generate tags from titles anymore
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 <eike.ziller@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit f3c96dc9fd0dce00df7ae60f9a1c4ba86eaa2d70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
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); @@ -305,45 +303,6 @@ void ManifestWriter::writeTagsElement(QXmlStreamWriter *writer) /*! \internal - Clean up tags, exclude invalid and common words. - */ -void ManifestWriter::cleanUpTags() -{ - QSet<QString> 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<QString>(titleWords.cbegin(), titleWords.cend()); -} - -/*! - \internal - Add words from module name as tags QtQuickControls -> qt,quick,controls QtOpenGL -> qt,opengl 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<ManifestMetaFilter> m_manifestMetaContent {}; - void addTitleWordsToTags(const ExampleNode *example); void addWordsFromModuleNamesAsTags(); void includeTagsAddedWithMetaCommand(const ExampleNode *example); - void cleanUpTags(); void writeTagsElement(QXmlStreamWriter *writer); template <typename F> 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 @@ <demos> <demo docUrl="qthelp://org.qt-project.test.001/test/test-demos-demo-example.html" imageUrl="qthelp://org.qt-project.test.001/test/images/leonardo-da-vinci.png" isTest="true" name="Demo" projectPath="test/demos/demo/demo.pro"> <description><![CDATA[No description available]]></description> - <tags>demo,test</tags> + <tags>test</tags> </demo> </demos> </instructionals> 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 @@ <examples> <example docUrl="qthelp://org.qt-project.test.001/test/test-cmaketest-example.html" imageUrl="qthelp://org.qt-project.test.001/test/images/leonardo-da-vinci.png" isTest="true" name="CMake Example Project" projectPath="test/cmaketest/CMakeLists.txt"> <description><![CDATA[No description available]]></description> - <tags>cmake,project,test</tags> + <tags>test</tags> <fileToOpen mainFile="true">test/cmaketest/main.cpp</fileToOpen> </example> <example docUrl="qthelp://org.qt-project.test.001/test/test-componentset-example.html" isTest="true" name="QML Documentation Example" projectPath="tutorials/componentset/componentset.pro"> <description><![CDATA[Example for documenting QML types.]]></description> - <tags>documentation,qml,sample,test</tags> + <tags>sample,test</tags> <fileToOpen mainFile="true">tutorials/componentset/componentset.qml</fileToOpen> </example> </examples> 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 |