summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2019-04-11 13:49:47 +0200
committerMartin Smith <martin.smith@qt.io>2019-04-26 10:38:29 +0000
commit7203e6a94ced619eadbc14aedf73d40530671662 (patch)
treeec82ca9ed8bfe55751438a29bd272ac5e60bdbaa
parent4399a1683a016794e22ecdd03eafca07b93af4e2 (diff)
downloadqttools-7203e6a94ced619eadbc14aedf73d40530671662.tar.gz
qdoc: Avoid generating invalid html
The test qdoc file and qdocconf file provided with QTBUG-74903 gets qdoc to generate the html file shown below. The line "<li>Test Guide</li>" is invalid html. It is meant to be part of the navigation bar. This update prevents the generation of that line, when the navigationbar Text object is empty when the invalid line is about to be added. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- test.qdoc --> <title>Test Guide | Testing</title> </head> <body> <li>Test Guide</li> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <much of html file deleted> </body> </html> The test input html file actually contained an invalid line that qdoc generated erroneously. This update just removes that invalid line. Task-number: QTBUG-74903 Change-Id: I9e8d742676ac8c7c536c73c8f5b98d27aafbd3c7 Reviewed-by: Martin Smith <martin.smith@qt.io>
-rw-r--r--src/qdoc/htmlgenerator.cpp8
-rw-r--r--src/qdoc/node.h1
-rw-r--r--tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html1
3 files changed, 6 insertions, 4 deletions
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index ec96d3dd4..235b01470 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -2053,9 +2053,11 @@ void HtmlGenerator::generateNavigationBar(const QString &title,
}
}
}
- navigationbar << Atom(itemLeft)
- << Atom(Atom::String, title)
- << Atom(itemRight);
+ if (!navigationbar.isEmpty()) {
+ navigationbar << Atom(itemLeft)
+ << Atom(Atom::String, title)
+ << Atom(itemRight);
+ }
}
generateText(navigationbar, node, marker);
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index 8c5789a9c..426e28753 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -188,6 +188,7 @@ public:
bool isModule() const { return nodeType_ == Module; }
bool isNamespace() const { return nodeType_ == Namespace; }
bool isObsolete() const { return (status_ == Obsolete); }
+ bool isPage() const { return nodeType_ == Page; }
bool isPreliminary() const { return (status_ == Preliminary); }
bool isPrivate() const { return access_ == Private; }
bool isProperty() const { return nodeType_ == Property; }
diff --git a/tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html b/tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html
index ea9946d6b..199d63ef1 100644
--- a/tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html
+++ b/tests/auto/qdoc/qdocfileoutput/expected_output/qdoctests-qdocfileoutput.html
@@ -7,7 +7,6 @@
<title>Testing QDoc output from .qdoc files | Test</title>
</head>
<body>
-<li>Testing QDoc output from .qdoc files</li>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>