diff options
author | Paul Wicking <paul.wicking@qt.io> | 2020-04-22 14:55:13 +0200 |
---|---|---|
committer | cherrypickbot <cherrypickbot@codereview.qt-project.org> | 2020-05-05 11:02:21 +0000 |
commit | ceb313d955294db3cd43a30bcd0bb56674868d62 (patch) | |
tree | e02a7fd958f536ce6cf38d386c3fa3162c217b5b | |
parent | ff81116cb967edc6707fe62217ad6a701d4d8d1f (diff) | |
download | qttools-ceb313d955294db3cd43a30bcd0bb56674868d62.tar.gz |
QDoc: Extract helper method from generateManifestFile (refactoring)
Improve readability of the calling code by extracting implementation details.
Task-number: QTBUG-37648
Task-number: QTBUG-71176
Change-Id: I840100b8e9fa4703274acb61597813250f73bb05
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
(cherry picked from commit f9e422f3361898155bce8651a074fdea6e65f5ed)
Reviewed-by: cherrypickbot
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 23 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.h | 1 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index a1a1cd876..3fc95b954 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -3841,6 +3841,21 @@ void HtmlGenerator::generateManifestFiles() } /*! + Retrieve the install path for the \a example as specified with + the \meta command, or fall back to the one defined in .qdocconf. + */ +QString HtmlGenerator::retrieveInstallPath(const ExampleNode *example) +{ + QString installPath = example->doc().metaTagMap().value(QLatin1String("installpath")); + if (installPath.isEmpty()) + installPath = examplesPath; + if (!installPath.isEmpty() && !installPath.endsWith(QLatin1Char('/'))) + installPath += QLatin1Char('/'); + + return installPath; +} + +/*! This function is called by generateManifestFiles(), once for each manifest file to be generated. \a manifest is the type of manifest file. @@ -3889,13 +3904,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString continue; } - // Retrieve the install path specified with \meta command, - // or fall back to the one defined in .qdocconf - QString installPath = en->doc().metaTagMap().value(QLatin1String("installpath")); - if (installPath.isEmpty()) - installPath = examplesPath; - if (!installPath.isEmpty() && !installPath.endsWith(QLatin1Char('/'))) - installPath += QLatin1Char('/'); + const QString installPath = retrieveInstallPath(en); // attributes that are always written for the element usedAttributes.clear(); usedAttributes << "name" diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h index c1a47ba33..753802c72 100644 --- a/src/qdoc/htmlgenerator.h +++ b/src/qdoc/htmlgenerator.h @@ -93,6 +93,7 @@ private: QSet<QString> tags; }; + QString retrieveInstallPath(const ExampleNode *exampleNode); void generateNavigationBar(const QString &title, const Node *node, CodeMarker *marker, const QString &buildversion, bool tableItems = false); void generateHeader(const QString &title, const Node *node = nullptr, |