diff options
author | Topi Reinio <topi.reinio@qt.io> | 2021-11-02 22:22:25 +0100 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@qt.io> | 2021-11-03 10:26:10 +0000 |
commit | b3e367def6ff0f79441507e839c6cc874d4a25fd (patch) | |
tree | 5c1e83b57f5113f6c3489c704d72bf45089b58f5 /src/qdoc/docparser.cpp | |
parent | 2321eeadfaa43fa2d4b01138fadaf7f4478dfbae (diff) | |
download | qttools-b3e367def6ff0f79441507e839c6cc874d4a25fd.tar.gz |
qdoc: Improve link text formatting
QDoc attempts to style links to C++ functions in a specific way,
by moving function arguments and the enclosing parentheses
out of the link. This was done in a way that had unintended
consequences for all link texts that included an opening
parenthesis, whether the link target was a function or not.
As a fix;
* Increase the specificity of the regular expression
used for identifying a function-like link text.
* Store the Node we're linking to in generator, so
we can match the regular expression only to function
targets, not all links. This is also a performance
improvement.
* DocParser: Stop generating AutoLink atoms inside an
open (explicit) link. This was useless as it split
the input into multiple nested link->autolink atoms,
and the nested ones are discarded/treated as strings
in the generator anyway.
* Refactor related generator functions and remove
obsolete debugging code.
Pick-to: 6.2
Task-number: QTBUG-97949
Change-Id: I89429a73f13aa9995a79dfd24a8e473c620d6bc6
Done-with: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/docparser.cpp')
-rw-r--r-- | src/qdoc/docparser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qdoc/docparser.cpp b/src/qdoc/docparser.cpp index 1294f5d7a..43e3a1d30 100644 --- a/src/qdoc/docparser.cpp +++ b/src/qdoc/docparser.cpp @@ -1255,7 +1255,10 @@ void DocParser::parse(const QString &source, DocPrivate *docPrivate, if (newWord) { qsizetype startPos = m_position; - bool autolink = isAutoLinkString(m_input, m_position); + // No auto-linking inside links + bool autolink = (!m_pendingFormats.isEmpty() && + m_pendingFormats.last() == ATOM_FORMATTING_LINK) ? + false : isAutoLinkString(m_input, m_position); if (m_position == startPos) { if (!ch.isSpace()) { appendChar(ch); |