summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorJerome Pasion <jerome.pasion@digia.com>2014-06-23 16:48:54 +0200
committerJerome Pasion <jerome.pasion@digia.com>2014-06-25 17:12:53 +0200
commitb7f8e7664a38e401c6af6f2447cd565422109f7a (patch)
treee3ddd4549eb9e1a543ef11064bc3c38c0f55e322 /src/tools
parent7ab6f24ac1f0b5877356f4781827bc8f65bbcdcf (diff)
qdoc: Improve <title> element contents in HTML pages.
-applied logic to projects that set (or not set): -landing page -home page -version -change would remove duplicate information and proper module names instead of "Title | QtModule 5.4", it would be "Title | Qt Module 5.4" -tested on various projects: -Digia projects -Qt 5 -Qt Creator Change-Id: Ica7d5203d293910c98306f947bfee8454b9225d0 Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 7547177eb3..b27968982a 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -1819,13 +1819,48 @@ void HtmlGenerator::generateHeader(const QString& title,
QString shortVersion = qdb_->version();
if (shortVersion.count(QChar('.')) == 2)
shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
- if (!project.isEmpty())
- shortVersion = QLatin1String(" | ") + project + QLatin1Char(' ') + shortVersion;
+
+ //determine the rest of the <title> element content: "title | titleSuffix version"
+ QString titleSuffix;
+ if (!landingpage.isEmpty()) {
+ //for normal pages: "title | landingpage version"
+ titleSuffix = landingpage;
+ }
+ else if (!homepage.isEmpty()) {
+ //for pages that set the homepage but not landing page: "title | homepage version"
+ if (title != homepage)
+ titleSuffix = homepage;
+ }
+ else if (!project.isEmpty()) {
+ //for projects outside of Qt or Qt 5: "title | project version"
+ if (title != project)
+ titleSuffix = project;
+ }
else
- shortVersion = QLatin1String(" | ") + QLatin1String("Qt ") + shortVersion ;
+ //default: "title | Qt version"
+ titleSuffix = QLatin1String("Qt ");
+
+ //for pages that duplicate the title and suffix (landing pages, home pages,
+ // and module landing pages, clear the duplicate
+ if (title == titleSuffix)
+ titleSuffix.clear();
+
+ //for pages that duplicate the version, clear the duplicate
+ if (title.contains(shortVersion) || titleSuffix.contains(shortVersion))
+ shortVersion.clear();
+
+ QString divider;
+ if (!titleSuffix.isEmpty() && !title.isEmpty())
+ divider = QLatin1String(" | ");
// Generating page title
- out() << " <title>" << protectEnc(title) << shortVersion << "</title>\n";
+ out() << " <title>"
+ << protectEnc(title)
+ << divider
+ << titleSuffix
+ << QLatin1Char(' ')
+ << shortVersion
+ << "</title>\n";
// Include style sheet and script links.
out() << headerStyles;