diff options
author | Martin Smith <martin.smith@nokia.com> | 2010-11-05 11:12:31 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2010-11-05 11:12:31 (GMT) |
commit | e2cffa74190833621d82697325d5cbbbb2aaec85 (patch) | |
tree | e1e370dd391e4009d3bffbdf8a96c2b03a5bd05c | |
parent | b2793a9b7f14508be5cf14bb19127e886b8f1492 (diff) | |
download | Qt-e2cffa74190833621d82697325d5cbbbb2aaec85.zip Qt-e2cffa74190833621d82697325d5cbbbb2aaec85.tar.gz Qt-e2cffa74190833621d82697325d5cbbbb2aaec85.tar.bz2 |
qdoc: First pass at generating a map.
Some files are missing, and I don't know if the syntax is complete.
But it's a start.
Task-number: QTBUG-14981
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 29 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.h | 1 | ||||
-rw-r--r-- | tools/qdoc3/pagegenerator.cpp | 7 |
3 files changed, 32 insertions, 5 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b69e731..bf7bd07 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -574,6 +574,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllSince(tree->root()); PageGenerator::generateTree(tree, marker); + writeDitaMap(); } void DitaXmlGenerator::startText(const Node* /* relative */, @@ -2285,7 +2286,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, xmlWriter().writeStartElement(nameElement); // <title> or <apiName> xmlWriter().writeCharacters(name); xmlWriter().writeEndElement(); // </title> or </apiName> - } /*! @@ -5573,4 +5573,31 @@ bool DitaXmlGenerator::canHandleFormat(const QString& format) return (format == "HTML") || (format == this->format()); } +void DitaXmlGenerator::writeDitaMap() +{ + beginSubPage(Location(),"qt-dita-map.xml"); + + QString doctype; + doctype = "<!DOCTYPE cxxAPIMap PUBLIC \"-//NOKIA//DTD DITA C++ API Map Reference Type v0.6.0//EN\" \"dtd/cxxAPIMap.dtd\">"; + + xmlWriter().writeDTD(doctype); + xmlWriter().writeStartElement("cxxAPIMap"); + xmlWriter().writeAttribute("id","Qt-DITA-Map"); + xmlWriter().writeAttribute("title","Qt DITA Map"); + xmlWriter().writeStartElement("topicmeta"); + xmlWriter().writeStartElement("shortdesc"); + xmlWriter().writeCharacters("The top level map for the Qt documentation"); + xmlWriter().writeEndElement(); // </shortdesc> + xmlWriter().writeEndElement(); // </topicmeta> + GuidMaps::iterator i = guidMaps.begin(); + while (i != guidMaps.end()) { + xmlWriter().writeStartElement("topicref"); + xmlWriter().writeAttribute("href",i.key()); + xmlWriter().writeAttribute("type","topic"); + xmlWriter().writeEndElement(); // </topicref> + ++i; + } + endSubPage(); +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index de949c2..6324204 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -270,6 +270,7 @@ class DitaXmlGenerator : public PageGenerator bool apiDesc, const QString& title); void addLink(const QString& href, const QStringRef& text); + void writeDitaMap(); private: QMap<QString, QString> refMap; diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 6ba562c..ca98faa 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -289,11 +289,10 @@ QString PageGenerator::outFileName() void PageGenerator::beginSubPage(const Location& location, const QString& fileName) { - QFile *outFile = new QFile(outputDir() + "/" + fileName); + QFile* outFile = new QFile(outputDir() + "/" + fileName); if (!outFile->open(QFile::WriteOnly)) - location.fatal(tr("Cannot open output file '%1'") - .arg(outFile->fileName())); - QTextStream *out = new QTextStream(outFile); + location.fatal(tr("Cannot open output file '%1'").arg(outFile->fileName())); + QTextStream* out = new QTextStream(outFile); out->setCodec(outputCodec); outStreamStack.push(out); } |