diff options
author | Thibaut Cuvelier <cuvelier.thibaut@gmail.com> | 2023-02-10 02:51:11 +0100 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2023-04-26 14:43:23 +0200 |
commit | 102ebf0ee78b43e73bf9a1292fd42060540cdb26 (patch) | |
tree | a112b45d56e422f2ad5c554fa0b8adaf3723fbe2 /src | |
parent | aa24730660aec04871ac72b8c829b8e50909e47c (diff) | |
download | qttools-102ebf0ee78b43e73bf9a1292fd42060540cdb26.tar.gz |
DocBook: introduce a member variable to enable 5.2 tags
The main goal is to make the code easier to read and check.
This way, a bug was found: a reversed condition. Extensions
are not supposed to be enabled by default, but still were
for parts of the documentation.
Pick-to: 6.5
Change-Id: I5425c658d8f8adb368a12967a679b0c09851cf6a
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qdoc/qdoc/docbookgenerator.cpp | 5 | ||||
-rw-r--r-- | src/qdoc/qdoc/docbookgenerator.h | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/qdoc/qdoc/docbookgenerator.cpp b/src/qdoc/qdoc/docbookgenerator.cpp index 648a0a43d..d180aba01 100644 --- a/src/qdoc/qdoc/docbookgenerator.cpp +++ b/src/qdoc/qdoc/docbookgenerator.cpp @@ -156,6 +156,7 @@ void DocBookGenerator::initializeGenerator() m_naturalLanguage = QLatin1String("en"); m_buildVersion = m_config->get(CONFIG_BUILDVERSION).asString(); + m_useDocBook52 = m_config->get(CONFIG_DOCBOOKEXTENSIONS).asBool(); } QString DocBookGenerator::format() @@ -1227,7 +1228,7 @@ qsizetype DocBookGenerator::generateAtom(const Atom *atom, const Node *relative) m_writer->writeEndElement(); // bridgehead newLine(); - if (m_config->get(CONFIG_DOCBOOKEXTENSIONS).asBool()) { + if (m_useDocBook52) { if (isStyleProperty) { m_writer->writeStartElement(dbNamespace, "fieldsynopsis"); @@ -3665,7 +3666,7 @@ void DocBookGenerator::generateDocBookSynopsis(const Node *node) // Generator::generateThreadSafeness, QDocIndexFiles::generateIndexSection. // This function is the only place where DocBook extensions are used. - if (m_config->get(CONFIG_DOCBOOKEXTENSIONS).asBool()) + if (!m_useDocBook52) return; // Nothing to export in some cases. Note that isSharedCommentNode() returns diff --git a/src/qdoc/qdoc/docbookgenerator.h b/src/qdoc/qdoc/docbookgenerator.h index fe9f9ba3a..be80f38c2 100644 --- a/src/qdoc/qdoc/docbookgenerator.h +++ b/src/qdoc/qdoc/docbookgenerator.h @@ -136,8 +136,9 @@ private: void generateSynopsisInfo(const QString &key, const QString &value); void generateModifier(const QString &value); - bool m_inListItemLineOpen {}; - int currentSectionLevel {}; + // Generator state when outputting the documentation. + bool m_inListItemLineOpen { false }; + int currentSectionLevel { 0 }; QStack<int> sectionLevels {}; QString m_qflagsHref {}; bool m_inTeletype { false }; @@ -154,11 +155,13 @@ private: unsigned m_inList { 0 }; // Depth in number of nested lists. bool m_rewritingCustomQmlModuleSummary { false }; + // Generator configuration, set before starting the generation. QString m_project {}; QString m_projectDescription {}; QString m_naturalLanguage {}; QString m_buildVersion {}; QXmlStreamWriter *m_writer { nullptr }; + bool m_useDocBook52 { false }; // Enable tags from DocBook 5.2. Also called "extensions". Config *m_config { nullptr }; }; |