From 23fd844bf85f1742751b960fd32e8da4e16fc793 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Tue, 8 Aug 2023 12:28:28 +0200 Subject: Don't let CMD_VALUE break CMD_TABLE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In QDoc, if a `\table` command follows a (list of) `\value` command(s), the content of both commands is merged in QDoc's HTML output. This means the table ends up broken. A workaround exists, which is to add a `\br` command to insert an explicit line break after the `\value` entry. This (mis-)behavior was discovered in the documentation for Qt Quick's `Image.fillMode` enumeration (see related Jira issue in the Task-Number footer. The responsible class in QDoc is DocParser. In the handling of `CMD_TABLE`, there's no call to `DocParser::leaveValueList()`, as is a recurring pattern in four other contexts of DocParser's command handling: - After the while/switch in `Docparser::parse()` - presumably an attempt at ensuring it's always called, that doesn't seem to work satisfactory. - At the start of `DocParser::startSection`. - In a conditional at the top of `DocParser::startPara`. - At the start of handling `CMD_IMAGE`. This patch adds a test case in tst_generatedOutput that reproduces the circumstances in which the issue could present itself. QDoc is modified by adding a call to `DocParser::leaveValueList() upon entering the code responsible for handling `CMD_TABLE` ensures correct behavior, where HTML for the value list is terminated properly before creating the new table for the table command. Task-number: QTBUG-115537 Fixes: QTBUG-115720 Pick-to: 6.6 6.5 Change-Id: I06c9c25b4ff792621d56e5eb802178cfd376f8c3 Reviewed-by: Topi Reiniƶ --- tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp') diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index 8b8a3d60e..2bd7dbc9f 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -62,6 +62,7 @@ private slots: void proxyPage(); void nonAsciiCharacterInput(); void lineComments(); + void tableAfterValue(); private: QScopedPointer m_outputDir; @@ -313,6 +314,16 @@ void tst_generatedOutput::illformated_documentation() "brief-adventures.html"); } +void tst_generatedOutput::tableAfterValue() +{ + testAndCompare("testdata/tables/table-after-value.qdocconf", + "tableaftervalue/tableaftervalue-members.html " + "tableaftervalue/tableaftervalue.html " + "tableaftervalue/tableaftervalue.index " + "tableaftervalue/tableaftervalue.webxml " + "tableaftervalue/tableaftervalue.xml"); +} + void tst_generatedOutput::docBookFromQDocFile() { testAndCompare("testdata/configs/docbook_test.qdocconf", -- cgit v1.2.3