summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2023-04-13 14:53:56 +0200
committerPaul Wicking <paul.wicking@qt.io>2023-04-13 15:27:17 +0200
commitc0cd634a320b7186e967e3b70fd41c57554d6399 (patch)
treebb508ef0c5003f253cb201208a430f5ecced30bd /src
parent3eb400c6ff46ea98deb1afa8894878923efd705a (diff)
downloadqttools-c0cd634a320b7186e967e3b70fd41c57554d6399.tar.gz
QDoc: Remove unused \qmltext | \endqmltext command pair
QDoc offers the `\qmltext` and `\endqmltext` command pairs, dating back to sometime prior to when QDoc moved to qttools.git in 2015. The commands have since been considered tags not to be handled specifically when generating documentation. The commands have not been documented. Upon inspection of source code across Qt and its modules, no usage of the commands have been found, with the exception of the generated output test for QDoc itself. Even though unused and considered "only tags", the `Generator`, `HTMLGenerator`, and `DocBookGenerator` classes still implement methods to handle them and generate output for them. The removal of the commands therefore necessitates removal of the methods that deal with them. As the command pair is unused, removing the related code is a way to reduce the surface of QDoc's generator classes, making them slightly better suited for testing. This also improves the maintainability of QDoc. This change thus removes the commands and the related `Atom`s, as well as any method designed to deal with those `Atom`s. In addition, the test data and expected output for the generated output test is modified to accommodate the behavior change. Fixes: QTBUG-112764 Change-Id: I2b0a57783ccdccd3e8c1693e6946ecf07777f3b6 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qdoc/qdoc/atom.cpp4
-rw-r--r--src/qdoc/qdoc/atom.h2
-rw-r--r--src/qdoc/qdoc/docbookgenerator.cpp35
-rw-r--r--src/qdoc/qdoc/docbookgenerator.h1
-rw-r--r--src/qdoc/qdoc/docparser.cpp12
-rw-r--r--src/qdoc/qdoc/generator.cpp29
-rw-r--r--src/qdoc/qdoc/generator.h6
-rw-r--r--src/qdoc/qdoc/htmlgenerator.cpp7
8 files changed, 0 insertions, 96 deletions
diff --git a/src/qdoc/qdoc/atom.cpp b/src/qdoc/qdoc/atom.cpp
index 69bf6fb9c..6b895769f 100644
--- a/src/qdoc/qdoc/atom.cpp
+++ b/src/qdoc/qdoc/atom.cpp
@@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE
\value CodeQuoteCommand
\value DivLeft
\value DivRight
- \value EndQmlText
\value ExampleFileLink
\value ExampleImageLink
\value FormatElse
@@ -85,7 +84,6 @@ QT_BEGIN_NAMESPACE
\value ParaLeft
\value ParaRight
\value Qml
- \value QmlText
\value QuotationLeft
\value QuotationRight
\value RawString
@@ -134,7 +132,6 @@ static const struct
{ "CodeQuoteCommand", Atom::CodeQuoteCommand },
{ "DivLeft", Atom::DivLeft },
{ "DivRight", Atom::DivRight },
- { "EndQmlText", Atom::EndQmlText },
{ "ExampleFileLink", Atom::ExampleFileLink },
{ "ExampleImageLink", Atom::ExampleImageLink },
{ "FootnoteLeft", Atom::FootnoteLeft },
@@ -172,7 +169,6 @@ static const struct
{ "ParaLeft", Atom::ParaLeft },
{ "ParaRight", Atom::ParaRight },
{ "Qml", Atom::Qml },
- { "QmlText", Atom::QmlText },
{ "QuotationLeft", Atom::QuotationLeft },
{ "QuotationRight", Atom::QuotationRight },
{ "RawString", Atom::RawString },
diff --git a/src/qdoc/qdoc/atom.h b/src/qdoc/qdoc/atom.h
index 1dc3806c9..ba453254b 100644
--- a/src/qdoc/qdoc/atom.h
+++ b/src/qdoc/qdoc/atom.h
@@ -33,7 +33,6 @@ public:
CodeQuoteCommand,
DivLeft,
DivRight,
- EndQmlText,
ExampleFileLink,
ExampleImageLink,
FootnoteLeft,
@@ -71,7 +70,6 @@ public:
ParaLeft,
ParaRight,
Qml,
- QmlText,
QuotationLeft,
QuotationRight,
RawString,
diff --git a/src/qdoc/qdoc/docbookgenerator.cpp b/src/qdoc/qdoc/docbookgenerator.cpp
index ceb2fa301..b849e5453 100644
--- a/src/qdoc/qdoc/docbookgenerator.cpp
+++ b/src/qdoc/qdoc/docbookgenerator.cpp
@@ -1767,10 +1767,6 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative)
m_writer->writeEndElement(); // code
m_writer->writeEndElement(); // emphasis
break;
- case Atom::QmlText:
- case Atom::EndQmlText:
- // Don't do anything with these. They are just tags.
- Q_FALLTHROUGH();
case Atom::CodeQuoteArgument:
case Atom::CodeQuoteCommand:
case Atom::SnippetCommand:
@@ -4853,34 +4849,6 @@ void DocBookGenerator::generatePageNode(PageNode *pn)
}
/*!
- Extract sections of markup text and output them.
- */
-bool DocBookGenerator::generateQmlText(const Text &text, const Node *relative)
-{
- // From Generator::generateQmlText.
- const Atom *atom = text.firstAtom();
- bool result = false;
-
- if (atom != nullptr) {
- initializeTextOutput();
- while (atom) {
- if (atom->type() != Atom::QmlText)
- atom = atom->next();
- else {
- atom = atom->next();
- while (atom && (atom->type() != Atom::EndQmlText)) {
- int n = 1 + generateAtom(atom, relative);
- while (n-- > 0)
- atom = atom->next();
- }
- }
- }
- result = true;
- }
- return result;
-}
-
-/*!
Generate the DocBook page for a QML type. \qcn is the QML type.
*/
void DocBookGenerator::generateQmlTypePage(QmlTypeNode *qcn)
@@ -4903,9 +4871,6 @@ void DocBookGenerator::generateQmlTypePage(QmlTypeNode *qcn)
startSection("details", "Detailed Description");
generateBody(qcn);
- ClassNode *cn = qcn->classNode();
- if (cn)
- generateQmlText(cn->doc().body(), cn);
generateAlsoList(qcn);
endSection();
diff --git a/src/qdoc/qdoc/docbookgenerator.h b/src/qdoc/qdoc/docbookgenerator.h
index dfcbcc62c..fe9f9ba3a 100644
--- a/src/qdoc/qdoc/docbookgenerator.h
+++ b/src/qdoc/qdoc/docbookgenerator.h
@@ -108,7 +108,6 @@ private:
void generateLegaleseList(const Node *relative);
void generateExampleFilePage(const Node *en, ResolvedFile resolved_file, CodeMarker* = nullptr) override;
void generateOverloadedSignal(const Node *node);
- bool generateQmlText(const Text &text, const Node *relative) override;
void generateRequiredLinks(const Node *node);
void generateLinkToExample(const ExampleNode *en, const QString &baseUrl);
diff --git a/src/qdoc/qdoc/docparser.cpp b/src/qdoc/qdoc/docparser.cpp
index 74e9584e8..c638cde4e 100644
--- a/src/qdoc/qdoc/docparser.cpp
+++ b/src/qdoc/qdoc/docparser.cpp
@@ -116,8 +116,6 @@ enum {
CMD_ENDQML,
CMD_CPP,
CMD_ENDCPP,
- CMD_QMLTEXT,
- CMD_ENDQMLTEXT,
CMD_CPPTEXT,
CMD_ENDCPPTEXT,
NOT_A_CMD
@@ -218,8 +216,6 @@ static struct
{ "endqml", CMD_ENDQML },
{ "cpp", CMD_CPP },
{ "endcpp", CMD_ENDCPP },
- { "qmltext", CMD_QMLTEXT },
- { "endqmltext", CMD_ENDQMLTEXT },
{ "cpptext", CMD_CPPTEXT },
{ "endcpptext", CMD_ENDCPPTEXT },
{ nullptr, 0 } };
@@ -386,9 +382,6 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
getCode(CMD_QML, CodeMarker::markerForLanguage(QLatin1String("QML")),
getMetaCommandArgument(cmdStr)));
break;
- case CMD_QMLTEXT:
- append(Atom::QmlText);
- break;
case CMD_DIV:
leavePara();
p1 = getArgument(true);
@@ -448,9 +441,6 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case CMD_ENDQML:
closeCommand(cmd);
break;
- case CMD_ENDQMLTEXT:
- append(Atom::EndQmlText);
- break;
case CMD_ENDFOOTNOTE:
if (closeCommand(cmd)) {
leavePara();
@@ -2439,8 +2429,6 @@ int DocParser::endCmdFor(int cmd)
return CMD_ENDDIV;
case CMD_QML:
return CMD_ENDQML;
- case CMD_QMLTEXT:
- return CMD_ENDQMLTEXT;
case CMD_FOOTNOTE:
return CMD_ENDFOOTNOTE;
case CMD_LEGALESE:
diff --git a/src/qdoc/qdoc/generator.cpp b/src/qdoc/qdoc/generator.cpp
index 9dfe88a0b..c4f6ff233 100644
--- a/src/qdoc/qdoc/generator.cpp
+++ b/src/qdoc/qdoc/generator.cpp
@@ -1093,35 +1093,6 @@ void Generator::generateDocumentation(Node *node)
}
}
-/*!
- Extract sections of markup text surrounded by \e qmltext
- and \e endqmltext and output them.
- */
-bool Generator::generateQmlText(const Text &text, const Node *relative, CodeMarker *marker,
- const QString & /* qmlName */)
-{
- const Atom *atom = text.firstAtom();
- bool result = false;
-
- if (atom != nullptr) {
- initializeTextOutput();
- while (atom) {
- if (atom->type() != Atom::QmlText)
- atom = atom->next();
- else {
- atom = atom->next();
- while (atom && (atom->type() != Atom::EndQmlText)) {
- int n = 1 + generateAtom(atom, relative, marker);
- while (n-- > 0)
- atom = atom->next();
- }
- }
- }
- result = true;
- }
- return result;
-}
-
void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *marker)
{
if (fn->overridesThis().isEmpty() || !fn->parent()->isClassNode())
diff --git a/src/qdoc/qdoc/generator.h b/src/qdoc/qdoc/generator.h
index 2c9be87cc..fbbff827f 100644
--- a/src/qdoc/qdoc/generator.h
+++ b/src/qdoc/qdoc/generator.h
@@ -92,12 +92,6 @@ protected:
virtual void generateCollectionNode(CollectionNode *, CodeMarker *) {}
virtual void generateGenericCollectionPage(CollectionNode *, CodeMarker *) {}
virtual void generateDocumentation(Node *node);
- virtual bool generateQmlText(const Text &text, const Node *relative, CodeMarker *marker,
- const QString &qmlName);
- virtual bool generateQmlText(const Text &text, const Node *relative)
- {
- return generateQmlText(text, relative, nullptr, QString());
- }
virtual bool generateText(const Text &text, const Node *relative, CodeMarker *marker);
virtual bool generateText(const Text &text, const Node *relative)
{
diff --git a/src/qdoc/qdoc/htmlgenerator.cpp b/src/qdoc/qdoc/htmlgenerator.cpp
index e3b91955c..74ce2be7e 100644
--- a/src/qdoc/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/qdoc/htmlgenerator.cpp
@@ -966,10 +966,6 @@ qsizetype HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, Co
case Atom::UnknownCommand:
out() << R"(<b class="redFont"><code translate=\"no\">\)" << protectEnc(atom->string()) << "</code></b>";
break;
- case Atom::QmlText:
- case Atom::EndQmlText:
- // don't do anything with these. They are just tags.
- break;
case Atom::CodeQuoteArgument:
case Atom::CodeQuoteCommand:
case Atom::SnippetCommand:
@@ -1416,9 +1412,6 @@ void HtmlGenerator::generateQmlTypePage(QmlTypeNode *qcn, CodeMarker *marker)
<< "Detailed Description"
<< "</h2>\n";
generateBody(qcn, marker);
- ClassNode *cn = qcn->classNode();
- if (cn)
- generateQmlText(cn->doc().body(), cn, marker, qcn->name());
generateAlsoList(qcn, marker);
generateExtractionMark(qcn, EndMark);