diff options
author | Topi Reinio <topi.reinio@digia.com> | 2015-07-30 12:51:22 +0200 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@digia.com> | 2015-08-03 12:37:57 +0000 |
commit | 7b77ef6b0a28886296e8a551339eb2874470bfc2 (patch) | |
tree | aa3198a7a442f9f6ca34ac0e615ec15f3c8c459c /src/tools/qdoc/htmlgenerator.cpp | |
parent | 789c9954c788b6129b3b406db4d68b5bb52386b8 (diff) |
qdoc: Make \target and \keyword commands link as expected
When resolving targets added for each node, QDoc didn't run the
check recursively; this meant that \target and \keyword commands
did not link when used in documentation nodes that are not direct
children of the root node. There include e.g. documentation for
functions and QML properties/methods.
This commit fixes that issue, and also modifies the behavior of
\keyword slightly: Using a \keyword no longer generates a HTML
anchor reference. Instead, linking to a keyword links directly
to the parent item which defines the \keyword. This produces
cleaner HTML by omitting unnecessary anchors.
Change-Id: I87659642770a5372409ecb09cb576fbad295155e
Task-number: QTBUG-47286
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/htmlgenerator.cpp')
-rw-r--r-- | src/tools/qdoc/htmlgenerator.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index e345e1745d..ecccd48a6c 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -283,12 +283,17 @@ QString HtmlGenerator::format() */ void HtmlGenerator::generateKeywordAnchors(const Node* node) { + Q_UNUSED(node); + // Disabled: keywords always link to the top of the QDoc + // comment they appear in, and do not use a dedicated anchor. +#if 0 if (!node->doc().isEmpty()) { const QList<Atom*>& keywords = node->doc().keywords(); foreach (Atom* a, keywords) { out() << QLatin1String("<a name=\"") << Doc::canonicalTitle(a->string()) << QLatin1String("\"></a>"); } } +#endif } /*! @@ -3809,10 +3814,8 @@ QString HtmlGenerator::getAutoLink(const Atom *atom, const Node *relative, const link = linkForNode(*node, relative); if ((*node)->docSubtype() == Node::Image) link = "images/used-in-examples/" + link; - if (!ref.isEmpty()) - link += QLatin1Char('#') + ref; } - else if (!ref.isEmpty()) { + if (!ref.isEmpty()) { int hashtag = link.lastIndexOf(QChar('#')); if (hashtag != -1) link.truncate(hashtag); |