diff options
10 files changed, 197 insertions, 1 deletions
diff --git a/src/qdoc/qdoc/src/qdoc/docparser.cpp b/src/qdoc/qdoc/src/qdoc/docparser.cpp index 84115b2fd..f288d776e 100644 --- a/src/qdoc/qdoc/src/qdoc/docparser.cpp +++ b/src/qdoc/qdoc/src/qdoc/docparser.cpp @@ -1643,7 +1643,7 @@ bool DocParser::isAutoLinkString(const QString &word, qsizetype &curPos) } else if (latin1Ch == '(') { if ((curPos < len - 1) && (word.at(curPos + 1) == QLatin1Char(')'))) { ++numStrangeSymbols; - m_position += 2; + curPos += 2; } break; diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/docbook/linkparentheses.xml b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/docbook/linkparentheses.xml new file mode 100644 index 000000000..7cb0ded8c --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/docbook/linkparentheses.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<db:article xmlns:db="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.2" xml:lang="en"> +<db:info> +<db:title>Test Page for Link Parentheses Issue</db:title> +<db:productname>LinkParentheses</db:productname> +<db:titleabbrev>Parentheses in link text</db:titleabbrev> +<db:abstract> +<db:para>Parentheses in link text.</db:para></db:abstract> +</db:info> +<db:para>This page tests the fix for QTBUG-69756 where parentheses in link text cause premature link termination.</db:para> +<db:para>Test cases:</db:para> +<db:itemizedlist> +<db:listitem> +<db:para><db:link xlink:href="linkparentheses.xml">Q(Gui)Application</db:link></db:para> +</db:listitem> +<db:listitem> +<db:para><db:link xlink:href="linkparentheses.xml">Text with (parentheses) in the middle</db:link></db:para> +</db:listitem> +<db:listitem> +<db:para><db:link xlink:href="linkparentheses.xml">(Starting with parentheses)</db:link></db:para> +</db:listitem> +<db:listitem> +<db:para><db:link xlink:href="linkparentheses.xml">Ending with (parentheses)</db:link></db:para> +</db:listitem> +<db:listitem> +<db:para><db:link xlink:href="linkparentheses.xml">Multiple (sets) of (parentheses)</db:link></db:para> +</db:listitem> +<db:listitem> +<db:para><db:link xlink:href="linkparentheses.xml">Normal text without parentheses</db:link></db:para> +</db:listitem> +</db:itemizedlist> +<db:para>All of the above links should be fully hyperlinked, including the text within parentheses.</db:para> +</db:article> diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/html/linkparentheses.html b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/html/linkparentheses.html new file mode 100644 index 000000000..92533acbf --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/html/linkparentheses.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- main.cpp --> + <title>Test Page for Link Parentheses Issue | LinkParentheses</title> +</head> +<body> +<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">Test Page for Link Parentheses Issue</h1> +<!-- $$$linkparentheses.html-description --> +<div class="descr" id="details"> +<p>This page tests the fix for QTBUG-69756 where parentheses in link text cause premature link termination.</p> +<p>Test cases:</p> +<ul> +<li><a href="linkparentheses.html">Q(Gui)Application</a></li> +<li><a href="linkparentheses.html">Text with (parentheses) in the middle</a></li> +<li><a href="linkparentheses.html">(Starting with parentheses)</a></li> +<li><a href="linkparentheses.html">Ending with (parentheses)</a></li> +<li><a href="linkparentheses.html">Multiple (sets) of (parentheses)</a></li> +<li><a href="linkparentheses.html">Normal text without parentheses</a></li> +</ul> +<p>All of the above links should be fully hyperlinked, including the text within parentheses.</p> +</div> +<!-- @@@linkparentheses.html --> +</body> +</html> diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/html/linkparentheses.index b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/html/linkparentheses.index new file mode 100644 index 000000000..7f2df6e09 --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/html/linkparentheses.index @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QDOCINDEX> +<INDEX url="" title="Parentheses in link text" version="" project="LinkParentheses"> + <namespace name="" status="active" access="public" module="linkparentheses"> + <page name="linkparentheses.html" href="linkparentheses.html" status="active" documented="true" subtype="page" title="Test Page for Link Parentheses Issue" fulltitle="Test Page for Link Parentheses Issue" subtitle=""/> + </namespace> +</INDEX> diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/webxml/linkparentheses.index b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/webxml/linkparentheses.index new file mode 100644 index 000000000..7f2df6e09 --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/webxml/linkparentheses.index @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QDOCINDEX> +<INDEX url="" title="Parentheses in link text" version="" project="LinkParentheses"> + <namespace name="" status="active" access="public" module="linkparentheses"> + <page name="linkparentheses.html" href="linkparentheses.html" status="active" documented="true" subtype="page" title="Test Page for Link Parentheses Issue" fulltitle="Test Page for Link Parentheses Issue" subtitle=""/> + </namespace> +</INDEX> diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/webxml/linkparentheses.webxml b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/webxml/linkparentheses.webxml new file mode 100644 index 000000000..9b0393aa3 --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/expected/webxml/linkparentheses.webxml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<WebXML> + <document> + <page name="linkparentheses.html" href="linkparentheses.html" status="active" documented="true" subtype="page" title="Test Page for Link Parentheses Issue" fulltitle="Test Page for Link Parentheses Issue" subtitle=""> + <description> + <para>This page tests the fix for QTBUG-69756 where parentheses in link text cause premature link termination.</para> + <para>Test cases:</para> + <list type="bullet"> + <item> + <para> + <link raw="linkparentheses.html" href="linkparentheses.html" type="page" page="Test Page for Link Parentheses Issue">Q(Gui)Application</link></para> + </item> + <item> + <para> + <link raw="linkparentheses.html" href="linkparentheses.html" type="page" page="Test Page for Link Parentheses Issue">Text with (parentheses) in the middle</link></para> + </item> + <item> + <para> + <link raw="linkparentheses.html" href="linkparentheses.html" type="page" page="Test Page for Link Parentheses Issue">(Starting with parentheses)</link></para> + </item> + <item> + <para> + <link raw="linkparentheses.html" href="linkparentheses.html" type="page" page="Test Page for Link Parentheses Issue">Ending with (parentheses)</link></para> + </item> + <item> + <para> + <link raw="linkparentheses.html" href="linkparentheses.html" type="page" page="Test Page for Link Parentheses Issue">Multiple (sets) of (parentheses)</link></para> + </item> + <item> + <para> + <link raw="linkparentheses.html" href="linkparentheses.html" type="page" page="Test Page for Link Parentheses Issue">Normal text without parentheses</link></para> + </item> + </list> + <para>All of the above links should be fully hyperlinked, including the text within parentheses.</para> + </description> + </page> + </document> +</WebXML> diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/html/linkparentheses.html b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/html/linkparentheses.html new file mode 100644 index 000000000..92533acbf --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/html/linkparentheses.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- main.cpp --> + <title>Test Page for Link Parentheses Issue | LinkParentheses</title> +</head> +<body> +<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">Test Page for Link Parentheses Issue</h1> +<!-- $$$linkparentheses.html-description --> +<div class="descr" id="details"> +<p>This page tests the fix for QTBUG-69756 where parentheses in link text cause premature link termination.</p> +<p>Test cases:</p> +<ul> +<li><a href="linkparentheses.html">Q(Gui)Application</a></li> +<li><a href="linkparentheses.html">Text with (parentheses) in the middle</a></li> +<li><a href="linkparentheses.html">(Starting with parentheses)</a></li> +<li><a href="linkparentheses.html">Ending with (parentheses)</a></li> +<li><a href="linkparentheses.html">Multiple (sets) of (parentheses)</a></li> +<li><a href="linkparentheses.html">Normal text without parentheses</a></li> +</ul> +<p>All of the above links should be fully hyperlinked, including the text within parentheses.</p> +</div> +<!-- @@@linkparentheses.html --> +</body> +</html> diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/html/linkparentheses.index b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/html/linkparentheses.index new file mode 100644 index 000000000..b7abba07d --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/html/linkparentheses.index @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QDOCINDEX> +<INDEX url="" title="Test case for QTBUG-69756 - parentheses in link text" version="" project="LinkParentheses"> + <namespace name="" status="active" access="public" module="linkparentheses"> + <page name="linkparentheses.html" href="linkparentheses.html" status="active" documented="true" subtype="page" title="Test Page for Link Parentheses Issue" fulltitle="Test Page for Link Parentheses Issue" subtitle=""/> + </namespace> +</INDEX> diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/linkparentheses.qdocconf b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/linkparentheses.qdocconf new file mode 100644 index 000000000..fc35c7958 --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/linkparentheses.qdocconf @@ -0,0 +1,25 @@ +project = LinkParentheses +description = Parentheses in link text + +outputformats = WebXML HTML DocBook +WebXML.quotinginformation = true +WebXML.nosubdirs = true +WebXML.outputsubdir = webxml + +HTML.nosubdirs = true +HTML.outputsubdir = html + +DocBook.nosubdirs = true +DocBook.outputsubdir = docbook + +locationinfo = false + +sources.fileextensions = "*.qml *.cpp *.qdoc" +headers.fileextensions = "*.h" + +sourcedirs = src + +# zero warning policy +warninglimit = 0 +warninglimit.enabled = true + diff --git a/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/src/main.cpp b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/src/main.cpp new file mode 100644 index 000000000..9de5f34e5 --- /dev/null +++ b/src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/linkparentheses/src/main.cpp @@ -0,0 +1,25 @@ +// Copyright (C) 2025 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +/*! + \page linkparentheses.html + \title Test Page for Link Parentheses Issue + + This page tests the fix for QTBUG-69756 where parentheses in link text + cause premature link termination. + + Test cases: + + \list + \li \l {linkparentheses.html} {Q(Gui)Application} + \li \l {linkparentheses.html} {Text with (parentheses) in the middle} + \li \l {linkparentheses.html} {(Starting with parentheses)} + \li \l {linkparentheses.html} {Ending with (parentheses)} + \li \l {linkparentheses.html} {Multiple (sets) of (parentheses)} + \li \l {linkparentheses.html} {Normal text without parentheses} + \endlist + + All of the above links should be fully hyperlinked, including the text + within parentheses. +*/ + |