Continue processing the qhp file on missing attributes
authorLars Knoll <lars.knoll@nokia.com>
Tue, 21 Aug 2012 10:35:11 +0000 (12:35 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 21 Aug 2012 17:40:50 +0000 (19:40 +0200)
qhelpgenerator would bail out with an error if a keyword would contain
a missing or empty attribute. This can e.g. happen on a missing
\relates in the documentation.

This makes the whole help generation rather fragile, as CI doesn't stop
these kind of errors from making it into the code base. So rather then
failing to generate the docs simply skip the one keyword that the
helpgenerator can't place into a context.

Change-Id: I265dc75ba9b29c868d5b9cf8a9aae5ce880374b1
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
src/assistant/help/qhelpprojectdata.cpp

index 6020293..9a229b0 100644 (file)
@@ -233,10 +233,10 @@ void QHelpProjectDataPrivate::readKeywords()
             if (name() == QLatin1String("keyword")) {
                 if (attributes().value(QLatin1String("ref")).toString().isEmpty()
                     || (attributes().value(QLatin1String("name")).toString().isEmpty()
-                    && attributes().value(QLatin1String("id")).toString().isEmpty()))
-                    raiseError(QCoreApplication::translate("QHelpProject",
-                                   "Missing attribute in keyword at line %1.")
-                               .arg(lineNumber()));
+                    && attributes().value(QLatin1String("id")).toString().isEmpty())) {
+                    qWarning("Missing attribute in keyword at line %d.", (int)lineNumber());
+                    continue;
+                }
                 filterSectionList.last()
                     .addIndex(QHelpDataIndexItem(attributes().
                                   value(QLatin1String("name")).toString(),