summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2020-02-27 12:51:30 +0100
committerTopi Reinio <topi.reinio@qt.io>2020-02-28 10:16:33 +0100
commit856700499a5f3f53c63e69b90f3f41c8b5421d76 (patch)
treedf82d1a6b0fc46a2d6c2ec04fc70928beb4ef912
parent84306931190ce2c846a826b4c2bbefc8987b4405 (diff)
downloadqttools-856700499a5f3f53c63e69b90f3f41c8b5421d76.tar.gz
qdoc: Parse arguments for an \obsolete command
The command was documented as taking no arguments, and any arguments were ignored. The documentation still has many instances of \obsolete Use somethingElse() instead. Where the description was lost. Force a linebreak after the command, allowing any arguments to be processed as a normal text paragraph. [ChangeLog][qdoc] Generate output for arguments passed to the \obsolete command. Fixes: QTBUG-82558 Change-Id: If3e39382367a0c1f4cc63a2c322e986e053ecd6b Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--src/qdoc/doc.cpp6
-rw-r--r--src/qdoc/doc/qdoc-manual-contextcmds.qdoc2
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp
index eb5b5036f..f5ea0a61d 100644
--- a/src/qdoc/doc.cpp
+++ b/src/qdoc/doc.cpp
@@ -1325,6 +1325,12 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
case NOT_A_CMD:
if (metaCommandSet.contains(cmdStr)) {
priv->metacommandsUsed.insert(cmdStr);
+ // Force a linebreak after \obsolete or \deprecated
+ // to treat potential arguments as a new text paragraph.
+ if (pos < len &&
+ (cmdStr == QLatin1String("obsolete") ||
+ cmdStr == QLatin1String("deprecated")))
+ input_[pos] = '\n';
QString arg = getMetaCommandArgument(cmdStr);
priv->metaCommandMap[cmdStr].append(ArgLocPair(arg, location()));
if (possibleTopics.contains(cmdStr)) {
diff --git a/src/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/qdoc/doc/qdoc-manual-contextcmds.qdoc
index d3cf23b76..f020035d3 100644
--- a/src/qdoc/doc/qdoc-manual-contextcmds.qdoc
+++ b/src/qdoc/doc/qdoc-manual-contextcmds.qdoc
@@ -262,7 +262,7 @@
deprecated, and it should no longer be used in new code. There is
no guarantee for how long it will remain in the library.
- The command must stand on its own line.
+ The \\obsolete command takes no arguments.
When generating the reference documentation for a class, QDoc will
create and link to a separate page documenting its obsolete
diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp
index 5d3055ac2..c8b3f2f46 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp
+++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp
@@ -100,9 +100,7 @@ void Test::obsoleteMember()
}
/*!
- \obsolete
-
- Use obsoleteMember() instead.
+ \obsolete Use obsoleteMember() instead.
*/
void Test::anotherObsoleteMember()
{