summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2012-03-19 10:31:27 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-20 14:19:24 +0100
commit71916282be0a3b5191602c1d942c77a6707aa993 (patch)
tree74f122ca3a1d40ccd4ad582c031509605d0e1de9 /src
parentd06de7f919f64b6e3d251b6644e2aba27751f030 (diff)
qdoc: Enable XSLTs to produce correct #include info.
qdoc no longer writes the expected "include" statment in a codeblock in the detailed description. It writes it as an <othermeta> element in the <prolog> instead. Change-Id: I303477dbba7f2383fb374a398c890760a15744de Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.cpp82
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.h1
2 files changed, 42 insertions, 41 deletions
diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp
index 9cb50a44f7..e9615445b9 100644
--- a/src/tools/qdoc/ditaxmlgenerator.cpp
+++ b/src/tools/qdoc/ditaxmlgenerator.cpp
@@ -1776,7 +1776,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
generateText(brief, nsn, marker);
writeEndTag(); // </p>
}
- generateIncludes(nsn, marker);
generateStatus(nsn, marker);
generateThreadSafeness(nsn, marker);
generateSince(nsn, marker);
@@ -1910,7 +1909,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
generateText(brief, cn, marker);
writeEndTag(); // </p>
}
- generateIncludes(cn, marker);
generateStatus(cn, marker);
generateInherits(cn, marker);
generateInheritedBy(cn, marker);
@@ -2034,7 +2032,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
generateText(brief, fn, marker);
writeEndTag(); // </p>
}
- generateIncludes(fn, marker);
generateStatus(fn, marker);
generateThreadSafeness(fn, marker);
generateSince(fn, marker);
@@ -2517,19 +2514,6 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker)
}
/*!
- Writes the \c {#include ...} required to include the class
- or namespace in a compilation.
- */
-void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* marker)
-{
- if (!inner->includes().isEmpty()) {
- writeStartTag(DT_codeblock);
- writeText(marker->markedUpIncludes(inner->includes()), marker, inner);
- writeEndTag(); // </codeblock>
- }
-}
-
-/*!
zzz
Generates a table of contents beginning at \a node.
Currently just returns without writing anything.
@@ -3487,15 +3471,16 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node,
}
/*!
- Renamed from highlightedCode() in the html generator. Writes
- the \a markedCode to the current XML stream.
+ Renamed from highlightedCode() in the html generator. Gets the text
+ from \a markedCode , and then the text is written to the current XML
+ stream.
*/
void DitaXmlGenerator::writeText(const QString& markedCode,
CodeMarker* marker,
const Node* relative)
{
QString src = markedCode;
- QString html;
+ QString text;
QStringRef arg;
QStringRef par1;
@@ -3528,7 +3513,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode,
for (int k = 0; k != 13; ++k) {
const QString & tag = spanTags[2 * k];
if (tag == QStringRef(&src, i, tag.length())) {
- html += spanTags[2 * k + 1];
+ text += spanTags[2 * k + 1];
i += tag.length();
handled = true;
break;
@@ -3545,20 +3530,20 @@ void DitaXmlGenerator::writeText(const QString& markedCode,
}
else {
// retain all others
- html += charLangle;
+ text += charLangle;
}
}
}
else {
- html += src.at(i);
+ text += src.at(i);
++i;
}
}
// replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(</@link>)"
// replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)" tags
- src = html;
- html = QString();
+ src = text;
+ text = QString();
static const QString markTags[] = {
// 0 1 2 3 4 5
"link", "type", "headerfile", "func", "param", "extra"
@@ -3571,18 +3556,18 @@ void DitaXmlGenerator::writeText(const QString& markedCode,
if (parseArg(src, markTags[k], &i, n, &arg, &par1)) {
const Node* n = 0;
if (k == 0) { // <@link>
- if (!html.isEmpty()) {
- writeCharacters(html);
- html.clear();
+ if (!text.isEmpty()) {
+ writeCharacters(text);
+ text.clear();
}
n = CodeMarker::nodeForString(par1.toString());
QString link = linkForNode(n, relative);
addLink(link, arg);
}
else if (k == 4) { // <@param>
- if (!html.isEmpty()) {
- writeCharacters(html);
- html.clear();
+ if (!text.isEmpty()) {
+ writeCharacters(text);
+ text.clear();
}
writeStartTag(DT_i);
//writeCharacters(" " + arg.toString());
@@ -3590,18 +3575,18 @@ void DitaXmlGenerator::writeText(const QString& markedCode,
writeEndTag(); // </i>
}
else if (k == 5) { // <@extra>
- if (!html.isEmpty()) {
- writeCharacters(html);
- html.clear();
+ if (!text.isEmpty()) {
+ writeCharacters(text);
+ text.clear();
}
writeStartTag(DT_tt);
writeCharacters(arg.toString());
writeEndTag(); // </tt>
}
else {
- if (!html.isEmpty()) {
- writeCharacters(html);
- html.clear();
+ if (!text.isEmpty()) {
+ writeCharacters(text);
+ text.clear();
}
par1 = QStringRef();
QString link;
@@ -3626,12 +3611,11 @@ void DitaXmlGenerator::writeText(const QString& markedCode,
}
}
else {
- html += src.at(i++);
+ text += src.at(i++);
}
}
-
- if (!html.isEmpty()) {
- writeCharacters(html);
+ if (!text.isEmpty()) {
+ writeCharacters(text);
}
}
@@ -6333,6 +6317,24 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner)
xmlWriter().writeAttribute("content",i.value());
writeEndTag(); // </othermeta>
}
+ if ((tagStack.first() == DT_cxxClass && !inner->includes().isEmpty()) ||
+ (inner->type() == Node::Fake && inner->subType() == Node::HeaderFile)) {
+ writeStartTag(DT_othermeta);
+ xmlWriter().writeAttribute("name","includeFile");
+ QString text;
+ QStringList::ConstIterator i = inner->includes().begin();
+ while (i != inner->includes().end()) {
+ if ((*i).startsWith("<") && (*i).endsWith(">"))
+ text += *i;
+ else
+ text += "<" + *i + ">";
+ ++i;
+ if (i != inner->includes().end())
+ text += "\n";
+ }
+ xmlWriter().writeAttribute("content",text);
+ writeEndTag(); // </othermeta>
+ }
writeEndTag(); // </metadata>
writeEndTag(); // </prolog>
}
diff --git a/src/tools/qdoc/ditaxmlgenerator.h b/src/tools/qdoc/ditaxmlgenerator.h
index c2bd309200..a4fc890dde 100644
--- a/src/tools/qdoc/ditaxmlgenerator.h
+++ b/src/tools/qdoc/ditaxmlgenerator.h
@@ -340,7 +340,6 @@ private:
const QString& name,
bool subpage = false);
void generateBrief(const Node* node, CodeMarker* marker);
- void generateIncludes(const InnerNode* inner, CodeMarker* marker);
void generateTableOfContents(const Node* node,
CodeMarker* marker,
Doc::Sections sectioningUnit,