summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-09-14 10:08:27 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-09-14 10:52:43 -0300
commit62db9ea4bd4ba2815e3f3d0594cc78dcd8839163 (patch)
tree7680a027a0333ee654e07f839667302fb92dd8a8
parent53bd31b8564177a9f9871e715903c4cf43e079cf (diff)
downloadgeneratorrunner-62db9ea4bd4ba2815e3f3d0594cc78dcd8839163.tar.gz
generatorrunner-62db9ea4bd4ba2815e3f3d0594cc78dcd8839163.tar.xz
generatorrunner-62db9ea4bd4ba2815e3f3d0594cc78dcd8839163.zip
Fixed function link generated in documentation.
Fixes bug #986. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente <hugo.lima@openbossa.org>
-rw-r--r--generators/qtdoc/qtdocgenerator.cpp25
-rw-r--r--generators/qtdoc/qtdocgenerator.h1
2 files changed, 25 insertions, 1 deletions
diff --git a/generators/qtdoc/qtdocgenerator.cpp b/generators/qtdoc/qtdocgenerator.cpp
index 05a452a..d301a0c 100644
--- a/generators/qtdoc/qtdocgenerator.cpp
+++ b/generators/qtdoc/qtdocgenerator.cpp
@@ -99,6 +99,7 @@ static QString escape(const QStringRef& strref)
return escape(str);
}
+
QtXmlToSphinx::QtXmlToSphinx(QtDocGenerator* generator, const QString& doc, const QString& context)
: m_context(context), m_generator(generator), m_insideBold(false), m_insideItalic(false)
{
@@ -164,6 +165,26 @@ QString QtXmlToSphinx::popOutputBuffer()
return strcpy;
}
+QString QtXmlToSphinx::expandFunction(const QString& function)
+{
+ QStringList functionSpec = function.split('.');
+ QString className = functionSpec.first();
+ const AbstractMetaClass* metaClass = 0;
+ foreach (const AbstractMetaClass* cls, m_generator->classes()) {
+ if (cls->name() == className) {
+ metaClass = cls;
+ break;
+ }
+ }
+
+ if (metaClass) {
+ functionSpec.removeFirst();
+ return metaClass->typeEntry()->qualifiedTargetLangName() + "." + functionSpec.join(".");
+ } else {
+ return function;
+ }
+}
+
QString QtXmlToSphinx::resolveContextForMethod(const QString& methodName)
{
QString currentClass = m_context.split(".").last();
@@ -191,7 +212,7 @@ QString QtXmlToSphinx::resolveContextForMethod(const QString& methodName)
}
if (implementingClass)
- return implementingClass->name();
+ return implementingClass->typeEntry()->qualifiedTargetLangName();
}
return QLatin1String("~") + m_context;
@@ -576,6 +597,8 @@ void QtXmlToSphinx::handleLinkTag(QXmlStreamReader& reader)
QString context = resolveContextForMethod(rawlinklist.last());
if (!l_linkref.startsWith(context))
l_linkref.prepend(context + '.');
+ } else {
+ l_linkref = expandFunction(l_linkref);
}
} else if (l_type == "function" && m_context.isEmpty()) {
l_linktag = " :func:`";
diff --git a/generators/qtdoc/qtdocgenerator.h b/generators/qtdoc/qtdocgenerator.h
index fc8c82b..660d28b 100644
--- a/generators/qtdoc/qtdocgenerator.h
+++ b/generators/qtdoc/qtdocgenerator.h
@@ -93,6 +93,7 @@ public:
private:
QString resolveContextForMethod(const QString& methodName);
+ QString expandFunction(const QString& function);
QString transform(const QString& doc);
void handleHeadingTag(QXmlStreamReader& reader);