From 034e13e765874b25b56d16c9487efd2e98fe4518 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 20 Apr 2010 15:51:04 +0200 Subject: Doc: Cleaning HTML generator and updating index.qdoc Adding links to the index page and removing HTML attributes like align and valing form the HTML generator Reviewed-by: Martin Smith (cherry picked from commit 019af5ecb5dbc9c173109ba670180177713a51ad) --- tools/qdoc3/htmlgenerator.cpp | 123 ++++++++++++++-------------- tools/qdoc3/test/qt-html-templates.qdocconf | 18 ++-- 2 files changed, 68 insertions(+), 73 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 1192daf..68c27db 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -514,14 +514,14 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; break; case Atom::Code: - out() << "
"
+	out() << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "
\n"; break; #ifdef QDOC_QML case Atom::Qml: - out() << "
"
+	out() << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "
\n"; @@ -529,7 +529,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, #endif case Atom::CodeNew: out() << "

you can rewrite it as

\n" - << "
"
+              << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                  marker,relative))
               << "
\n"; @@ -538,9 +538,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "

For example, if you have code like

\n"; // fallthrough case Atom::CodeBad: - out() << "
"
+        out() << "
"
               << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))
-              << "
\n"; + << "
\n"; break; case Atom::FootnoteLeft: // ### For now @@ -849,7 +849,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (atom->type() == Atom::Image) - out() << "

"; + out() << "

"; if (fileName.isEmpty()) { out() << "[Missing image " << protectEnc(atom->string()) << "]"; @@ -868,7 +868,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ImageText: break; case Atom::LegaleseLeft: - out() << "

"; + out() << "
"; break; case Atom::LegaleseRight: out() << "
"; @@ -910,13 +910,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { - out() << "

" + out() << "
" << "" << "" << "\n"; } else { - out() << "

ConstantValueDescription
" + out() << "
" << "\n"; } } @@ -951,10 +951,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, else { // (atom->string() == ATOM_LIST_VALUE) // ### Trenton - out() << "
ConstantValue
" + out() << "
" << protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative))) - << ""; + << ""; QString itemValue; if (relative->type() == Node::Enum) { @@ -980,7 +980,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, } else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { - out() << ""; + out() << ""; if (matchAhead(atom, Atom::ListItemRight)) out() << " "; } @@ -1010,7 +1010,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "\n"; } else if (atom->string() == ATOM_LIST_VALUE) { - out() << "

\n"; + out() << "\n"; } else { out() << "\n"; @@ -1091,29 +1091,28 @@ int HtmlGenerator::generateAtom(const Atom *atom, } if (!atom->string().isEmpty()) { if (atom->string().contains("%")) - out() << "

string() << "\" " - << "align=\"center\">\n"; + out() << "
string() << "\">\n "; else { - out() << "

\n"; + out() << "
\n"; } } else { - out() << "

\n"; + out() << "
\n"; } numTableRows = 0; break; case Atom::TableRight: - out() << "

\n"; + out() << "\n"; break; case Atom::TableHeaderLeft: - out() << ""; + out() << ""; inTableHeader = true; break; case Atom::TableHeaderRight: out() << ""; if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; - out() << "\n"; + out() << "\n"; } else { out() << "\n"; @@ -1122,9 +1121,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::TableRowLeft: if (++numTableRows % 2 == 1) - out() << ""; + out() << ""; else - out() << ""; + out() << ""; break; case Atom::TableRowRight: out() << "\n"; @@ -1189,11 +1188,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "string()) << "\">"; break; case Atom::UnhandledFormat: - out() << "<Missing HTML>"; + out() << "<Missing HTML>"; break; case Atom::UnknownCommand: - out() << "\\" << protectEnc(atom->string()) - << ""; + out() << "\\" << protectEnc(atom->string()) + << ""; break; #ifdef QDOC_QML case Atom::QmlText: @@ -1811,7 +1810,7 @@ void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - out() << "
"
+        out() << "
"
               << trimmedTrailing(highlightedCode(indent(codeIndent,
                                                         marker->markedUpIncludes(inner->includes())),
                                                  marker,inner))
@@ -1845,8 +1844,8 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
 
     QString tdTag;
     if (numColumns > 1) {
-        tdTag = "";
-        out() << "

\n" + tdTag = "
"; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/ + out() << "\n" << tdTag << "\n"; } @@ -1898,7 +1897,7 @@ void HtmlGenerator::generateTableOfContents(const Node *node, } if (numColumns > 1) - out() << "

\n"; + out() << "
\n"; inContents = false; inLink = false; @@ -2011,7 +2010,7 @@ void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, { if (bar.prev.begin() != 0 || bar.current.begin() != 0 || bar.next.begin() != 0) { - out() << "

"; + out() << "

"; if (bar.prev.begin() != 0) { #if 0 out() << "[\n"; + out() << "
\n"; int row = 0; foreach (const QString &name, nodeMap.keys()) { @@ -2197,9 +2196,9 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, continue; if (++row % 2 == 1) - out() << ""; + out() << ""; else - out() << ""; + out() << ""; out() << ""; @@ -2219,7 +2218,7 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, } out() << "\n"; } - out() << "
"; generateFullName(node, relative, marker); out() << "

\n"; + out() << "\n"; } /*! @@ -2372,7 +2371,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, } firstOffset[NumColumns] = classMap.count(); - out() << "

\n"; + out() << "
\n"; for (k = 0; k < numRows; k++) { out() << "\n"; for (i = 0; i < NumColumns; i++) { @@ -2393,7 +2392,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, currentParagraphNo[i] = NumParagraphs - 1; } #endif - out() << "\n"; } - out() << "
"; + out() << ""; if (currentOffsetInParagraph[i] == 0) { // start a new paragraph out() << "" @@ -2436,18 +2435,18 @@ void HtmlGenerator::generateCompactList(const Node *relative, } out() << "

\n"; + out() << "\n"; } void HtmlGenerator::generateFunctionIndex(const Node *relative, CodeMarker *marker) { - out() << "

"; + out() << "

"; for (int i = 0; i < 26; i++) { QChar ch('a' + i); out() << QString("%2 ").arg(ch).arg(ch.toUpper()); } - out() << "

\n"; + out() << "

\n"; char nextLetter = 'a'; char currentLetter; @@ -2715,8 +2714,8 @@ void HtmlGenerator::generateSection(const NodeList& nl, } else { if (twoColumn) - out() << "

\n" - << "\n
"; + out() << "\n" + << "\n
"; out() << "
    \n"; } @@ -2729,12 +2728,11 @@ void HtmlGenerator::generateSection(const NodeList& nl, } if (name_alignment) { - out() << "
"; + out() << "
"; } else { if (twoColumn && i == (int) (nl.count() + 1) / 2) - out() << "
    \n"; + out() << "
    \n"; out() << "
  • "; } @@ -2751,7 +2749,7 @@ void HtmlGenerator::generateSection(const NodeList& nl, else { out() << "
\n"; if (twoColumn) - out() << "

\n"; + out() << "
\n"; } } } @@ -2777,8 +2775,8 @@ void HtmlGenerator::generateSectionList(const Section& section, } else { if (twoColumn) - out() << "

\n" - << "\n
"; + out() << "\n" + << "\n
"; out() << "
    \n"; } @@ -2791,12 +2789,11 @@ void HtmlGenerator::generateSectionList(const Section& section, } if (name_alignment) { - out() << "
"; + out() << "
"; } else { if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "
    \n"; + out() << "
    \n"; out() << "
  • "; } @@ -2813,7 +2810,7 @@ void HtmlGenerator::generateSectionList(const Section& section, else { out() << "
\n"; if (twoColumn) - out() << "

\n"; + out() << "
\n"; } } @@ -2910,7 +2907,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { if (nameAlignment && !done) {// && (i != 0)) Why was this here? - html += ""; + html += ""; done = true; } i += 2; @@ -3075,8 +3072,8 @@ void HtmlGenerator::generateSectionList(const Section& section, twoColumn = (section.members.count() >= 5); } if (twoColumn) - out() << "

\n" - << "\n
"; + out() << "\n" + << "\n
"; out() << "
    \n"; int i = 0; @@ -3088,7 +3085,7 @@ void HtmlGenerator::generateSectionList(const Section& section, } if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "
    \n"; + out() << "
    \n"; out() << "
  • "; if (style == CodeMarker::Accessors) @@ -3102,7 +3099,7 @@ void HtmlGenerator::generateSectionList(const Section& section, } out() << "
\n"; if (twoColumn) - out() << "

\n"; + out() << "
\n"; } if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { @@ -4274,15 +4271,15 @@ void HtmlGenerator::generateQmlSummary(const Section& section, twoColumn = (count >= 5); } if (twoColumn) - out() << "

\n" - << "\n
"; + out() << "\n" + << "\n
"; out() << "
    \n"; int row = 0; m = section.members.begin(); while (m != section.members.end()) { if (twoColumn && row == (int) (count + 1) / 2) - out() << "
    \n"; + out() << "
    \n"; out() << "
  • "; generateQmlItem(*m,relative,marker,true); out() << "
  • \n"; @@ -4291,7 +4288,7 @@ void HtmlGenerator::generateQmlSummary(const Section& section, } out() << "
\n"; if (twoColumn) - out() << "

\n"; + out() << "
\n"; } } @@ -4383,7 +4380,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, const Node* n = myTree->findNode(strList,Node::Fake); if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); - out() << "

"; + out() << "

"; Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4430,7 +4427,7 @@ void HtmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, { const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { - out() << "

"; + out() << "

"; Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4461,7 +4458,7 @@ void HtmlGenerator::generateInstantiatedBy(const ClassNode* cn, if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { - out() << "

"; + out() << "

"; Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 67a25f3..158aef3 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -2,7 +2,7 @@ HTML.stylesheets = style/style.css HTML.postheader = "

\n" \ "
\n" \ " Home
\n" \ - " Qt Reference Documentation\n" \ + " Qt Reference Documentation\n" \ "
\n" \ " \n" \ "
\n" \ "
\n" \ @@ -110,7 +110,6 @@ HTML.footer = "
\n" \ "
\n" \ " \n" \ "
\n" \ - " \n" \ "
\n" \ "

\n" \ " © 2008-2010 Nokia Corporation and/or its\n" \ @@ -121,10 +120,10 @@ HTML.footer = "

\n" \ " href=\"http://qt.nokia.com/about/privacy-policy\">Privacy Policy

\n" \ " \n" \ "
\n" \ - "
\n" \ "
\n" \ " X\n" \ "
\n" \ + " \n" \ " \n" \ " \n" \ @@ -132,7 +131,6 @@ HTML.footer = "
\n" \ " \n" \ "
\n" \ "
\n" \ - " \n" \ "