summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2022-10-13 00:20:44 +0200
committerTopi Reiniƶ <topi.reinio@qt.io>2022-10-13 08:38:18 +0000
commit3f5f00caf289f3985c81158d5c942fcff919c667 (patch)
treee35063b88cfe9cef7b0dec44a8ed6fa9d2fa4aad /tests
parentc48d751129e10cc9d006f753fdc8c99ef666fbbf (diff)
downloadqttools-3f5f00caf289f3985c81158d5c942fcff919c667.tar.gz
qdoc: Disable linking inside table-of-contents items
QDoc allows links inside section titles: \section1 \l QString usage When generating the TOC, QDoc dumped the HTML generated from the list of Atoms directly into the contents of the list item, including the anchor tags. While doing so, it marked the internal state of the generator to be 'in link'; this was not enough however, as a LinkAtom inside the section title closed the actual (TOC) in-page link and started another with its own link target. This resulted in confusing page TOC where an item could link to somewhere else than *this* page. Fixes: QTBUG-107602 Pick-to: 6.4 Change-Id: I5912e71b2ea1a1e5f04ef82012b7e105e4fc9da5 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoctests-qdocfileoutput.xml4
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/html/qdoctests-qdocfileoutput.webxml5
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html3
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/tocbreadcrumbs/qdoctests-qdocfileoutput.html3
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/outputfromqdocfiles/qdoctests-outputfromqdocfiles.qdoc4
5 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoctests-qdocfileoutput.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoctests-qdocfileoutput.xml
index 0fe4c530d..5f7308779 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoctests-qdocfileoutput.xml
+++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoctests-qdocfileoutput.xml
@@ -70,4 +70,8 @@
<db:title>QDoc Linking Test</db:title>
<db:para>This section title is overridden by another target which takes precedence.</db:para>
</db:section>
+<db:section xml:id="linking-to-something-in-a-section-title">
+<db:title>Linking to <db:link xlink:href="qdoctests-qdocfileoutput.xml#further-information">something</db:link> in a section title</db:title>
+<db:para>This is allowed but a questionable practice.</db:para>
+</db:section>
</db:article>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/html/qdoctests-qdocfileoutput.webxml b/tests/auto/qdoc/generatedoutput/expected_output/html/qdoctests-qdocfileoutput.webxml
index 5c9758445..3eb5b7703 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/html/qdoctests-qdocfileoutput.webxml
+++ b/tests/auto/qdoc/generatedoutput/expected_output/html/qdoctests-qdocfileoutput.webxml
@@ -6,6 +6,7 @@
<contents name="further-information" title="Further information" level="1"/>
<contents name="linking" title="Linking" level="1"/>
<contents name="qdoc-linking-test" title="QDoc Linking Test" level="1"/>
+ <contents name="linking-to-something-in-a-section-title" title="Linking to something in a section title" level="1"/>
<description>
<relation href="qdoctests-qdocfileoutput-linking.html" type="page" meta="next" description="Testing QDoc's link command"/>
<brief>This is a simple page for testing purposes only.</brief>
@@ -82,6 +83,10 @@
<heading level="1">QDoc Linking Test</heading>
<para>This section title is overridden by another target which takes precedence.</para>
</section>
+ <section id="linking-to-something-in-a-section-title">
+ <heading level="1">Linking to <link raw="Further information" href="qdoctests-qdocfileoutput.html#further-information" type="page" page="Testing QDoc output from .qdoc files">something</link> in a section title</heading>
+ <para>This is allowed but a questionable practice.</para>
+ </section>
</description>
</page>
</document>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html b/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html
index ab7fc566f..09aa4ef9b 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html
+++ b/tests/auto/qdoc/generatedoutput/expected_output/qdoctests-qdocfileoutput.html
@@ -19,6 +19,7 @@
<li class="level1"><a href="#further-information">Further information</a></li>
<li class="level1"><a href="#linking">Linking</a></li>
<li class="level1"><a href="#qdoc-linking-test">QDoc Linking Test</a></li>
+<li class="level1"><a href="#linking-to-something-in-a-section-title">Linking to something in a section title</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
@@ -51,6 +52,8 @@
</ul>
<h2 id="qdoc-linking-test">QDoc Linking Test</h2>
<p>This section title is overridden by another target which takes precedence.</p>
+<h2 id="linking-to-something-in-a-section-title">Linking to <a href="qdoctests-qdocfileoutput.html#further-information">something</a> in a section title</h2>
+<p>This is allowed but a questionable practice.</p>
</div>
<!-- @@@qdoctests-qdocfileoutput.html -->
<p class="naviNextPrevious footerNavi">
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/tocbreadcrumbs/qdoctests-qdocfileoutput.html b/tests/auto/qdoc/generatedoutput/expected_output/tocbreadcrumbs/qdoctests-qdocfileoutput.html
index d0b3aa7f1..28128fd90 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/tocbreadcrumbs/qdoctests-qdocfileoutput.html
+++ b/tests/auto/qdoc/generatedoutput/expected_output/tocbreadcrumbs/qdoctests-qdocfileoutput.html
@@ -21,6 +21,7 @@
<li class="level1"><a href="#further-information">Further information</a></li>
<li class="level1"><a href="#linking">Linking</a></li>
<li class="level1"><a href="#qdoc-linking-test">QDoc Linking Test</a></li>
+<li class="level1"><a href="#linking-to-something-in-a-section-title">Linking to something in a section title</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
@@ -53,6 +54,8 @@
</ul>
<h2 id="qdoc-linking-test">QDoc Linking Test</h2>
<p>This section title is overridden by another target which takes precedence.</p>
+<h2 id="linking-to-something-in-a-section-title">Linking to <a href="qdoctests-qdocfileoutput.html#further-information">something</a> in a section title</h2>
+<p>This is allowed but a questionable practice.</p>
</div>
<!-- @@@qdoctests-qdocfileoutput.html -->
<p class="naviNextPrevious footerNavi">
diff --git a/tests/auto/qdoc/generatedoutput/testdata/outputfromqdocfiles/qdoctests-outputfromqdocfiles.qdoc b/tests/auto/qdoc/generatedoutput/testdata/outputfromqdocfiles/qdoctests-outputfromqdocfiles.qdoc
index 4887dcdb9..f3289f4ee 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/outputfromqdocfiles/qdoctests-outputfromqdocfiles.qdoc
+++ b/tests/auto/qdoc/generatedoutput/testdata/outputfromqdocfiles/qdoctests-outputfromqdocfiles.qdoc
@@ -51,6 +51,10 @@
This section title is overridden by another target which takes
precedence.
+
+ \section1 Linking to \l {Further information}{something} in a section title
+
+ This is allowed but a questionable practice.
*/
/*!