summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/ditaxmlgenerator.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2012-07-24 14:27:37 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-25 01:00:41 +0200
commita4cd6ef25df6a2a99626a0e97bfc239f68e7771f (patch)
treea95e458fe9f64b76ddcbabc0ec46554c017f6dba /src/tools/qdoc/ditaxmlgenerator.cpp
parent48d439833ac25c033a5c999a8f2dbf94561b5bca (diff)
qdoc: Fixed incorrect href attribute values in qdoc
There were two fileBase() functions, but only one was correct. The wrong one was being called in some cases. Now there is only one fileBase() function, which is always called. Task nr: QTBUG-26591 Change-Id: I2c40e2152a8c7ad1bb9db256ecf1367148f0e7f6 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'src/tools/qdoc/ditaxmlgenerator.cpp')
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp
index e309784ce1..f9506ff348 100644
--- a/src/tools/qdoc/ditaxmlgenerator.cpp
+++ b/src/tools/qdoc/ditaxmlgenerator.cpp
@@ -284,6 +284,29 @@ QString DitaXmlGenerator::ditaTags[] =
""
};
+/*!
+ Composes a string to be used as an href attribute in DITA
+ XML. It is composed of the file name and the UUID separated
+ by a '#'. If this node is a class node, the file name is
+ taken from this node; if this node is a function node, the
+ file name is taken from the parent node of this node.
+ */
+QString DitaXmlGenerator::ditaXmlHref(Node* n)
+{
+ QString href;
+ if ((n->type() == Node::Function) ||
+ (n->type() == Node::Property) ||
+ (n->type() == Node::Variable)) {
+ href = fileBase(n->parent());
+ }
+ else {
+ href = fileBase(n);
+ }
+ if (!href.endsWith(".xml") && !href.endsWith(".dita"))
+ href += ".dita";
+ return href + QLatin1Char('#') + n->guid();
+}
+
void DitaXmlGenerator::debugPara(const QString& t)
{
writeStartTag(DT_p);
@@ -4218,7 +4241,7 @@ void DitaXmlGenerator::generateIndex(const QString& fileBase,
const QString& url,
const QString& title)
{
- tree_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", url, title);
+ tree_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", url, title, this);
}
void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker)
@@ -4907,7 +4930,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s,
FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom();
if (rfn && !rfn->isInternal()) {
writeStartTag(DT_cxxFunctionReimplemented);
- xmlWriter().writeAttribute("href",rfn->ditaXmlHref());
+ xmlWriter().writeAttribute("href",ditaXmlHref(rfn));
writeCharacters(marker->plainFullName(rfn));
writeEndTag(); // </cxxFunctionReimplemented>
}
@@ -5299,7 +5322,7 @@ void DitaXmlGenerator::writeProperties(const Section& s,
if (pn->overriddenFrom() != 0) {
PropertyNode* opn = (PropertyNode*)pn->overriddenFrom();
writeStartTag(DT_cxxVariableReimplemented);
- xmlWriter().writeAttribute("href",opn->ditaXmlHref());
+ xmlWriter().writeAttribute("href",ditaXmlHref(opn));
writeCharacters(marker->plainFullName(opn));
writeEndTag(); // </cxxVariableReimplemented>
}
@@ -5461,7 +5484,7 @@ void DitaXmlGenerator::writeMacros(const Section& s,
if (fn->reimplementedFrom() != 0) {
FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom();
writeStartTag(DT_cxxDefineReimplemented);
- xmlWriter().writeAttribute("href",rfn->ditaXmlHref());
+ xmlWriter().writeAttribute("href",ditaXmlHref(rfn));
writeCharacters(marker->plainFullName(rfn));
writeEndTag(); // </cxxDefineReimplemented>
}