diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/atom.cpp | 7 | ||||
-rw-r--r-- | tools/qdoc3/atom.h | 40 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 4 | ||||
-rw-r--r-- | tools/qdoc3/doc.cpp | 50 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 16 |
5 files changed, 72 insertions, 45 deletions
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(); // </codeblock> 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(); // </sectiondiv> 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 <qregexp.h> #include <ctype.h> #include <limits.h> +#include <qdebug.h> 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())))) << "</pre>\n"; break; - case Atom::Div: + case Atom::DivLeft: out() << "<div"; - if (!atom->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() << "</div>"; + break; case Atom::FootnoteLeft: // ### For now if (in_para) { @@ -1136,9 +1143,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<b class=\"redFont\"><code>\\" << protectEnc(atom->string()) << "</code></b>"; break; - case Atom::EndDiv: - out() << "</div>"; - break; #ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: |