summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibaut Cuvelier <cuvelier.thibaut@gmail.com>2022-08-05 01:21:45 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-02 02:06:58 +0000
commit8a31302453ff419519aa09427fbfe440f330286f (patch)
treeb2814e1e98a45b61abaac3b03812cc42d9f84137
parentf79ab600327f3ad884d5434bfa402f90e4815469 (diff)
downloadqttools-8a31302453ff419519aa09427fbfe440f330286f.tar.gz
Don't let \C and \Formatting collide
Previously, \C could output a <db:code> within a <db:code> opened by formatting (which is not valid DocBook). To solve this issue, it is necessary to remember whether a <db:code> is currently open, in m_inTeletype. Change-Id: I3f04c96b1d541610fa119668b2906a7fc424002e Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit ee64774559478596db3665793c46f5da3aaf7147) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qdoc/docbookgenerator.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp
index 63421c1a3..ae635631a 100644
--- a/src/qdoc/docbookgenerator.cpp
+++ b/src/qdoc/docbookgenerator.cpp
@@ -273,7 +273,10 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative)
// This may at one time have been used to mark up C++ code but it is
// now widely used to write teletype text. As a result, text marked
// with the \c command is not passed to a code marker.
- m_writer->writeTextElement(dbNamespace, "code", plainCode(atom->string()));
+ if (m_inTeletype)
+ m_writer->writeCharacters(plainCode(atom->string()));
+ else
+ m_writer->writeTextElement(dbNamespace, "code", plainCode(atom->string()));
break;
case Atom::CaptionLeft:
m_writer->writeStartElement(dbNamespace, "title");
@@ -395,6 +398,8 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative)
|| atom->string() == ATOM_FORMATTING_UICONTROL) {
m_writer->writeEndElement();
} else if (atom->string() == ATOM_FORMATTING_LINK) {
+ if (atom->string() == ATOM_FORMATTING_TELETYPE)
+ m_inTeletype = false;
endLink();
} else {
relative->location().warning(QStringLiteral("Unsupported formatting: %1").arg(atom->string()));