From f9400e81d6e817eb16651e01bb3710cf8562c926 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 7 Jan 2011 08:32:24 +0100 Subject: qdoc: Replaced many raw-html cases with \div {something}. --- doc/src/template/style/style.css | 92 ++++++++++++++++++++++++++++++++++++-- src/corelib/global/qnamespace.qdoc | 90 +++++++------------------------------ tools/qdoc3/atom.cpp | 7 +-- tools/qdoc3/atom.h | 40 ++++++++--------- tools/qdoc3/ditaxmlgenerator.cpp | 4 +- tools/qdoc3/doc.cpp | 50 +++++++++++++++------ tools/qdoc3/htmlgenerator.cpp | 16 ++++--- 7 files changed, 178 insertions(+), 121 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 4005a8a..5f60199 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -198,6 +198,92 @@ clear: right } + #color-white + { + background: #ffffff; + color: #000000; + } + #color-black + { + background: #000000; + color: #ffffff; + } + #color-red + { + background: #ff0000; + color: #000000; + } + #color-darkRed + { + background: #800000; + color: #ffffff; + } + #color-green + { + background: #00ff00; + color: #000000; + } + #color-darkGreen + { + background: #008000; + color: #ffffff; + } + #color-blue + { + background: #0000ff; + color: #ffffff; + } + #color-darkBlue + { + background: #000080; + color: #ffffff; + } + #color-cyan + { + background: #00ffff; + color: #000000; + } + #color-darkCyan + { + background: #008080; + color: #ffffff; + } + #color-magenta + { + background: #ff00ff; + color: #000000; + } + #color-darkMagenta + { + background: #800080; + color: #ffffff; + } + #color-yellow + { + background: #ffff00; + color: #000000; + } + #color-darkYellow + { + background: #808000; + color: #ffffff; + } + #color-gray + { + background: #a0a0a4; + color: #000000; + } + #color-darkGray + { + background: #808080; + color: #ffffff; + } + #color-lightGray + { + background: #c0c0c0; + color: #000000; + } + span.comment { color: #008B00; @@ -526,7 +612,7 @@ background: url(../images/page.png) no-repeat 100% -60px; overflow: hidden; } - .navTop{ + .navTop{ float:right; display:block; padding-right:15px; @@ -1590,11 +1676,11 @@ word-wrap:break-word; } - .creator .wrap .content ol li { + .creator .wrap .content ol li { background:none; font: inherit; padding-left: 0px; - } + } .creator .wrap .content .descr ol li { margin-left: 45px; diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 6b1aa17..060b979 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -231,81 +231,25 @@ /*! \enum Qt::GlobalColor - \raw HTML - - \endraw - Qt's predefined QColor objects: - \value white \raw HTML - White (#ffffff) - \endraw - \value black \raw HTML - Black (#000000) - \endraw - \value red \raw HTML - Red (#ff0000) - \endraw - \value darkRed \raw HTML - Dark red (#800000) - \endraw - \value green \raw HTML - Green (#00ff00) - \endraw - \value darkGreen \raw HTML - Dark green (#008000) - \endraw - \value blue \raw HTML - Blue (#0000ff) - \endraw - \value darkBlue \raw HTML - Dark blue (#000080) - \endraw - \value cyan \raw HTML - Cyan (#00ffff) - \endraw - \value darkCyan \raw HTML - Dark cyan (#008080) - \endraw - \value magenta \raw HTML - Magenta (#ff00ff) - \endraw - \value darkMagenta \raw HTML - Dark magenta (#800080) - \endraw - \value yellow \raw HTML - Yellow (#ffff00) - \endraw - \value darkYellow \raw HTML - Dark yellow (#808000) - \endraw - \value gray \raw HTML - Gray (#a0a0a4) - \endraw - \value darkGray \raw HTML - Dark gray (#808080) - \endraw - \value lightGray \raw HTML - Light gray (#c0c0c0) - \endraw + \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 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 301244d..ef5b6c8 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -107,7 +107,8 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value CodeOld \value CodeQuoteArgument \value CodeQuoteCommand - \value Div + \value DivLeft + \value DivRight \value EndQmlText \value FormatElse \value FormatEndif @@ -180,8 +181,8 @@ static const struct { { "CodeOld", Atom::CodeOld }, { "CodeQuoteArgument", Atom::CodeQuoteArgument }, { "CodeQuoteCommand", Atom::CodeQuoteCommand }, - { "Div", Atom::Div }, - { "EndDiv", Atom::EndDiv }, + { "DivLeft", Atom::DivLeft }, + { "DivRight", Atom::DivRight }, #ifdef QDOC_QML { "EndQmlText", Atom::EndQmlText }, #endif diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index a20e057..739d8e3 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -72,15 +72,15 @@ class Atom CodeOld, CodeQuoteArgument, CodeQuoteCommand, - Div, + DivLeft, // 16 + DivRight, // 17 #ifdef QDOC_QML - EndDiv, EndQmlText, #endif FootnoteLeft, - FootnoteRight, + FootnoteRight, // 20 FormatElse, - FormatEndif, // 20 + FormatEndif, FormatIf, FormattingLeft, FormattingRight, @@ -88,30 +88,30 @@ class Atom GuidLink, Image, ImageText, - InlineImage, + InlineImage, // 30 LegaleseLeft, - LegaleseRight, // 30 + LegaleseRight, LineBreak, Link, LinkNode, ListLeft, ListItemNumber, - ListTagLeft, // 36 - ListTagRight, // 37 - ListItemLeft, // 38 - ListItemRight, // 39 - ListRight, // 40 + ListTagLeft, // 38 + ListTagRight, // 39 + ListItemLeft, // 40 + ListItemRight, // 41 + ListRight, // 42 Nop, - ParaLeft, - ParaRight, + ParaLeft, // 44 + ParaRight, // 45 #ifdef QDOC_QML Qml, QmlText, #endif QuotationLeft, QuotationRight, - RawString, - SectionLeft, // 49 + RawString, // 50 + SectionLeft, // 51 SectionRight, SectionHeadingLeft, SectionHeadingRight, @@ -120,9 +120,9 @@ class Atom SinceList, SnippetCommand, SnippetIdentifier, - SnippetLocation, - String, // 59 - TableLeft, // 60 + SnippetLocation, // 60 + String, // 61 + TableLeft, // 62 TableRight, TableHeaderLeft, TableHeaderRight, @@ -130,8 +130,8 @@ class Atom TableRowRight, TableItemLeft, TableItemRight, - TableOfContents, - Target, // 69 + TableOfContents, // 70 + Target, // 71 UnhandledFormat, UnknownCommand, Last = UnknownCommand diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 1595f72..f9c8cc5 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -752,12 +752,12 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writeCharacters(trimmedTrailing(plainCode(atom->string()))); xmlWriter().writeEndElement(); // break; - case Atom::Div: + case Atom::DivLeft: xmlWriter().writeStartElement("sectiondiv"); if (!atom->string().isEmpty()) xmlWriter().writeAttribute("outputclass", atom->string()); break; - case Atom::EndDiv: + case Atom::DivRight: xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index ce9e30d..4873d8b 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -55,6 +55,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -368,8 +369,8 @@ class DocParser void appendToCode(const QString &code); void startNewPara(); void enterPara(Atom::Type leftType = Atom::ParaLeft, - Atom::Type rightType = Atom::ParaRight, - const QString& string = ""); + Atom::Type rightType = Atom::ParaRight, + const QString& string = ""); void leavePara(); void leaveValue(); void leaveValueList(); @@ -559,11 +560,26 @@ void DocParser::parse(const QString& source, break; #endif case CMD_DIV: - leavePara(); x = getArgument(true); - append(Atom::Div, x); - openedCommands.push(cmd); - enterPara(); + leavePara(); + enterPara(Atom::DivLeft, Atom::DivRight,x); +#if 0 + if (x.contains('=')) { + leavePara(); + enterPara(Atom::DivLeft, Atom::DivRight,x); + } + else { + leavePara(); + append(Atom::DivLeft, x); + openedCommands.push(cmd); + enterPara(); + } +#endif + break; + case CMD_ENDDIV: + leavePara(); + // append(Atom::DivRight); + // closeCommand(cmd); break; case CMD_CODELINE: { @@ -632,11 +648,6 @@ void DocParser::parse(const QString& source, case CMD_ENDCODE: closeCommand(cmd); break; - case CMD_ENDDIV: - leavePara(); - append(Atom::EndDiv); - closeCommand(cmd); - break; #ifdef QDOC_QML case CMD_ENDQML: closeCommand(cmd); @@ -1806,8 +1817,18 @@ void DocParser::parseAlso() } } +//static bool debug = false; + void DocParser::append(Atom::Type type, const QString &string) { +#if 0 + if (type == Atom::DivLeft) + debug = true; + if (debug) + qDebug() << type << string; + if (type == Atom::DivRight) + debug = false; +#endif Atom::Type lastType = priv->text.lastAtom()->type(); #ifdef QDOC_QML if (((lastType == Atom::Code) || (lastType == Atom::Code)) && @@ -1865,15 +1886,16 @@ void DocParser::enterPara(Atom::Type leftType, const QString& string) { if (paraState == OutsidePara) { - if (priv->text.lastAtom()->type() != Atom::ListItemLeft) + 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) { + if (leftType == Atom::SectionHeadingLeft) { paraState = InsideSingleLinePara; } else { diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 948a7d6..1ddc0b9 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -511,13 +511,20 @@ int HtmlGenerator::generateAtom(const Atom *atom, << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) << "\n"; break; - case Atom::Div: + case Atom::DivLeft: out() << "string().isEmpty()) - out() << " class=\"" << atom->string() << "\">"; + if (!atom->string().isEmpty()) { + if (atom->string().contains('=')) + out() << " " << atom->string() << ">"; + else + out() << " class=\"" << atom->string() << "\">"; + } else out() << ">"; break; + case Atom::DivRight: + out() << ""; + break; case Atom::FootnoteLeft: // ### For now if (in_para) { @@ -1136,9 +1143,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "\\" << protectEnc(atom->string()) << ""; break; - case Atom::EndDiv: - out() << ""; - break; #ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: -- cgit v0.12