summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-05-13 15:57:35 +0200
committerDavid Boddie <david.boddie@nokia.com>2011-05-13 15:57:35 +0200
commit0dbbb137f432e99113ac513c542b4a8431b00b5d (patch)
treed62a62e26841c54019c765ead734b27c12a142b2 /tools
parent23267553627ac3c4cbcd918283bee8e665deeff9 (diff)
parentde1e529da4a3a042205808cc27e28157c409653b (diff)
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-team into 4.7
Diffstat (limited to 'tools')
-rw-r--r--tools/qdoc3/atom.cpp6
-rw-r--r--tools/qdoc3/atom.h26
-rw-r--r--tools/qdoc3/config.cpp1
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp35
-rw-r--r--tools/qdoc3/ditaxmlgenerator.h2
-rw-r--r--tools/qdoc3/doc.cpp246
-rw-r--r--tools/qdoc3/doc.h18
-rw-r--r--tools/qdoc3/htmlgenerator.cpp3
-rw-r--r--tools/qdoc3/qdoc3.pro2
9 files changed, 184 insertions, 155 deletions
diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp
index 2d50e5a586..f2a5af9b30 100644
--- a/tools/qdoc3/atom.cpp
+++ b/tools/qdoc3/atom.cpp
@@ -184,9 +184,7 @@ static const struct {
{ "CodeQuoteCommand", Atom::CodeQuoteCommand },
{ "DivLeft", Atom::DivLeft },
{ "DivRight", Atom::DivRight },
-#ifdef QDOC_QML
{ "EndQmlText", Atom::EndQmlText },
-#endif
{ "FootnoteLeft", Atom::FootnoteLeft },
{ "FootnoteRight", Atom::FootnoteRight },
{ "FormatElse", Atom::FormatElse },
@@ -199,6 +197,8 @@ static const struct {
{ "Image", Atom::Image },
{ "ImageText", Atom::ImageText },
{ "InlineImage", Atom::InlineImage },
+ { "JavaScript", Atom::JavaScript },
+ { "EndJavaScript", Atom::EndJavaScript },
{ "LegaleseLeft", Atom::LegaleseLeft },
{ "LegaleseRight", Atom::LegaleseRight },
{ "LineBreak", Atom::LineBreak },
@@ -214,10 +214,8 @@ static const struct {
{ "Nop", Atom::Nop },
{ "ParaLeft", Atom::ParaLeft },
{ "ParaRight", Atom::ParaRight },
-#ifdef QDOC_QML
{ "Qml", Atom::Qml},
{ "QmlText", Atom::QmlText },
-#endif
{ "QuotationLeft", Atom::QuotationLeft },
{ "QuotationRight", Atom::QuotationRight },
{ "RawString", Atom::RawString },
diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h
index dbb1a8bc0e..f7d1950867 100644
--- a/tools/qdoc3/atom.h
+++ b/tools/qdoc3/atom.h
@@ -56,7 +56,7 @@ class Atom
{
public:
enum Type {
- AbstractLeft, // 00
+ AbstractLeft,
AbstractRight,
AnnotatedList,
AutoLink,
@@ -66,19 +66,17 @@ class Atom
C,
CaptionLeft,
CaptionRight,
- Code, // 10
+ Code,
CodeBad,
CodeNew,
CodeOld,
CodeQuoteArgument,
CodeQuoteCommand,
- DivLeft, // 16
- DivRight, // 17
-#ifdef QDOC_QML
+ DivLeft,
+ DivRight,
EndQmlText,
-#endif
FootnoteLeft,
- FootnoteRight, // 20
+ FootnoteRight,
FormatElse,
FormatEndif,
FormatIf,
@@ -88,11 +86,9 @@ class Atom
GuidLink,
Image,
ImageText,
- InlineImage, // 30
-#ifdef QDOC_QML
+ InlineImage,
JavaScript,
EndJavaScript,
-#endif
LegaleseLeft,
LegaleseRight,
LineBreak,
@@ -100,7 +96,7 @@ class Atom
LinkNode,
ListLeft,
ListItemNumber,
- ListTagLeft, // 40
+ ListTagLeft,
ListTagRight,
ListItemLeft,
ListItemRight,
@@ -108,11 +104,9 @@ class Atom
Nop,
ParaLeft,
ParaRight,
-#ifdef QDOC_QML
Qml,
QmlText,
-#endif
- QuotationLeft, // 50
+ QuotationLeft,
QuotationRight,
RawString,
SectionLeft,
@@ -122,7 +116,7 @@ class Atom
SidebarLeft,
SidebarRight,
SinceList,
- SnippetCommand, // 60
+ SnippetCommand,
SnippetIdentifier,
SnippetLocation,
String,
@@ -132,7 +126,7 @@ class Atom
TableHeaderRight,
TableRowLeft,
TableRowRight,
- TableItemLeft, // 70
+ TableItemLeft,
TableItemRight,
TableOfContents,
Target,
diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp
index eaec327225..1ff2a0d431 100644
--- a/tools/qdoc3/config.cpp
+++ b/tools/qdoc3/config.cpp
@@ -696,6 +696,7 @@ void Config::load(Location location, const QString& fileName)
} while (isMetaKeyChar(c));
QStringList keys = stack.getExpanded(location);
+ //qDebug() << "KEYS:" << keys;
SKIP_SPACES();
if (keys.count() == 1 && keys.first() == "include") {
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index 5f44cd8363..342bb9095d 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -801,15 +801,18 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
break;
case Atom::DivLeft:
{
+ bool inStartElement = false;
attr = atom->string();
DitaTag t = currentTag();
if ((t == DT_section) || (t == DT_sectiondiv)) {
writeStartTag(DT_sectiondiv);
divNestingLevel++;
+ inStartElement = true;
}
else if ((t == DT_body) || (t == DT_bodydiv)) {
writeStartTag(DT_bodydiv);
divNestingLevel++;
+ inStartElement = true;
}
if (!attr.isEmpty()) {
if (attr.contains('=')) {
@@ -833,7 +836,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
attr = values;
}
}
- xmlWriter().writeAttribute("outputclass", attr);
+ if (inStartElement)
+ xmlWriter().writeAttribute("outputclass", attr);
}
break;
case Atom::DivRight:
@@ -1253,9 +1257,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
break;
case Atom::GuidLink:
{
-#if 0
- qDebug() << "GUID LINK:" << atom->string() << outFileName();
-#endif
beginLink(atom->string());
skipAhead = 1;
}
@@ -1484,7 +1485,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
generateLink(atom, relative, marker);
}
else {
- writeCharacters(protectEnc(atom->string()));
+ writeCharacters(atom->string());
}
break;
case Atom::TableLeft:
@@ -1637,7 +1638,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
int numColumns = 1;
const Node* node = relative;
- Doc::SectioningUnit sectioningUnit = Doc::Section4;
+ Doc::Sections sectionUnit = Doc::Section4;
QStringList params = atom->string().split(",");
QString columnText = params.at(0);
QStringList pieces = columnText.split(" ", QString::SkipEmptyParts);
@@ -1650,13 +1651,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
if (params.size() == 2) {
numColumns = qMax(columnText.toInt(), numColumns);
- sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt();
+ sectionUnit = (Doc::Sections)params.at(1).toInt();
}
if (node)
generateTableOfContents(node,
marker,
- sectioningUnit,
+ sectionUnit,
numColumns,
relative);
}
@@ -1743,6 +1744,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
enterSection("h2","Detailed Description");
generateBody(nsn, marker);
+ generateAlsoList(nsn, marker);
leaveSection();
leaveSection(); // </apiDesc>
@@ -1877,6 +1879,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
generateSince(cn, marker);
enterSection("h2","Detailed Description");
generateBody(cn, marker);
+ generateAlsoList(cn, marker);
leaveSection();
leaveSection(); // </apiDesc>
@@ -1995,6 +1998,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
generateSince(fn, marker);
enterSection("h2","Detailed Description");
generateBody(fn, marker);
+ generateAlsoList(fn, marker);
leaveSection();
leaveSection(); // </apiDesc>
@@ -2115,6 +2119,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark
generateBody(qcn, marker);
if (cn)
generateQmlText(cn->doc().body(), cn, marker, qcn->name());
+ generateAlsoList(cn, marker);
leaveSection();
leaveSection(); // </apiDesc>
@@ -2458,7 +2463,7 @@ void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* mark
*/
void DitaXmlGenerator::generateTableOfContents(const Node* node,
CodeMarker* marker,
- Doc::SectioningUnit sectioningUnit,
+ Doc::Sections sectionUnit,
int numColumns,
const Node* relative)
@@ -2492,7 +2497,7 @@ void DitaXmlGenerator::generateTableOfContents(const Node* node,
Atom *atom = toc.at(i);
int nextLevel = atom->string().toInt();
- if (nextLevel > (int)sectioningUnit)
+ if (nextLevel > (int)sectionUnit)
continue;
if (sectionNumber.size() < nextLevel) {
@@ -3636,10 +3641,6 @@ QString DitaXmlGenerator::registerRef(const QString& ref)
}
else if (prevRef == ref)
break;
-#if 0
- else
- qDebug() << "PREVREF:" << prevRef;
-#endif
clean += "x";
}
return clean;
@@ -3653,7 +3654,7 @@ QString DitaXmlGenerator::protectEnc(const QString& string)
return protect(string, outputEncoding);
}
-QString DitaXmlGenerator::protect(const QString& string, const QString& outputEncoding)
+QString DitaXmlGenerator::protect(const QString& string, const QString& ) //outputEncoding)
{
#define APPEND(x) \
if (xml.isEmpty()) { \
@@ -3680,6 +3681,7 @@ QString DitaXmlGenerator::protect(const QString& string, const QString& outputEn
else if (ch == QLatin1Char('"')) {
APPEND("&quot;");
}
+#if 0
else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) ||
(ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) ||
(ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) {
@@ -3688,6 +3690,7 @@ QString DitaXmlGenerator::protect(const QString& string, const QString& outputEn
xml += QString::number(ch.unicode(), 16);
xml += QLatin1Char(';');
}
+#endif
else {
if (!xml.isEmpty())
xml += ch;
@@ -3808,7 +3811,6 @@ QString DitaXmlGenerator::guidForNode(const Node* node)
QString ref = fn->name();
if (fn->overloadNumber() != 1) {
ref += "-" + QString::number(fn->overloadNumber());
- //qDebug() << "guidForNode() overloaded function:" << outFileName() << ref;
}
}
return fn->guid();
@@ -5482,6 +5484,7 @@ void DitaXmlGenerator::writeApiDesc(const Node* node,
inDetailedDescription = true;
enterApiDesc(QString(),title);
generateBody(node, marker);
+ generateAlsoList(node, marker);
leaveSection();
}
inDetailedDescription = false;
diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h
index 0044eff5a7..7d7365378f 100644
--- a/tools/qdoc3/ditaxmlgenerator.h
+++ b/tools/qdoc3/ditaxmlgenerator.h
@@ -343,7 +343,7 @@ class DitaXmlGenerator : public PageGenerator
void generateIncludes(const InnerNode* inner, CodeMarker* marker);
void generateTableOfContents(const Node* node,
CodeMarker* marker,
- Doc::SectioningUnit sectioningUnit,
+ Doc::Sections sectioningUnit,
int numColumns,
const Node* relative = 0);
void generateTableOfContents(const Node* node,
diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp
index 2239f433b2..a7d331e6ba 100644
--- a/tools/qdoc3/doc.cpp
+++ b/tools/qdoc3/doc.cpp
@@ -74,32 +74,105 @@ struct Macro
};
enum {
- CMD_A, CMD_ABSTRACT, CMD_ANNOTATEDLIST, CMD_BADCODE,
- CMD_BASENAME, CMD_BOLD, CMD_BRIEF, CMD_C, CMD_CAPTION,
- CMD_CHAPTER, CMD_CODE, CMD_CODELINE, CMD_DIV, CMD_DOTS,
- CMD_ELSE, CMD_ENDABSTRACT, CMD_ENDCHAPTER, CMD_ENDCODE,
- CMD_ENDDIV, CMD_ENDFOOTNOTE, CMD_ENDIF, CMD_ENDLEGALESE,
- CMD_ENDLINK, CMD_ENDLIST, CMD_ENDOMIT, CMD_ENDPART,
- CMD_ENDQUOTATION, CMD_ENDRAW, CMD_ENDSECTION1, CMD_ENDSECTION2,
- CMD_ENDSECTION3, CMD_ENDSECTION4, CMD_ENDSIDEBAR,
- CMD_ENDTABLE, CMD_EXPIRE, CMD_FOOTNOTE, CMD_GENERATELIST,
- CMD_GRANULARITY, CMD_HEADER, CMD_I, CMD_IF, CMD_IMAGE,
- CMD_INCLUDE, CMD_INLINEIMAGE, CMD_INDEX, CMD_KEYWORD,
- CMD_L, CMD_LEGALESE, CMD_LINK, CMD_LIST, CMD_META,
- CMD_NEWCODE, CMD_O, CMD_OLDCODE, CMD_OMIT, CMD_OMITVALUE,
- CMD_OVERLOAD, CMD_PART, CMD_PRINTLINE, CMD_PRINTTO,
- CMD_PRINTUNTIL, CMD_QUOTATION, CMD_QUOTEFILE,
- 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_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,
- CMD_ENDQMLTEXT, CMD_CPPTEXT, CMD_ENDCPPTEXT,
- CMD_JS, CMD_ENDJS,
-#endif
+ CMD_A,
+ CMD_ABSTRACT,
+ CMD_ANNOTATEDLIST,
+ CMD_BADCODE,
+ CMD_BASENAME,
+ CMD_BOLD,
+ CMD_BRIEF,
+ CMD_C,
+ CMD_CAPTION,
+ CMD_CHAPTER, // 9
+ CMD_CODE,
+ CMD_CODELINE,
+ CMD_DIV,
+ CMD_DOTS,
+ CMD_ELSE,
+ CMD_ENDABSTRACT,
+ CMD_ENDCHAPTER,
+ CMD_ENDCODE,
+ CMD_ENDDIV,
+ CMD_ENDFOOTNOTE,
+ CMD_ENDIF,
+ CMD_ENDLEGALESE,
+ CMD_ENDLINK,
+ CMD_ENDLIST,
+ CMD_ENDOMIT,
+ CMD_ENDPART,
+ CMD_ENDQUOTATION,
+ CMD_ENDRAW,
+ CMD_ENDSECTION1,
+ CMD_ENDSECTION2,
+ CMD_ENDSECTION3,
+ CMD_ENDSECTION4,
+ CMD_ENDSIDEBAR,
+ CMD_ENDTABLE,
+ CMD_EXPIRE,
+ CMD_FOOTNOTE,
+ CMD_GENERATELIST,
+ CMD_GRANULARITY,
+ CMD_HEADER,
+ CMD_I,
+ CMD_IF,
+ CMD_IMAGE,
+ CMD_INCLUDE,
+ CMD_INLINEIMAGE,
+ CMD_INDEX,
+ CMD_KEYWORD,
+ CMD_L,
+ CMD_LEGALESE,
+ CMD_LINK,
+ CMD_LIST,
+ CMD_META,
+ CMD_NEWCODE,
+ CMD_O,
+ CMD_OLDCODE,
+ CMD_OMIT,
+ CMD_OMITVALUE,
+ CMD_OVERLOAD,
+ CMD_PART,
+ CMD_PRINTLINE,
+ CMD_PRINTTO,
+ CMD_PRINTUNTIL,
+ CMD_QUOTATION,
+ CMD_QUOTEFILE,
+ CMD_QUOTEFROMFILE,
+ CMD_QUOTEFUNCTION,
+ CMD_RAW,
+ CMD_ROW,
+ CMD_SA,
+ CMD_SECTION1, // 68
+ CMD_SECTION2, // 69
+ CMD_SECTION3, // 70
+ CMD_SECTION4, // 71
+ CMD_SIDEBAR,
+ CMD_SINCELIST,
+ CMD_SKIPLINE,
+ 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,
+ CMD_QML,
+ CMD_ENDQML,
+ CMD_CPP,
+ CMD_ENDCPP,
+ CMD_QMLTEXT,
+ CMD_ENDQMLTEXT,
+ CMD_CPPTEXT,
+ CMD_ENDCPPTEXT,
+ CMD_JS,
+ CMD_ENDJS,
NOT_A_CMD
};
@@ -197,7 +270,6 @@ static struct {
{ "unicode", CMD_UNICODE, 0 },
{ "value", CMD_VALUE, 0 },
{ "warning", CMD_WARNING, 0 },
-#ifdef QDOC_QML
{ "qml", CMD_QML, 0 },
{ "endqml", CMD_ENDQML, 0 },
{ "cpp", CMD_CPP, 0 },
@@ -208,7 +280,6 @@ static struct {
{ "endcpptext", CMD_ENDCPPTEXT, 0 },
{ "js", CMD_JS, 0 },
{ "endjs", CMD_ENDJS, 0 },
-#endif
{ 0, 0, 0 }
};
@@ -223,13 +294,13 @@ class DocPrivateExtra
{
public:
QString baseName;
- Doc::SectioningUnit granularity;
- Doc::SectioningUnit sectioningUnit; // ###
+ Doc::Sections granularity;
+ Doc::Sections section; // ###
QList<Atom*> tableOfContents;
QList<int> tableOfContentsLevels;
QList<Atom*> keywords;
QList<Atom*> targets;
- QStringMultiMap metaMap;
+ QStringMultiMap metaMap;
DocPrivateExtra()
: granularity(Doc::Part) { }
@@ -365,7 +436,7 @@ class DocParser
void startFormat(const QString& format, int cmd);
bool openCommand(int cmd);
bool closeCommand(int endCmd);
- void startSection(Doc::SectioningUnit unit, int cmd);
+ void startSection(Doc::Sections unit, int cmd);
void endSection(int unit, int endCmd);
void parseAlso();
void append(Atom::Type type, const QString& string = "");
@@ -385,7 +456,7 @@ class DocParser
CodeMarker *quoteFromFile();
void expandMacro(const QString& name, const QString& def, int numParams);
QString expandMacroToString(const QString &name, const QString &def, int numParams);
- Doc::SectioningUnit getSectioningUnit();
+ Doc::Sections getSectioningUnit();
QString getArgument(bool verbatim = false);
QString getOptionalArgument();
QString getRestOfLine();
@@ -426,7 +497,7 @@ class DocParser
int braceDepth;
int minIndent;
- Doc::SectioningUnit currentSectioningUnit;
+ Doc::Sections currentSection;
QMap<QString, Location> targetMap;
QMap<int, QString> pendingFormats;
QStack<int> openedCommands;
@@ -472,7 +543,7 @@ void DocParser::parse(const QString& source,
braceDepth = 0;
minIndent = INT_MAX;
- currentSectioningUnit = Doc::Book;
+ currentSection = Doc::NoSection;
openedCommands.push(CMD_OMIT);
quoter.reset();
@@ -561,7 +632,6 @@ void DocParser::parse(const QString& source,
leavePara();
append(Atom::Code, getCode(CMD_CODE, 0));
break;
-#ifdef QDOC_QML
case CMD_QML:
leavePara();
append(Atom::Qml, getCode(CMD_QML, CodeMarker::markerForLanguage(QLatin1String("QML"))));
@@ -573,7 +643,6 @@ void DocParser::parse(const QString& source,
leavePara();
append(Atom::JavaScript, getCode(CMD_JS, CodeMarker::markerForLanguage(QLatin1String("JavaScript"))));
break;
-#endif
case CMD_DIV:
leavePara();
p1 = getArgument(true);
@@ -652,7 +721,6 @@ void DocParser::parse(const QString& source,
case CMD_ENDCODE:
closeCommand(cmd);
break;
-#ifdef QDOC_QML
case CMD_ENDQML:
closeCommand(cmd);
break;
@@ -662,7 +730,6 @@ void DocParser::parse(const QString& source,
case CMD_ENDJS:
closeCommand(cmd);
break;
-#endif
case CMD_ENDFOOTNOTE:
if (closeCommand(cmd)) {
leavePara();
@@ -712,7 +779,7 @@ void DocParser::parse(const QString& source,
closeCommand(cmd);
break;
case CMD_ENDPART:
- endSection(-1, cmd);
+ endSection(Doc::Part, cmd);
break;
case CMD_ENDQUOTATION:
if (closeCommand(cmd)) {
@@ -724,16 +791,16 @@ void DocParser::parse(const QString& source,
location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ENDRAW)));
break;
case CMD_ENDSECTION1:
- endSection(1, cmd);
+ endSection(Doc::Section1, cmd);
break;
case CMD_ENDSECTION2:
- endSection(2, cmd);
+ endSection(Doc::Section2, cmd);
break;
case CMD_ENDSECTION3:
- endSection(3, cmd);
+ endSection(Doc::Section3, cmd);
break;
case CMD_ENDSECTION4:
- endSection(4, cmd);
+ endSection(Doc::Section4, cmd);
break;
case CMD_ENDSIDEBAR:
if (closeCommand(cmd)) {
@@ -1463,14 +1530,13 @@ void DocParser::parse(const QString& source,
location().warning(tr("Missing '\\%1'").arg(cmdName(CMD_ENDIF)));
}
- while (currentSectioningUnit >= Doc::Chapter) {
- int delta = currentSectioningUnit - priv->extra->sectioningUnit;
- append(Atom::SectionRight, QString::number(delta));
- currentSectioningUnit = Doc::SectioningUnit(int(currentSectioningUnit) - 1);
+ if (currentSection > Doc::NoSection) {
+ append(Atom::SectionRight, QString::number(currentSection));
+ currentSection = Doc::NoSection;
}
- if (priv->extra && priv->extra->granularity < priv->extra->sectioningUnit)
- priv->extra->granularity = priv->extra->sectioningUnit;
+ if (priv->extra && priv->extra->granularity < priv->extra->section)
+ priv->extra->granularity = priv->extra->section;
priv->text.stripFirstAtom();
}
@@ -1546,14 +1612,14 @@ void DocParser::checkExpiry(const QString& date)
void DocParser::insertBaseName(const QString &baseName)
{
priv->constructExtra();
- if (currentSectioningUnit == priv->extra->sectioningUnit) {
+ if (currentSection == priv->extra->section) {
priv->extra->baseName = baseName;
}
else {
Atom *atom = priv->text.firstAtom();
Atom *sectionLeft = 0;
- int delta = currentSectioningUnit - priv->extra->sectioningUnit;
+ int delta = currentSection - priv->extra->section;
while (atom != 0) {
if (atom->type() == Atom::SectionLeft &&
@@ -1772,60 +1838,34 @@ bool DocParser::closeCommand(int endCmd)
}
}
-void DocParser::startSection(Doc::SectioningUnit unit, int cmd)
+void DocParser::startSection(Doc::Sections unit, int cmd)
{
leaveValueList();
- if (currentSectioningUnit == Doc::Book) {
- currentSectioningUnit = (Doc::SectioningUnit) (unit - 1);
+ if (currentSection == Doc::NoSection) {
+ currentSection = (Doc::Sections) (unit);
priv->constructExtra();
- priv->extra->sectioningUnit = currentSectioningUnit;
+ priv->extra->section = currentSection;
}
+ else
+ endSection(unit,cmd);
- if (unit <= priv->extra->sectioningUnit) {
- location().warning(tr("Unexpected '\\%1' in this documentation")
- .arg(cmdName(cmd)));
- }
- else if (unit - currentSectioningUnit > 1) {
- location().warning(tr("Unexpected '\\%1' at this point")
- .arg(cmdName(cmd)));
- }
- else {
- if (currentSectioningUnit >= unit)
- endSection(unit, cmd);
+ append(Atom::SectionLeft, QString::number(unit));
+ priv->constructExtra();
+ priv->extra->tableOfContents.append(priv->text.lastAtom());
+ priv->extra->tableOfContentsLevels.append(unit);
+ enterPara(Atom::SectionHeadingLeft,
+ Atom::SectionHeadingRight,
+ QString::number(unit));
+ currentSection = unit;
- int delta = unit - priv->extra->sectioningUnit;
- append(Atom::SectionLeft, QString::number(delta));
- priv->constructExtra();
- priv->extra->tableOfContents.append(priv->text.lastAtom());
- priv->extra->tableOfContentsLevels.append(unit);
- enterPara(Atom::SectionHeadingLeft,
- Atom::SectionHeadingRight,
- QString::number(delta));
- currentSectioningUnit = unit;
- }
}
void DocParser::endSection(int unit, int endCmd)
{
leavePara();
-
- if (unit < priv->extra->sectioningUnit) {
- location().warning(tr("Unexpected '\\%1' in this documentation")
- .arg(cmdName(endCmd)));
- }
- else if (unit > currentSectioningUnit) {
- location().warning(tr("Unexpected '\\%1' at this point")
- .arg(cmdName(endCmd)));
- }
- else {
- while (currentSectioningUnit >= unit) {
- int delta = currentSectioningUnit - priv->extra->sectioningUnit;
- append(Atom::SectionRight, QString::number(delta));
- currentSectioningUnit =
- (Doc::SectioningUnit) (currentSectioningUnit - 1);
- }
- }
+ append(Atom::SectionRight, QString::number(currentSection));
+ currentSection = (Doc::NoSection);
}
void DocParser::parseAlso()
@@ -2141,7 +2181,7 @@ QString DocParser::expandMacroToString(const QString &name, const QString &def,
}
}
-Doc::SectioningUnit DocParser::getSectioningUnit()
+Doc::Sections DocParser::getSectioningUnit()
{
QString name = getOptionalArgument();
@@ -2164,11 +2204,11 @@ Doc::SectioningUnit DocParser::getSectioningUnit()
return Doc::Section4;
}
else if (name.isEmpty()) {
- return Doc::Section4;
+ return Doc::NoSection;
}
else {
- location().warning(tr("Invalid sectioning unit '%1'").arg(name));
- return Doc::Book;
+ location().warning(tr("Invalid section '%1'").arg(name));
+ return Doc::NoSection;
}
}
@@ -2508,14 +2548,12 @@ int DocParser::endCmdFor(int cmd)
return CMD_ENDCODE;
case CMD_DIV:
return CMD_ENDDIV;
-#ifdef QDOC_QML
case CMD_QML:
return CMD_ENDQML;
case CMD_QMLTEXT:
return CMD_ENDQMLTEXT;
case CMD_JS:
return CMD_ENDJS;
-#endif
case CMD_FOOTNOTE:
return CMD_ENDFOOTNOTE;
case CMD_LEGALESE:
@@ -2645,11 +2683,7 @@ QString DocParser::slashed(const QString& str)
}
#define COMMAND_BRIEF Doc::alias("brief")
-
-#ifdef QDOC_QML
#define COMMAND_QMLBRIEF Doc::alias("qmlbrief")
-#endif
-
Doc::Doc(const Location& start_loc,
const Location& end_loc,
@@ -2882,7 +2916,7 @@ const QString& Doc::baseName() const
}
}
-Doc::SectioningUnit Doc::granularity() const
+Doc::Sections Doc::granularity() const
{
if (priv == 0 || priv->extra == 0) {
return DocPrivateExtra().granularity;
@@ -2975,9 +3009,7 @@ void Doc::initialize(const Config& config)
DocParser::sourceDirs = config.getStringList(CONFIG_SOURCEDIRS);
DocParser::quoting = config.getBool(CONFIG_QUOTINGINFORMATION);
-#ifdef QDOC_QML
QmlClassNode::qmlOnly = config.getBool(CONFIG_QMLONLY);
-#endif
QStringMap reverseAliasMap;
diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h
index e043b3a520..ea34b1bcd8 100644
--- a/tools/qdoc3/doc.h
+++ b/tools/qdoc3/doc.h
@@ -70,14 +70,14 @@ class Doc
{
public:
// the order is important
- enum SectioningUnit {
- Book = -2,
- Part,
- Chapter,
- Section1,
- Section2,
- Section3,
- Section4
+ enum Sections {
+ NoSection = -2,
+ Part = -1,
+ Chapter = 1,
+ Section1 = 1,
+ Section2 = 2,
+ Section3 = 3,
+ Section4 = 4
};
Doc() : priv(0) {}
@@ -103,7 +103,7 @@ class Doc
Text trimmedBriefText(const QString &className) const;
Text legaleseText() const;
const QString& baseName() const;
- SectioningUnit granularity() const;
+ Sections granularity() const;
const QSet<QString> &parameterNames() const;
const QStringList &enumItemNames() const;
const QStringList &omitEnumItemNames() const;
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index a6cf6465f0..1645ec978b 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1792,7 +1792,8 @@ void HtmlGenerator::generateTableOfContents(const Node *node,
toc = node->doc().tableOfContents();
if (toc.isEmpty() && !sections && (node->subType() != Node::Module))
return;
-
+ bool debug = false;
+
QStringList sectionNumber;
int detailsBase = 0;
diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro
index 69d7e289bb..bb5ff83d91 100644
--- a/tools/qdoc3/qdoc3.pro
+++ b/tools/qdoc3/qdoc3.pro
@@ -19,7 +19,7 @@ qdoc_bootstrapped {
#CONFIG += debug
build_all:!build_pass {
CONFIG -= build_all
- CONFIG += release
+ CONFIG += debug-and-release
# CONFIG += debug
}