summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2023-04-14 21:24:36 +0200
committerPaul Wicking <paul.wicking@qt.io>2023-04-25 10:02:54 +0200
commitaa24730660aec04871ac72b8c829b8e50909e47c (patch)
treebec47758e9cfb20359653144dddfd530a74e769a /src
parent3465735012de9dda79b31b4452663878987d4aa9 (diff)
downloadqttools-aa24730660aec04871ac72b8c829b8e50909e47c.tar.gz
QDoc: Make \keyword enforce paragraphs
QDoc's \brief command takes an entire paragraph as its argument, and also allows for the processing QDoc commands or macros that appear in the argument. Due to QDoc's internals, this may lead to a situation where such commands consume newline characters that the \brief command relies upon as indicator of its end condition, leading to a situation where the \brief command erroneously includes the following paragraph as part of its argument. In particular, this may cause issues for certain commands that "naturally" fit in a document "header". For example, given the following content in a .qdoc file: /*! \page the_page.html \title The title \brief This is the brief. \keyword the_keyword Lorem ipsum dolor sit amet. Santa Mozzarella! */ the brief will contain: This is the brief. Lorem ipsum dolor sit amet. And the only content in the generated output will, unexpectedly, be Santa Mozzarella! Due to its design, modifications to the \brief command are difficult, as they will inevitably change QDoc's behavior significantly, with the possibility of silent breakage. Therefore, enforce that the \keyword command starts ends the paragraph it occurs in before further processing. This change includes a reproducing test case for the behavior in question, which serves to validate the fix as well as as a guard for future regressions. Fixes: QTBUG-70959 Change-Id: I8f5b8a4aebf2ed2040bf43c1d4551ec280fc895a Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qdoc/qdoc/docparser.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qdoc/qdoc/docparser.cpp b/src/qdoc/qdoc/docparser.cpp
index 44b0ee3a7..cb6b7788e 100644
--- a/src/qdoc/qdoc/docparser.cpp
+++ b/src/qdoc/qdoc/docparser.cpp
@@ -635,6 +635,7 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate,
startFormat(ATOM_FORMATTING_INDEX, cmd);
break;
case CMD_KEYWORD:
+ leavePara();
insertTarget(getRestOfLine(), true);
break;
case CMD_L: