diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/linguist/phrasebooks/russian.qph | 2 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 49 | ||||
-rw-r--r-- | tools/qdoc3/pagegenerator.cpp | 106 | ||||
-rw-r--r-- | tools/qdoc3/pagegenerator.h | 11 | ||||
-rw-r--r-- | tools/qdoc3/qdoc3.pro | 2 |
5 files changed, 133 insertions, 37 deletions
diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph index ae1a9b9..750fda0 100644 --- a/tools/linguist/phrasebooks/russian.qph +++ b/tools/linguist/phrasebooks/russian.qph @@ -826,7 +826,7 @@ </phrase> <phrase> <source>slider</source> - <target>ползунок</target> + <target>регулятор</target> </phrase> <phrase> <source>spin box</source> diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b103981..bf80277 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1711,62 +1711,49 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, if (node->type() == Node::Class) { const ClassNode* cn = static_cast<const ClassNode*>(node); QString name = node->moduleName(); - out() << " <li><a href=\"modules.html\">All Modules</a></li>"; + out() << " <li><a href=\"modules.html\">Modules</a></li>"; if (!name.isEmpty()) { out() << " <li>"; breadcrumb << Atom(Atom::AutoLink,name); generateText(breadcrumb, node, marker); out() << "</li>\n"; } - breadcrumb.clear(); - if (!cn->name().isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,cn->name()); - generateText(breadcrumb, 0, marker); - out() << "</li>\n"; - } + if (!cn->name().isEmpty()) + out() << " <li>" << cn->name() << "</li>\n"; } else if (node->type() == Node::Fake) { const FakeNode* fn = static_cast<const FakeNode*>(node); if (node->subType() == Node::Module) { - out() << " <li><a href=\"modules.html\">All Modules</a></li>"; + out() << " <li><a href=\"modules.html\">Modules</a></li>"; QString name = node->name(); - if (!name.isEmpty()) { - out() << " <li>"; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, 0, marker); - out() << "</li>\n"; - } + if (!name.isEmpty()) + out() << " <li>" << name << "</li>\n"; } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) - out() << " <li><a href=\"modules.html\">All Modules</a></li>"; + out() << " <li>Modules</li>"; else { - out() << " <li><a href=\"" << fn->name() << "\">" << title - << "</a></li>"; + out() << " <li>" << title << "</li>"; } } else if (node->subType() == Node::Page) { if (fn->name() == QString("examples.html")) { - out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; + out() << " <li>Examples</li>"; } else if (fn->name().startsWith("examples-")) { out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; - out() << " <li><a href=\"" << fn->name() << "\">" << title - << "</a></li>"; + out() << " <li>" << title << "</li>"; } else if (fn->name() == QString("namespaces.html")) { - out() << " <li><a href=\"namespaces.html\">All Namespaces</a></li>"; + out() << " <li>Namespaces</li>"; } else { - out() << " <li><a href=\"" << fn->name() << "\">" << title - << "</a></li>"; + out() << " <li>" << title << "</li>"; } } else if (node->subType() == Node::QmlClass) { out() << " <li><a href=\"qdeclarativeelements.html\">QML Elements</a></li>"; - out() << " <li><a href=\"" << fn->name() << "\">" << title - << "</a></li>"; + out() << " <li>" << title << "</li>"; } else if (node->subType() == Node::Example) { out() << " <li><a href=\"all-examples.html\">Examples</a></li>"; @@ -1775,16 +1762,12 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, QString t = CodeParser::titleFromName(name); out() << " <li><a href=\"" << name << "\">" << t << "</a></li>"; - out() << " <li><a href=\"" << sl.at(0) - << "-" << sl.at(sl.size()-1) << ".html\">" - << title << "</a></li>"; + out() << " <li>" << title << "</li>"; } } else if (node->type() == Node::Namespace) { - const NamespaceNode* nsn = static_cast<const NamespaceNode*>(node); - out() << " <li><a href=\"namespaces.html\">All Namespaces</a></li>"; - out() << " <li><a href=\"" << fileName(nsn) << "\">" << title - << "</a></li>"; + out() << " <li><a href=\"namespaces.html\">Namespaces</a></li>"; + out() << " <li>" << title << "</li>"; } } diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index f0f14fe..13c83a8 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -45,7 +45,7 @@ #include <qfile.h> #include <qfileinfo.h> - +#include <qdebug.h> #include "pagegenerator.h" #include "tree.h" @@ -68,6 +68,110 @@ PageGenerator::~PageGenerator() endSubPage(); } +static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); +static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)(</@func>)"); +static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(</@\\2>)"); +static QRegExp spanTag("</@(?:comment|preprocessor|string|char)>"); +static QRegExp unknownTag("</?@[^>]*>"); + +bool PageGenerator::parseArg(const QString& src, + const QString& tag, + int* pos, + int n, + QStringRef* contents, + QStringRef* par1, + bool debug) +{ +#define SKIP_CHAR(c) \ + if (debug) \ + qDebug() << "looking for " << c << " at " << QString(src.data() + i, n - i); \ + if (i >= n || src[i] != c) { \ + if (debug) \ + qDebug() << " char '" << c << "' not found"; \ + return false; \ + } \ + ++i; + + +#define SKIP_SPACE \ + while (i < n && src[i] == ' ') \ + ++i; + + int i = *pos; + int j = i; + + // assume "<@" has been parsed outside + //SKIP_CHAR('<'); + //SKIP_CHAR('@'); + + if (tag != QStringRef(&src, i, tag.length())) { + if (0 && debug) + qDebug() << "tag " << tag << " not found at " << i; + return false; + } + + if (debug) + qDebug() << "haystack:" << src << "needle:" << tag << "i:" <<i; + + // skip tag + i += tag.length(); + + // parse stuff like: linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); + if (par1) { + SKIP_SPACE; + // read parameter name + j = i; + while (i < n && src[i].isLetter()) + ++i; + if (src[i] == '=') { + if (debug) + qDebug() << "read parameter" << QString(src.data() + j, i - j); + SKIP_CHAR('='); + SKIP_CHAR('"'); + // skip parameter name + j = i; + while (i < n && src[i] != '"') + ++i; + *par1 = QStringRef(&src, j, i - j); + SKIP_CHAR('"'); + SKIP_SPACE; + } else { + if (debug) + qDebug() << "no optional parameter found"; + } + } + SKIP_SPACE; + SKIP_CHAR('>'); + + // find contents up to closing "</@tag> + j = i; + for (; true; ++i) { + if (i + 4 + tag.length() > n) + return false; + if (src[i] != '<') + continue; + if (src[i + 1] != '/') + continue; + if (src[i + 2] != '@') + continue; + if (tag != QStringRef(&src, i + 3, tag.length())) + continue; + if (src[i + 3 + tag.length()] != '>') + continue; + break; + } + + *contents = QStringRef(&src, j, i - j); + + i += tag.length() + 4; + + *pos = i; + if (debug) + qDebug() << " tag " << tag << " found: pos now: " << i; + return true; +#undef SKIP_CHAR +} + /*! This function is recursive. */ diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h index 7ab7e5e..1aa24a1 100644 --- a/tools/qdoc3/pagegenerator.h +++ b/tools/qdoc3/pagegenerator.h @@ -80,10 +80,17 @@ class PageGenerator : public Generator QString naturalLanguage; QString outputEncoding; - QTextCodec *outputCodec; + QTextCodec* outputCodec; + bool parseArg(const QString& src, + const QString& tag, + int* pos, + int n, + QStringRef* contents, + QStringRef* par1 = 0, + bool debug = false); private: - QStack<QTextStream *> outStreamStack; + QStack<QTextStream*> outStreamStack; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 81ff93a..5bedc29 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -37,6 +37,7 @@ HEADERS += apigenerator.h \ cppcodeparser.h \ cpptoqsconverter.h \ dcfsection.h \ + ditaxmlgenerator.h \ doc.h \ editdistance.h \ generator.h \ @@ -81,6 +82,7 @@ SOURCES += apigenerator.cpp \ cppcodeparser.cpp \ cpptoqsconverter.cpp \ dcfsection.cpp \ + ditaxmlgenerator.cpp \ doc.cpp \ editdistance.cpp \ generator.cpp \ |