diff options
-rw-r--r-- | doc/src/examples/globalVariables.qdoc | 61 | ||||
-rwxr-xr-x | doc/src/template/style/style.css | 11 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 34 | ||||
-rw-r--r-- | tools/qdoc3/atom.cpp | 1 | ||||
-rw-r--r-- | tools/qdoc3/atom.h | 2 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 31 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.h | 2 | ||||
-rw-r--r-- | tools/qdoc3/doc.cpp | 70 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 21 |
9 files changed, 132 insertions, 101 deletions
diff --git a/doc/src/examples/globalVariables.qdoc b/doc/src/examples/globalVariables.qdoc index 8468abb..286efac 100644 --- a/doc/src/examples/globalVariables.qdoc +++ b/doc/src/examples/globalVariables.qdoc @@ -101,48 +101,25 @@ The \c xmlpatterns command loads and parses \c globals.gccxml, runs the XQuery \c reportGlobals.xq, and generates this report: - \raw HTML -<html xmlns="http://www.w3.org/1999/xhtml/" xml:lang="en" lang="en"> - <head> - <title>Global variables report for globals.gccxml</title> - </head> - <style type="text/css"> - .details - { - text-align: left; - font-size: 80%; - color: blue - } - .variableName - { - font-family: courier; - color: blue - } - </style> - <body> - <p class="details">Start report: 2008-12-16T13:43:49.65Z</p> - <p>Global variables with complex types:</p> - <ol> - <li> - <span class="variableName">mutableComplex1</span> in globals.cpp at line 14</li> - <li> - <span class="variableName">mutableComplex2</span> in globals.cpp at line 15</li> - <li> - <span class="variableName">constComplex1</span> in globals.cpp at line 16</li> - <li> - <span class="variableName">constComplex2</span> in globals.cpp at line 17</li> - </ol> - <p>Mutable global variables with primitives types:</p> - <ol> - <li> - <span class="variableName">mutablePrimitive1</span> in globals.cpp at line 1</li> - <li> - <span class="variableName">mutablePrimitive2</span> in globals.cpp at line 2</li> - </ol> - <p class="details">End report: 2008-12-16T13:43:49.65Z</p> - </body> -</html> - \endraw + \div {class="details"} + Start report: 2008-12-16T13:43:49.65Z + \enddiv + + Global variables with complex types: + \list 1 + \o \span {class="variableName"} {mutableComplex1} in globals.cpp at line 14 + \o \span {class="variableName"} {mutableComplex2} in globals.cpp at line 15 + \o \span {class="variableName"} {constComplex1} in globals.cpp at line 16 + \o \span {class="variableName"} {constComplex2} in globals.cpp at line 17 + \endlist + + Mutable global variables with primitives types: + \list 1 + \o \span {class="variableName"} {mutablePrimitive1} in globals.cpp at line 1 + \o \span {class="variableName"} {mutablePrimitive2} in globals.cpp at line 2 + \endlist + + \div {class="details"} End report: 2008-12-16T13:43:49.65Z \enddiv \section1 XQuery Code Walk-Through diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 7af5141..b32b025 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -1204,6 +1204,17 @@ margin: 15px; } + .details + { + text-align: left; + font-size: 80%; + color: blue + } + .variableName + { + font-family: courier; + color: blue + } .qmltype { diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 060b979..e1a1fff 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -233,23 +233,23 @@ Qt's predefined QColor objects: - \value white \div {id="color-white"} White (#ffffff) \enddiv - \value black \div {id="color-black"} Black (#000000) \enddiv - \value red \div {id="color-red"} Red (#ff0000) \enddiv - \value darkRed \div {id="color-darkRed"} Dark red (#800000) \enddiv - \value green \div {id="color-green"} Green (#00ff00) \enddiv - \value darkGreen \div {id="color-darkGreen"} Dark green (#008000) \enddiv - \value blue \div {id="color-blue"} Blue (#0000ff) \enddiv - \value darkBlue \div {id="color-darkBlue"} Dark blue (#000080) \enddiv - \value cyan \div {id="color-cyan"} Cyan (#00ffff) \enddiv - \value darkCyan \div {id="color-darkCyan"} Dark cyan (#008080) \enddiv - \value magenta \div {id="color-magenta"} Magenta (#ff00ff) \enddiv - \value darkMagenta \div {id="color-darkMagenta"} Dark magenta (#800080) \enddiv - \value yellow \div {id="color-yellow"} Yellow (#ffff00) \enddiv - \value darkYellow \div {id="color-darkYellow"} Dark yellow (#808000) \enddiv - \value gray \div {id="color-gray"} Gray (#a0a0a4) \enddiv - \value darkGray \div {id="color-darkGray"} Dark gray (#808080) \enddiv - \value lightGray \div {id="color-lightGray"} Light gray (#c0c0c0) \enddiv + \value white \span {id="color-white"} {White (#ffffff) } + \value black \span {id="color-black"} {Black (#000000) } + \value red \span {id="color-red"} {Red (#ff0000) } + \value darkRed \span {id="color-darkRed"} {Dark red (#800000) } + \value green \span {id="color-green"} {Green (#00ff00) } + \value darkGreen \span {id="color-darkGreen"} {Dark green (#008000) } + \value blue \span {id="color-blue"} {Blue (#0000ff) } + \value darkBlue \span {id="color-darkBlue"} {Dark blue (#000080) } + \value cyan \span {id="color-cyan"} {Cyan (#00ffff) } + \value darkCyan \span {id="color-darkCyan"} {Dark cyan (#008080) } + \value magenta \span {id="color-magenta"} {Magenta (#ff00ff) } + \value darkMagenta \span {id="color-darkMagenta"} {Dark magenta (#800080) } + \value yellow \span {id="color-yellow"} {Yellow (#ffff00) } + \value darkYellow \span {id="color-darkYellow"} {Dark yellow (#808000) } + \value gray \span {id="color-gray"} {Gray (#a0a0a4) } + \value darkGray \span {id="color-darkGray"} {Dark gray (#808080) } + \value lightGray \span {id="color-lightGray"} {Light gray (#c0c0c0) } \value transparent a transparent black value (i.e., QColor(0, 0, 0, 0)) \value color0 0 pixel value (for bitmaps) \value color1 1 pixel value (for bitmaps) diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index ef5b6c8..e6647ed 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -51,6 +51,7 @@ QString Atom::INDEX_ ("index"); QString Atom::ITALIC_ ("italic"); QString Atom::LINK_ ("link"); QString Atom::PARAMETER_ ("parameter"); +QString Atom::SPAN_ ("span"); QString Atom::SUBSCRIPT_ ("subscript"); QString Atom::SUPERSCRIPT_ ("superscript"); QString Atom::TELETYPE_ ("teletype"); diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index c2b7cd6..325df28 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -189,6 +189,7 @@ class Atom static QString ITALIC_; static QString LINK_; static QString PARAMETER_; + static QString SPAN_; static QString SUBSCRIPT_; static QString SUPERSCRIPT_; static QString TELETYPE_; @@ -214,6 +215,7 @@ class Atom #define ATOM_FORMATTING_ITALIC "italic" #define ATOM_FORMATTING_LINK "link" #define ATOM_FORMATTING_PARAMETER "parameter" +#define ATOM_FORMATTING_SPAN "span " #define ATOM_FORMATTING_SUBSCRIPT "subscript" #define ATOM_FORMATTING_SUPERSCRIPT "superscript" #define ATOM_FORMATTING_TELETYPE "teletype" diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 667bf80..bc97dcd 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -202,6 +202,7 @@ QString DitaXmlGenerator::ditaTags[] = "fig", "i", "image", + "keyword", "li", "link", "linktext", @@ -209,6 +210,7 @@ QString DitaXmlGenerator::ditaTags[] = "ol", "p", "parameter", + "ph", "pre", "related-links", "row", @@ -759,6 +761,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, t = DT_i; else if (atom->string() == ATOM_FORMATTING_TELETYPE) t = DT_tt; + else if (atom->string().startsWith("span ")) { + t = DT_keyword; + } else if (atom->string() == ATOM_FORMATTING_UNDERLINE) t = DT_u; else if (atom->string() == ATOM_FORMATTING_INDEX) @@ -782,6 +787,32 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } } } + else if (t == DT_keyword) { + QString attr = atom->string().mid(5); + if (!attr.isEmpty()) { + if (attr.contains('=')) { + int index = 0; + int from = 0; + QString values; + while (index >= 0) { + index = attr.indexOf('"',from); + if (index >= 0) { + ++index; + from = index; + index = attr.indexOf('"',from); + if (index > from) { + if (!values.isEmpty()) + values.append(' '); + values += attr.mid(from,index-from); + from = index+1; + } + } + } + attr = values; + } + } + xmlWriter().writeAttribute("outputclass", attr); + } } break; case Atom::FormattingRight: diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 4676770..488c5b0 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -193,6 +193,7 @@ class DitaXmlGenerator : public PageGenerator DT_fig, DT_i, DT_image, + DT_keyword, DT_li, DT_link, DT_linktext, @@ -200,6 +201,7 @@ class DitaXmlGenerator : public PageGenerator DT_ol, DT_p, DT_parameter, + DT_ph, DT_pre, DT_relatedLinks, DT_row, diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index e54b7dd..391eada7 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -91,8 +91,8 @@ enum { CMD_QUOTEFROMFILE, CMD_QUOTEFUNCTION, CMD_RAW, CMD_ROW, CMD_SA, CMD_SECTION1, CMD_SECTION2, CMD_SECTION3, CMD_SECTION4, CMD_SIDEBAR, CMD_SINCELIST, CMD_SKIPLINE, - CMD_SKIPTO, CMD_SKIPUNTIL, CMD_SNIPPET, CMD_SUB, CMD_SUP, - CMD_TABLE, CMD_TABLEOFCONTENTS, CMD_TARGET, CMD_TT, + CMD_SKIPTO, CMD_SKIPUNTIL, CMD_SNIPPET, CMD_SPAN, CMD_SUB, + CMD_SUP, CMD_TABLE, CMD_TABLEOFCONTENTS, CMD_TARGET, CMD_TT, CMD_UNDERLINE, CMD_UNICODE, CMD_VALUE, CMD_WARNING, #ifdef QDOC_QML CMD_QML, CMD_ENDQML, CMD_CPP, CMD_ENDCPP, CMD_QMLTEXT, @@ -184,6 +184,7 @@ static struct { { "skipto", CMD_SKIPTO, 0 }, { "skipuntil", CMD_SKIPUNTIL, 0 }, { "snippet", CMD_SNIPPET, 0 }, + { "span", CMD_SPAN, 0 }, { "sub", CMD_SUB, 0 }, { "sup", CMD_SUP, 0 }, { "table", CMD_TABLE, 0 }, @@ -368,7 +369,6 @@ class DocParser void appendChar(QChar ch); void appendWord(const QString &word); void appendToCode(const QString &code); - void startNewPara(); void enterPara(Atom::Type leftType = Atom::ParaLeft, Atom::Type rightType = Atom::ParaRight, const QString& string = ""); @@ -405,11 +405,10 @@ class DocParser DocPrivate* priv; enum ParagraphState { - OutsidePara, - InSingleLinePara, - InMultiLinePara + OutsideParagraph, + InSingleLineParagraph, + InMultiLineParagraph }; - QStack<ParagraphState> paragraphStateStack; ParagraphState paraState; bool inTableHeader; bool inTableRow; @@ -457,8 +456,7 @@ void DocParser::parse(const QString& source, priv = docPrivate; priv->text << Atom::Nop; - paragraphStateStack.clear(); - paraState = OutsidePara; + paraState = OutsideParagraph; inTableHeader = false; inTableRow = false; inTableItem = false; @@ -569,7 +567,6 @@ void DocParser::parse(const QString& source, case CMD_DIV: leavePara(); p1 = getArgument(true); - //enterPara(Atom::DivLeft, Atom::DivRight, p1); append(Atom::DivLeft, p1); openedCommands.push(cmd); break; @@ -657,7 +654,7 @@ void DocParser::parse(const QString& source, if (closeCommand(cmd)) { leavePara(); append(Atom::FootnoteRight); - paraState = InMultiLinePara; // ### + paraState = InMultiLineParagraph; // ### } break; case CMD_ENDIF: @@ -744,7 +741,7 @@ void DocParser::parse(const QString& source, if (openCommand(cmd)) { enterPara(); append(Atom::FootnoteLeft); - paraState = OutsidePara; // ### + paraState = OutsideParagraph; // ### } break; case CMD_ANNOTATEDLIST: @@ -804,7 +801,7 @@ void DocParser::parse(const QString& source, append(Atom::String, " "); break; case CMD_INDEX: - if (paraState == OutsidePara) { + if (paraState == OutsideParagraph) { enterPara(); indexStartedPara = true; } @@ -1106,6 +1103,10 @@ void DocParser::parse(const QString& source, append(Atom::CodeQuoteArgument, getRestOfLine()); } break; + case CMD_SPAN: + p1 = ATOM_FORMATTING_SPAN + getArgument(true); + startFormat(p1, cmd); + break; case CMD_SNIPPET: leavePara(); { @@ -1196,7 +1197,8 @@ void DocParser::parse(const QString& source, } break; case CMD_WARNING: - startNewPara(); + leavePara(); + enterPara(); append(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); append(Atom::String, "Warning:"); append(Atom::FormattingRight, ATOM_FORMATTING_BOLD); @@ -1286,8 +1288,7 @@ void DocParser::parse(const QString& source, braceDepth--; pos++; - QMap<int, QString>::Iterator f = - pendingFormats.find(braceDepth); + QMap<int, QString>::Iterator f = pendingFormats.find(braceDepth); if (f == pendingFormats.end()) { enterPara(); appendChar('}'); @@ -1324,7 +1325,7 @@ void DocParser::parse(const QString& source, newWord = false; } - if (paraState == OutsidePara) { + if (paraState == OutsideParagraph) { if (ch.isSpace()) { ++pos; newWord = false; @@ -1338,7 +1339,7 @@ void DocParser::parse(const QString& source, if (ch.isSpace()) { ++pos; if ((ch == '\n') && - (paraState == InSingleLinePara || + (paraState == InSingleLineParagraph || isBlankLine())) { leavePara(); newWord = false; @@ -1702,8 +1703,7 @@ bool DocParser::closeCommand(int endCmd) } } else { - location().warning(tr("Unexpected '\\%1'") - .arg(cmdName(endCmd))); + location().warning(tr("Unexpected '\\%1'").arg(cmdName(endCmd))); } return false; } @@ -1882,31 +1882,27 @@ void DocParser::appendToCode(const QString& markedCode) priv->text.lastAtom()->appendString(markedCode); } -void DocParser::startNewPara() -{ - leavePara(); - enterPara(); -} - void DocParser::enterPara(Atom::Type leftType, Atom::Type rightType, const QString& string) { - if (paraState == OutsidePara) { + if (paraState == OutsideParagraph) { + if ((priv->text.lastAtom()->type() != Atom::ListItemLeft) && (priv->text.lastAtom()->type() != Atom::DivLeft)) { leaveValueList(); } + append(leftType, string); indexStartedPara = false; pendingParaLeftType = leftType; pendingParaRightType = rightType; pendingParaString = string; if (leftType == Atom::SectionHeadingLeft) { - paraState = InSingleLinePara; + paraState = InSingleLineParagraph; } else { - paraState = InMultiLinePara; + paraState = InMultiLineParagraph; } skipSpacesOrOneEndl(); } @@ -1914,7 +1910,7 @@ void DocParser::enterPara(Atom::Type leftType, void DocParser::leavePara() { - if (paraState != OutsidePara) { + if (paraState != OutsideParagraph) { if (!pendingFormats.isEmpty()) { location().warning(tr("Missing '}'")); pendingFormats.clear(); @@ -1930,7 +1926,7 @@ void DocParser::leavePara() } append(pendingParaRightType, pendingParaString); } - paraState = OutsidePara; + paraState = OutsideParagraph; indexStartedPara = false; pendingParaRightType = Atom::Nop; pendingParaString = ""; @@ -2164,10 +2160,8 @@ QString DocParser::getArgument(bool verbatim) location().warning(tr("Missing '}'")); } else { - while (pos < in.length() && - ((delimDepth > 0) || - ((delimDepth == 0) && - !in[pos].isSpace()))) { + while ((pos < in.length()) && + ((delimDepth > 0) || ((delimDepth == 0) && !in[pos].isSpace()))) { switch (in[pos].unicode()) { case '(': case '[': @@ -2372,6 +2366,9 @@ bool DocParser::isLeftBraceAhead() return numEndl < 2 && i < len && in[i] == '{'; } +/*! + Skips to the next non-space character or EOL. + */ void DocParser::skipSpacesOnLine() { while ((pos < in.length()) && @@ -2380,6 +2377,9 @@ void DocParser::skipSpacesOnLine() ++pos; } +/*! + Skips spaces and on EOL. + */ void DocParser::skipSpacesOrOneEndl() { int firstEndl = -1; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index e095685..1623ea8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -548,7 +548,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::FormatIf: break; case Atom::FormattingLeft: - out() << formattingLeftMap()[atom->string()]; + if (atom->string().startsWith("span ")) { + out() << "<" + atom->string() << ">"; + } + else + out() << formattingLeftMap()[atom->string()]; if (atom->string() == ATOM_FORMATTING_PARAMETER) { if (atom->next() != 0 && atom->next()->type() == Atom::String) { QRegExp subscriptRegExp("([a-z]+)_([0-9n])"); @@ -564,6 +568,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (atom->string() == ATOM_FORMATTING_LINK) { endLink(); } + else if (atom->string().startsWith("span ")) { + out() << "</span>"; + } else { out() << formattingRightMap()[atom->string()]; } @@ -948,10 +955,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, else { // (atom->string() == ATOM_LIST_VALUE) // ### Trenton - out() << "<tr><td class=\"topAlign\"><tt>" + out() << "<tr><td class=\"topAlign\"><tt>" << protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative))) - << "</tt></td><td class=\" topAlign\">"; + << "</tt></td><td class=\"topAlign\">"; QString itemValue; if (relative->type() == Node::Enum) { @@ -977,7 +984,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, } else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { - out() << "</td><td class=\"topAlign\">"; + out() << "</td><td class=\"topAlign\">"; if (matchAhead(atom, Atom::ListItemRight)) out() << " "; } @@ -2601,7 +2608,7 @@ void HtmlGenerator::generateSection(const NodeList& nl, else { if (twoColumn) out() << "<table class=\"propsummary\">\n" - << "<tr><td class=\"topAlign\">"; + << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; } @@ -2618,7 +2625,7 @@ void HtmlGenerator::generateSection(const NodeList& nl, } else { if (twoColumn && i == (int) (nl.count() + 1) / 2) - out() << "</ul></td><td class=\"topAlign\"><ul>\n"; + out() << "</ul></td><td class=\"topAlign\"><ul>\n"; out() << "<li class=\"fn\">"; } @@ -2662,7 +2669,7 @@ void HtmlGenerator::generateSectionList(const Section& section, else { if (twoColumn) out() << "<table class=\"propsummary\">\n" - << "<tr><td class=\"topAlign\">"; + << "<tr><td class=\"topAlign\">"; out() << "<ul>\n"; } |