summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qdoc3/atom.cpp26
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp136
-rw-r--r--tools/qdoc3/generator.cpp13
3 files changed, 114 insertions, 61 deletions
diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp
index 88f44ea..6f1602e 100644
--- a/tools/qdoc3/atom.cpp
+++ b/tools/qdoc3/atom.cpp
@@ -241,25 +241,25 @@ static const struct {
{ 0, 0 }
};
-/*! \fn Atom::Atom( Type type, const QString& string )
+/*! \fn Atom::Atom(Type type, const QString& string)
Constructs an atom (\a type, \a string) outside of any atom list.
*/
-/*! \fn Atom( Atom *prev, Type type, const QString& string )
+/*! \fn Atom(Atom *prev, Type type, const QString& string)
Constructs an atom (\a type, \a string) that follows \a prev in \a
prev's atom list.
*/
-/*! \fn void Atom::appendChar( QChar ch )
+/*! \fn void Atom::appendChar(QChar ch)
Appends \a ch to the string parameter of this atom.
\also string()
*/
-/*! \fn void Atom::appendString( const QString& string )
+/*! \fn void Atom::appendString(const QString& string)
Appends \a string to the string parameter of this atom.
@@ -316,18 +316,18 @@ QString Atom::typeString() const
{
static bool deja = false;
- if ( !deja ) {
+ if (!deja) {
int i = 0;
- while ( atms[i].english != 0 ) {
- if ( atms[i].no != i )
- Location::internalError( tr("atom %1 missing").arg(i) );
+ while (atms[i].english != 0) {
+ if (atms[i].no != i)
+ Location::internalError(tr("atom %1 missing").arg(i));
i++;
}
deja = true;
}
int i = (int) type();
- if ( i < 0 || i > (int) Last )
+ if (i < 0 || i > (int) Last)
return QLatin1String("Invalid");
return QLatin1String(atms[i].english);
}
@@ -346,10 +346,10 @@ QString Atom::typeString() const
void Atom::dump() const
{
QString str = string();
- str.replace( "\\", "\\\\" );
- str.replace( "\"", "\\\"" );
- str.replace( "\n", "\\n" );
- str.replace( QRegExp("[^\x20-\x7e]"), "?" );
+ str.replace("\\", "\\\\");
+ str.replace("\"", "\\\"");
+ str.replace("\n", "\\n");
+ str.replace(QRegExp("[^\x20-\x7e]"), "?");
if (!str.isEmpty())
str = " \"" + str + "\"";
fprintf(stderr,
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index 93fd523..d2b20a6 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -579,7 +579,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
QString hx;
static bool in_para = false;
QString guid, hc;
-
+
switch (atom->type()) {
case Atom::AbstractLeft:
break;
@@ -1530,8 +1530,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker
/*
NOTE: For now we only handle \page elements.
*/
- if (fake->subType() != Node::Page)
- return;
+ //if (fake->subType() != Node::Page)
+ //return;
if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) {
subTitleSize = SmallSubTitle;
@@ -1542,28 +1542,56 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker
htmlTitle = fullTitle;
}
- generateHeader(fake);
-
- if (fake->subType() == Node::Page) {
- writer.writeStartElement("topic");
- writer.writeAttribute("id",fake->guid());
- writer.writeStartElement("title");
- writer.writeCharacters(fullTitle);
- writer.writeEndElement(); // </title>
+ QString outputclass;
+ switch (fake->subType()) {
+ case Node::Page:
+ outputclass = "page";
+ break;
+ case Node::Group:
+ outputclass = "group";
+ break;
+ case Node::Example:
+ outputclass = "example";
+ break;
+ case Node::HeaderFile:
+ outputclass = "header";
+ break;
+ case Node::File:
+ outputclass = "file";
+ break;
+ case Node::Image:
+ outputclass = "image";
+ break;
+ case Node::Module:
+ outputclass = "module";
+ break;
+ case Node::ExternalPage:
+ outputclass = "externalpage";
+ break;
+ case Node::QmlClass:
+ outputclass = "QML";
+ break;
+ default:
+ return;
+ }
- generateBrief(fake, marker); // <shortdesc>
+ generateHeader(fake);
+
+ writer.writeStartElement("topic");
+ writer.writeAttribute("id",fake->guid());
+ writer.writeAttribute("outputclass",outputclass);
+ writer.writeStartElement("title");
+ writer.writeCharacters(fullTitle);
+ writer.writeEndElement(); // </title>
+
+ generateBrief(fake, marker); // <shortdesc>
- if (!fake->doc().isEmpty()) {
- writer.writeStartElement("body");
- writer.writeStartElement("p");
- writer.writeAttribute("outputclass","h2");
- writer.writeCharacters("Detailed Description");
- writer.writeEndElement(); // </p>
- generateBody(fake, marker);
- writer.writeEndElement(); // </body>
- }
- writer.writeEndElement(); // </topic>
+ if (!fake->doc().isEmpty()) {
+ writer.writeStartElement("body");
+ generateBody(fake, marker);
+ writer.writeEndElement(); // </body>
}
+ writer.writeEndElement(); // </topic>
}
#if 0
@@ -1837,11 +1865,23 @@ void DitaXmlGenerator::generateHeader(const Node* node)
version + "//EN\" \"" + dtd + "\">";
}
else if (node->type() == Node::Fake) {
- if (node->subType() == Node::Page) {
+ switch (node->subType()) {
+ case Node::Page:
+ case Node::Group:
+ case Node::Example:
+ case Node::HeaderFile:
+ case Node::File:
+ case Node::Image:
+ case Node::Module:
+ case Node::ExternalPage:
+ case Node::QmlClass:
element = "topic";
dtd = "dtd/topic.dtd";
doctype = "<!DOCTYPE " + element +
" PUBLIC \"-//OASIS//DTD DITA Topic//EN\" \"" + dtd + "\">";
+ break;
+ default:
+ break;
}
}
@@ -2300,11 +2340,11 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative,
normally you let it figure it out itself by looking at
the name of the first and last classes in \a classMap.
*/
-void DitaXmlGenerator::generateCompactList(const Node *relative,
- CodeMarker *marker,
- const NodeMap &classMap,
- bool includeAlphabet,
- QString commonPrefix)
+void DitaXmlGenerator::generateCompactList(const Node* relative,
+ CodeMarker* marker,
+ const NodeMap& classMap,
+ bool includeAlphabet,
+ QString commonPrefix)
{
const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_'
@@ -2519,42 +2559,50 @@ void DitaXmlGenerator::generateCompactList(const Node *relative,
writer.writeEndElement(); // </p>
}
-void DitaXmlGenerator::generateFunctionIndex(const Node *relative,
- CodeMarker *marker)
+void DitaXmlGenerator::generateFunctionIndex(const Node* relative,
+ CodeMarker* marker)
{
- out() << "<p class=\"centerAlign functionIndex\"><b>";
+ writer.writeStartElement("p");
+ writer.writeAttribute("outputclass","centerAlign functionIndex");
+ writer.writeStartElement("b");
for (int i = 0; i < 26; i++) {
QChar ch('a' + i);
- out() << QString("<xref href=\"#%1\">%2</xref>&nbsp;").arg(ch).arg(ch.toUpper());
+ writer.writeStartElement("xref");
+ writer.writeAttribute("href",QString("#%1").arg(ch));
+ writer.writeCharacters(QString(ch.toUpper()));
+ writer.writeEndElement(); // </xref>
}
- out() << "</b></p>\n";
+ writer.writeEndElement(); // </b>
+ writer.writeEndElement(); // </p>
char nextLetter = 'a';
char currentLetter;
- out() << "<ul>\n";
+ writer.writeStartElement("ul");
QMap<QString, NodeMap >::ConstIterator f = funcIndex.begin();
while (f != funcIndex.end()) {
- out() << "<li>";
- out() << protectEnc(f.key()) << ":";
-
+ writer.writeStartElement("li");
currentLetter = f.key()[0].unicode();
while (islower(currentLetter) && currentLetter >= nextLetter) {
- out() << QString("<a name=\"%1\"></a>").arg(nextLetter);
+ writer.writeStartElement("p");
+ writeGuidAttribute(QString(nextLetter));
+ writer.writeAttribute("outputclass","target");
+ writer.writeCharacters(QString(nextLetter));
+ writer.writeEndElement(); // </p>
nextLetter++;
}
+ writer.writeCharacters(protectEnc(f.key()));
+ writer.writeCharacters(":");
NodeMap::ConstIterator s = (*f).begin();
while (s != (*f).end()) {
- out() << " ";
generateFullName((*s)->parent(), relative, marker, *s);
++s;
}
- out() << "</li>";
- out() << "\n";
+ writer.writeEndElement(); // </li>
++f;
}
- out() << "</ul>\n";
+ writer.writeEndElement(); // </ul>
}
void DitaXmlGenerator::generateLegaleseList(const Node *relative,
@@ -3596,7 +3644,7 @@ void DitaXmlGenerator::findAllSince(const InnerNode *node)
}
}
-void DitaXmlGenerator::findAllFunctions(const InnerNode *node)
+void DitaXmlGenerator::findAllFunctions(const InnerNode* node)
{
NodeList::ConstIterator c = node->childNodes().begin();
while (c != node->childNodes().end()) {
@@ -3605,7 +3653,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode *node)
findAllFunctions(static_cast<const InnerNode *>(*c));
}
else if ((*c)->type() == Node::Function) {
- const FunctionNode *func = static_cast<const FunctionNode *>(*c);
+ const FunctionNode* func = static_cast<const FunctionNode*>(*c);
if ((func->status() > Node::Obsolete) &&
(func->metaness() != FunctionNode::Ctor) &&
(func->metaness() != FunctionNode::Dtor)) {
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index 7f39be2..eee998a 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -54,6 +54,7 @@
#include "quoter.h"
#include "separator.h"
#include "tokenizer.h"
+#include "ditaxmlgenerator.h"
QT_BEGIN_NAMESPACE
@@ -385,16 +386,19 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
}
else if (node->type() == Node::Fake) {
const FakeNode *fake = static_cast<const FakeNode *>(node);
- if (fake->subType() == Node::Example)
+ if (fake->subType() == Node::Example) {
generateExampleFiles(fake, marker);
- else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image))
+ }
+ else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) {
quiet = true;
+ }
}
if (node->doc().isEmpty()) {
- if (!quiet && !node->isReimp()) // ### might be unnecessary
+ if (!quiet && !node->isReimp()) { // ### might be unnecessary
node->location().warning(tr("No documentation for '%1'")
.arg(marker->plainFullName(node)));
+ }
}
else {
if (node->type() == Node::Function) {
@@ -403,9 +407,10 @@ void Generator::generateBody(const Node *node, CodeMarker *marker)
generateReimplementedFrom(func, marker);
}
- if (!generateText(node->doc().body(), node, marker))
+ if (!generateText(node->doc().body(), node, marker)) {
if (node->isReimp())
return;
+ }
if (node->type() == Node::Enum) {
const EnumNode *enume = (const EnumNode *) node;