summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-02-05 21:47:10 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-02-05 21:47:10 (GMT)
commiteb5e587af8867fa57ee764441905bdf982ab43c6 (patch)
treed03824470e9691a3868f83f6b378ae21727d90ff /tools/qdoc3
parent7f919a56fe4e6e5e9b610361b8b0b32631c5edb1 (diff)
downloadQt-eb5e587af8867fa57ee764441905bdf982ab43c6.zip
Qt-eb5e587af8867fa57ee764441905bdf982ab43c6.tar.gz
Qt-eb5e587af8867fa57ee764441905bdf982ab43c6.tar.bz2
Ensured that trailing newlines are quoted and correct atoms are used.
Newlines after comments at the end of files were previously omitted. An assumption about the type code being quoted caused incorrect CSS classes to be used and extra HTML elements to be used.
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/cppcodemarker.cpp5
-rw-r--r--tools/qdoc3/doc.cpp17
2 files changed, 17 insertions, 5 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index 752d007..e27916b 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -936,6 +936,7 @@ QString CppCodeMarker::addMarkUp(const QString &in,
int parenDepth = 0;
int i = 0;
int start = 0;
+ int finish = 0;
char ch;
QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)");
QRegExp functionRegExp("q([A-Z][a-z]+)+");
@@ -943,7 +944,6 @@ QString CppCodeMarker::addMarkUp(const QString &in,
readChar();
while (ch != EOF) {
- int finish = i;
QString tag;
bool target = false;
@@ -1120,7 +1120,10 @@ QString CppCodeMarker::addMarkUp(const QString &in,
if (!tag.isEmpty())
out += QLatin1String("</@") + tag + QLatin1String(">");
+ }
+ if (start < code.length()) {
+ out += protect(code.mid(start));
}
return out;
diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp
index 76c47a2..a730799 100644
--- a/tools/qdoc3/doc.cpp
+++ b/tools/qdoc3/doc.cpp
@@ -369,6 +369,7 @@ class DocParser
void appendChar(QChar ch);
void appendWord(const QString &word);
void appendToCode(const QString &code);
+ void appendToCode(const QString &code, Atom::Type defaultType);
void startNewPara();
void enterPara(Atom::Type leftType = Atom::ParaLeft,
Atom::Type rightType = Atom::ParaRight,
@@ -1112,9 +1113,8 @@ void DocParser::parse(const QString& source,
append(Atom::SnippetIdentifier, identifier);
}
else {
- Doc::quoteFromFile(location(),quoter,snippet);
- appendToCode(quoter.quoteSnippet(location(),
- identifier));
+ marker = Doc::quoteFromFile(location(),quoter,snippet);
+ appendToCode(quoter.quoteSnippet(location(), identifier), marker->atomType());
}
}
break;
@@ -1855,7 +1855,7 @@ void DocParser::appendToCode(const QString& markedCode)
{
Atom::Type lastType = priv->text.lastAtom()->type();
#ifdef QDOC_QML
- if (lastType != Atom::Qml)
+ if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript)
append(Atom::Qml);
#else
if (lastType != Atom::Code)
@@ -1864,6 +1864,15 @@ void DocParser::appendToCode(const QString& markedCode)
priv->text.lastAtom()->appendString(markedCode);
}
+void DocParser::appendToCode(const QString &markedCode, Atom::Type defaultType)
+{
+ Atom::Type lastType = priv->text.lastAtom()->type();
+ if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript)
+ append(defaultType, markedCode);
+ else
+ priv->text.lastAtom()->appendString(markedCode);
+}
+
void DocParser::startNewPara()
{
leavePara();