(node);
- out() << " All Namespaces ";
- out() << " " << title
- << " ";
+ out() << " Namespaces ";
+ out() << " " << title << " ";
}
}
@@ -1781,7 +1764,7 @@
{
out() << QString("\n").arg(outputEncoding);
out() << "\n";
- out() << "\n";
+ out() << QString("\n").arg(naturalLanguage);
out() << "\n";
out() << " \n";
QString shortVersion;
@@ -1798,34 +1781,56 @@
else
shortVersion = "Qt " + shortVersion + ": ";
}
-
+ // Generating page title
out() << " " << shortVersion << protectEnc(title) << " \n";
-
- out() << " ";
- out() << "";
- out() << "";
- out() << "";
-
-
- //out() << " Qt Reference Documentation ";
- out() << " \n";
- out() << " \n";
- out() << " \n";
- out() << "\n";
-
+ // Adding style sheet
+ out() << " ";
+ // Adding jquery and functions - providing online tools and search features
+ out() << " \n";
+ out() << " \n";
+ // Adding style and js for small windows
+ out() << " \n";
+ out() << " ";
+ out() << " \n";
+ out() << " ";
+
+ // Adding syntax highlighter // future release
+
+ // Setting assistant configuration
if (offlineDocs)
- out() << "\n";
+ {
+ out() << " "; // Only for Qt Creator
+ out() << "\n";
+ out() << "\n"; // offline for Assistant
+ }
+ if (creatorDocs)
+ {
+ out() << " "; // Only for Qt Creator
+ out() << "\n";
+ out() << "\n"; // offline for Creator
+ }
+ // Setting online doc configuration
else
- out() << "\n";
+ {
+ // Browser spec styles
+ out() << " \n";
+ out() << "\n";
+ out() << "\n";
+ out() << "\n";
+
+ out() << "\n";
+ // CheckEmptyAndLoadList activating search
+ out() << "\n";
+ }
#ifdef GENERATE_MAC_REFS
if (mainPage)
@@ -1835,7 +1840,7 @@
generateBreadCrumbs(title,node,marker);
out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version());
-#if 0 // Removed for new docf format. MWS
+#if 0 // Removed for new doc format. MWS
if (node && !node->links().empty())
out() << "\n" << navigationLinks << "
\n";
#endif
@@ -1867,8 +1872,30 @@
out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version())
<< QString(address).replace("\\" + COMMAND_VERSION, myTree->version());
- out() << " \n";
+
+ if (offlineDocs)
+ {
+ out() << "\n";
+ }
+ if (creatorDocs)
+ {
out() << "\n";
+ }
+ else
+ {
+ out() << " \n";
+ out() << " \n";
+ out() << "\n";
+ }
out() << "\n";
}
@@ -1877,6 +1904,7 @@
{
Text brief = node->doc().briefText();
if (!brief.isEmpty()) {
+ generateExtractionMark(node, BriefMark);
out() << "";
generateText(brief, node, marker);
if (!relative || node == relative)
@@ -1884,13 +1912,14 @@
else
out() << " More...
\n";
+ generateExtractionMark(node, EndMark);
}
}
void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker)
{
if (!inner->includes().isEmpty()) {
- out() << ""
+ out() << ""
<< trimmedTrailing(highlightedCode(indent(codeIndent,
marker->markedUpIncludes(inner->includes())),
marker,inner))
@@ -2005,7 +2034,7 @@
inLink = true;
out() << "\n";
- out() << "
Contents \n";
+ out() << "
\n";
sectionNumber.append("1");
out() << "
\n";
@@ -2036,7 +2065,9 @@
}
}
}
- else if (sections && (node->type() == Node::Class)) {
+ else if (sections && ((node->type() == Node::Class) ||
+ (node->type() == Node::Namespace) ||
+ (node->subType() == Node::QmlClass))) {
QList::ConstIterator s = sections->begin();
while (s != sections->end()) {
if (!s->members.isEmpty() || !s->reimpMembers.isEmpty()) {
@@ -2114,6 +2145,8 @@
out() << "]\n";
#endif
}
+ if (fake->name() != QString("index.html"))
+ {
if (bar.current.begin() != 0) {
out() << "[Home ]\n";
@@ -2125,6 +2158,7 @@
out() << "]\n";
}
out() << "\n";
+ }
}
}
#endif
@@ -2215,7 +2249,7 @@
sections = marker->sections(inner, CodeMarker::Detailed, status);
for (i = 0; i < sections.size(); ++i) {
- out() << " \n";
+ //out() << " \n";
out() << "" << protectEnc(sections.at(i).name) << " \n";
NodeList::ConstIterator m = sections.at(i).members.begin();
@@ -2294,20 +2328,20 @@
out() << "";
else
out() << " ";
- out() << "";
+ out() << "
";
generateFullName(node, relative, marker);
out() << "
";
if (!(node->type() == Node::Fake)) {
Text brief = node->doc().trimmedBriefText(name);
if (!brief.isEmpty()) {
- out() << "";
+ out() << "
";
generateText(brief, node, marker);
out() << "
";
}
}
else {
- out() << "";
+ out() << "
";
out() << protectEnc(node->doc().briefText().toString());
out() << "
";
}
@@ -2332,7 +2366,6 @@
QString commonPrefix)
{
const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_'
- const int NumColumns = 3; // number of columns in the result
if (classMap.isEmpty())
return;
@@ -2415,18 +2448,18 @@
else
key = pieces.last().toLower();
- int paragraphNo = NumParagraphs - 1;
+ int paragraphNr = NumParagraphs - 1;
if (key[0].digitValue() != -1) {
- paragraphNo = key[0].digitValue();
+ paragraphNr = key[0].digitValue();
}
else if (key[0] >= QLatin1Char('a') && key[0] <= QLatin1Char('z')) {
- paragraphNo = 10 + key[0].unicode() - 'a';
+ paragraphNr = 10 + key[0].unicode() - 'a';
}
- paragraphName[paragraphNo] = key[0].toUpper();
+ paragraphName[paragraphNr] = key[0].toUpper();
usedParagraphNames.insert(key[0].toLower().cell());
- paragraph[paragraphNo].insert(key, c.value());
+ paragraph[paragraphNr].insert(key, c.value());
++c;
}
@@ -2439,36 +2472,16 @@
start at offsets 0, 3, 4, 8, 9, 14, 23.
*/
int paragraphOffset[NumParagraphs + 1]; // 37 + 1
- int i, j, k;
-
paragraphOffset[0] = 0;
- for (j = 0; j < NumParagraphs; j++) // j = 0..36
- paragraphOffset[j + 1] = paragraphOffset[j] + paragraph[j].count();
-
- int firstOffset[NumColumns + 1];
- int currentOffset[NumColumns];
- int currentParagraphNo[NumColumns];
- int currentOffsetInParagraph[NumColumns];
-
- int numRows = (classMap.count() + NumColumns - 1) / NumColumns;
- int curParagNo = 0;
-
- for (i = 0; i < NumColumns; i++) {
- firstOffset[i] = qMin(i * numRows, classMap.size());
- currentOffset[i] = firstOffset[i];
-
- for (j = curParagNo; j < NumParagraphs; j++) {
- if (paragraphOffset[j] > firstOffset[i])
- break;
- if (paragraphOffset[j] <= firstOffset[i])
- curParagNo = j;
- }
- currentParagraphNo[i] = curParagNo;
- currentOffsetInParagraph[i] = firstOffset[i] -
- paragraphOffset[curParagNo];
- }
- firstOffset[NumColumns] = classMap.count();
-
+ for (int i=0; i";
for (int i = 0; i < 26; i++) {
@@ -2479,81 +2492,74 @@
out() << " \n";
}
- out() << "\n";
- for (k = 0; k < numRows; k++) {
- if (++numTableRows % 2 == 1)
- out() << "";
- else
- out() << " ";
- //break;
-
-// out() << " \n";
- for (i = 0; i < NumColumns; i++) {
- if (currentOffset[i] >= firstOffset[i + 1]) {
- // this column is finished
- out() << "\n \n"; // check why?
+ /*
+ Output a element to contain all the
elements.
+ */
+ out() << "\n";
+
+ for (int i=0; i
.
+ */
+ if (curParOffset == 0) {
+ if (i > 0)
+ out() << "\n";
+ if (++numTableRows % 2 == 1)
+ out() << "";
+ else
+ out() << "";
+ out() << "";
+ if (includeAlphabet) {
+ QChar c = paragraphName[curParNr][0].toLower();
+ out() << QString(" ").arg(c);
}
- else {
- while ((currentParagraphNo[i] < NumParagraphs) &&
- (currentOffsetInParagraph[i] == paragraph[currentParagraphNo[i]].count())) {
- ++currentParagraphNo[i];
- currentOffsetInParagraph[i] = 0;
- }
-#if 0
- if (currentParagraphNo[i] >= NumParagraphs) {
- qDebug() << "### Internal error ###" << __FILE__ << __LINE__
- << currentParagraphNo[i] << NumParagraphs;
- currentParagraphNo[i] = NumParagraphs - 1;
- }
-#endif
- out() << "";
- if (currentOffsetInParagraph[i] == 0) {
- // start a new paragraph
- if (includeAlphabet) {
- QChar c = paragraphName[currentParagraphNo[i]][0].toLower();
- out() << QString(" ").arg(c);
- }
- out() << ""
- << paragraphName[currentParagraphNo[i]]
- << " ";
- }
- out() << "
\n";
-
- out() << "";
- if ((currentParagraphNo[i] < NumParagraphs) &&
- !paragraphName[currentParagraphNo[i]].isEmpty()) {
- NodeMap::Iterator it;
- it = paragraph[currentParagraphNo[i]].begin();
- for (j = 0; j < currentOffsetInParagraph[i]; j++)
- ++it;
-
- // Previously, we used generateFullName() for this, but we
- // require some special formatting.
- out() << "";
- QStringList pieces;
- if (it.value()->subType() == Node::QmlClass)
- pieces << it.value()->name();
- else
- pieces = fullName(it.value(), relative, marker).split("::");
- out() << protectEnc(pieces.last());
- out() << " ";
- if (pieces.size() > 1) {
- out() << " (";
- generateFullName(it.value()->parent(), relative, marker);
- out() << ")";
- }
- }
- out() << "
\n";
-
- currentOffset[i]++;
- currentOffsetInParagraph[i]++;
+ out() << ""
+ << paragraphName[curParNr]
+ << " ";
+ out() << " \n";
+ }
+
+ /*
+ Output a for the current offset in the current paragraph.
+ */
+ out() << "";
+ if ((curParNr < NumParagraphs) &&
+ !paragraphName[curParNr].isEmpty()) {
+ NodeMap::Iterator it;
+ it = paragraph[curParNr].begin();
+ for (int i=0; i";
+
+ QStringList pieces;
+ if (it.value()->subType() == Node::QmlClass)
+ pieces << it.value()->name();
+ else
+ pieces = fullName(it.value(), relative, marker).split("::");
+ out() << protectEnc(pieces.last());
+ out() << "";
+ if (pieces.size() > 1) {
+ out() << " (";
+ generateFullName(it.value()->parent(), relative, marker);
+ out() << ")";
}
}
- out() << " \n";
+ out() << "\n";
+ curParOffset++;
}
- out() << "
\n";
+ out() << "\n";
+ out() << "\n";
}
void HtmlGenerator::generateFunctionIndex(const Node *relative,
@@ -2612,7 +2618,7 @@
QMap::ConstIterator it = legaleseTexts.begin();
while (it != legaleseTexts.end()) {
Text text = it.key();
- out() << " \n";
+ //out() << " \n";
generateText(text, relative, marker);
out() << "\n";
do {
@@ -2625,44 +2631,6 @@
}
}
-/*void HtmlGenerator::generateSynopsis(const Node *node,
- const Node *relative,
- CodeMarker *marker,
- CodeMarker::SynopsisStyle style)
-{
- QString marked = marker->markedUpSynopsis(node, relative, style);
- QRegExp templateTag("(<[^@>]*>)");
- if (marked.indexOf(templateTag) != -1) {
- QString contents = protectEnc(marked.mid(templateTag.pos(1),
- templateTag.cap(1).length()));
- marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
- contents);
- }
- marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])@param>"),
- "\\1\\2 ");
- marked.replace("<@param>", "");
- marked.replace("@param>", " ");
-
- if (style == CodeMarker::Summary)
- marked.replace("@name>", "b>");
-
- if (style == CodeMarker::SeparateList) {
- QRegExp extraRegExp("<@extra>.*@extra>");
- extraRegExp.setMinimal(true);
- marked.replace(extraRegExp, "");
- }
- else {
- marked.replace("<@extra>", " ");
- marked.replace("@extra>", " ");
- }
-
- if (style != CodeMarker::Detailed) {
- marked.replace("<@type>", "");
- marked.replace("@type>", "");
- }
- out() << highlightedCode(marked, marker, relative);
-}*/
-
#ifdef QDOC_QML
void HtmlGenerator::generateQmlItem(const Node *node,
const Node *relative,
@@ -2692,7 +2660,7 @@
marked.replace("<@type>", "");
marked.replace("@type>", "");
}
- out() << highlightedCode(marked, marker, relative);
+ out() << highlightedCode(marked, marker, relative, false, node);
}
#endif
@@ -2810,24 +2778,23 @@
}
}
-#ifdef QDOC_NAME_ALIGNMENT
void HtmlGenerator::generateSection(const NodeList& nl,
const Node *relative,
CodeMarker *marker,
CodeMarker::SynopsisStyle style)
{
- bool name_alignment = true;
+ bool alignNames = true;
if (!nl.isEmpty()) {
bool twoColumn = false;
if (style == CodeMarker::SeparateList) {
- name_alignment = false;
+ alignNames = false;
twoColumn = (nl.count() >= 16);
}
else if (nl.first()->type() == Node::Property) {
twoColumn = (nl.count() >= 5);
- name_alignment = false;
+ alignNames = false;
}
- if (name_alignment) {
+ if (alignNames) {
out() << "\n";
}
else {
@@ -2845,7 +2812,7 @@
continue;
}
- if (name_alignment) {
+ if (alignNames) {
out() << " ";
}
else {
@@ -2854,15 +2821,15 @@
out() << "";
}
- generateSynopsis(*m, relative, marker, style, name_alignment);
- if (name_alignment)
+ generateSynopsis(*m, relative, marker, style, alignNames);
+ if (alignNames)
out() << " \n";
else
out() << "\n";
i++;
++m;
}
- if (name_alignment)
+ if (alignNames)
out() << "
\n";
else {
out() << " \n";
@@ -2877,18 +2844,18 @@
CodeMarker *marker,
CodeMarker::SynopsisStyle style)
{
- bool name_alignment = true;
+ bool alignNames = true;
if (!section.members.isEmpty()) {
bool twoColumn = false;
if (style == CodeMarker::SeparateList) {
- name_alignment = false;
+ alignNames = false;
twoColumn = (section.members.count() >= 16);
}
else if (section.members.first()->type() == Node::Property) {
twoColumn = (section.members.count() >= 5);
- name_alignment = false;
+ alignNames = false;
}
- if (name_alignment) {
+ if (alignNames) {
out() << "\n";
}
else {
@@ -2906,7 +2873,7 @@
continue;
}
- if (name_alignment) {
+ if (alignNames) {
out() << " ";
}
else {
@@ -2915,15 +2882,15 @@
out() << "";
}
- generateSynopsis(*m, relative, marker, style, name_alignment);
- if (name_alignment)
+ generateSynopsis(*m, relative, marker, style, alignNames);
+ if (alignNames)
out() << " \n";
else
out() << "\n";
i++;
++m;
}
- if (name_alignment)
+ if (alignNames)
out() << "
\n";
else {
out() << "\n";
@@ -2934,22 +2901,18 @@
if (style == CodeMarker::Summary && !section.inherited.isEmpty()) {
out() << "\n";
- generateSectionInheritedList(section, relative, marker, name_alignment);
+ generateSectionInheritedList(section, relative, marker);
out() << " \n";
}
}
void HtmlGenerator::generateSectionInheritedList(const Section& section,
const Node *relative,
- CodeMarker *marker,
- bool nameAlignment)
+ CodeMarker *marker)
{
QList >::ConstIterator p = section.inherited.begin();
while (p != section.inherited.end()) {
- if (nameAlignment)
- out() << "";
- else
- out() << " ";
+ out() << " ";
out() << (*p).second << " ";
if ((*p).second == 1) {
out() << section.singularMember;
@@ -2969,7 +2932,7 @@
const Node *relative,
CodeMarker *marker,
CodeMarker::SynopsisStyle style,
- bool nameAlignment)
+ bool alignNames)
{
QString marked = marker->markedUpSynopsis(node, relative, style);
QRegExp templateTag("(<[^@>]*>)");
@@ -3002,14 +2965,14 @@
marked.replace("<@type>", "");
marked.replace("@type>", "");
}
- out() << highlightedCode(marked, marker, relative, style, nameAlignment);
+ out() << highlightedCode(marked, marker, relative, alignNames);
}
QString HtmlGenerator::highlightedCode(const QString& markedCode,
- CodeMarker *marker,
- const Node *relative,
- CodeMarker::SynopsisStyle ,
- bool nameAlignment)
+ CodeMarker* marker,
+ const Node* relative,
+ bool alignNames,
+ const Node* self)
{
QString src = markedCode;
QString html;
@@ -3019,20 +2982,24 @@
const QChar charLangle = '<';
const QChar charAt = '@';
+ static const QString typeTag("type");
+ static const QString headerTag("headerfile");
+ static const QString funcTag("func");
+ static const QString linkTag("link");
+
// replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(@link>)"
- static const QString linkTag("link");
bool done = false;
- for (int i = 0, n = src.size(); i < n;) {
+ for (int i = 0, srcSize = src.size(); i < srcSize;) {
if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') {
- if (nameAlignment && !done) {// && (i != 0)) Why was this here?
+ if (alignNames && !done) {// && (i != 0)) Why was this here?
html += "";
done = true;
}
i += 2;
- if (parseArg(src, linkTag, &i, n, &arg, &par1)) {
+ if (parseArg(src, linkTag, &i, srcSize, &arg, &par1)) {
html += "";
- QString link = linkForNode(
- CodeMarker::nodeForString(par1.toString()), relative);
+ const Node* n = CodeMarker::nodeForString(par1.toString());
+ QString link = linkForNode(n, relative);
addLink(link, arg, &html);
html += " ";
}
@@ -3052,16 +3019,14 @@
// replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(@func>)"
src = html;
html = QString();
- static const QString funcTag("func");
- for (int i = 0, n = src.size(); i < n;) {
+ for (int i = 0, srcSize = src.size(); i < srcSize;) {
if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
i += 2;
- if (parseArg(src, funcTag, &i, n, &arg, &par1)) {
- QString link = linkForNode(
- marker->resolveTarget(par1.toString(),
- myTree,
- relative),
- relative);
+ if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
+ const Node* n = marker->resolveTarget(par1.toString(),
+ myTree,
+ relative);
+ QString link = linkForNode(n, relative);
addLink(link, arg, &html);
par1 = QStringRef();
}
@@ -3079,22 +3044,30 @@
// replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(@\\2>)" tags
src = html;
html = QString();
- static const QString typeTags[] = { "type", "headerfile", "func" };
- for (int i = 0, n = src.size(); i < n;) {
- if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
+
+ for (int i=0, srcSize=src.size(); iresolveTarget(arg.toString(), myTree, relative),
- relative);
- addLink(link, arg, &html);
- handled = true;
- break;
- }
+ if (parseArg(src, typeTag, &i, srcSize, &arg, &par1)) {
+ par1 = QStringRef();
+ const Node* n = marker->resolveTarget(arg.toString(), myTree, relative, self);
+ addLink(linkForNode(n,relative), arg, &html);
+ handled = true;
}
+ else if (parseArg(src, headerTag, &i, srcSize, &arg, &par1)) {
+ par1 = QStringRef();
+ const Node* n = marker->resolveTarget(arg.toString(), myTree, relative);
+ addLink(linkForNode(n,relative), arg, &html);
+ handled = true;
+ }
+ else if (parseArg(src, funcTag, &i, srcSize, &arg, &par1)) {
+ par1 = QStringRef();
+ const Node* n = marker->resolveTarget(arg.toString(), myTree, relative);
+ addLink(linkForNode(n,relative), arg, &html);
+ handled = true;
+ }
+
if (!handled) {
html += charLangle;
html += charAt;
@@ -3122,22 +3095,6 @@
"@preprocessor>","",
"@string>", "",
"@char>", ""
- // "<@char>", "",
- // "@char>", " ",
- // "<@func>", "",
- // "@func>", " ",
- // "<@id>", "",
- // "@id>", " ",
- // "<@keyword>", "",
- // "@keyword>", " ",
- // "<@number>", "",
- // "@number>", " ",
- // "<@op>", "",
- // "@op>", " ",
- // "<@param>", "",
- // "@param>", " ",
- // "<@string>", "",
- // "@string>", " ",
};
for (int i = 0, n = src.size(); i < n;) {
if (src.at(i) == charLangle) {
@@ -3175,281 +3132,6 @@
return html;
}
-#else
-void HtmlGenerator::generateSectionList(const Section& section,
- const Node *relative,
- CodeMarker *marker,
- CodeMarker::SynopsisStyle style)
-{
- if (!section.members.isEmpty()) {
- bool twoColumn = false;
- if (style == CodeMarker::SeparateList) {
- twoColumn = (section.members.count() >= 16);
- }
- else if (section.members.first()->type() == Node::Property) {
- twoColumn = (section.members.count() >= 5);
- }
- if (twoColumn)
- out() << "\n";
- if (++numTableRows % 2 == 1)
- out() << "";
- else
- out() << " ";
-
-// << " ";
- out() << "\n";
-
- int i = 0;
- NodeList::ConstIterator m = section.members.begin();
- while (m != section.members.end()) {
- if ((*m)->access() == Node::Private) {
- ++m;
- continue;
- }
-
- if (twoColumn && i == (int) (section.members.count() + 1) / 2)
- out() << " \n";
-
- out() << "";
- if (style == CodeMarker::Accessors)
- out() << "";
- generateSynopsis(*m, relative, marker, style);
- if (style == CodeMarker::Accessors)
- out() << " ";
- out() << " \n";
- i++;
- ++m;
- }
- out() << " \n";
- if (twoColumn)
- out() << " \n
\n";
- }
-
- if (style == CodeMarker::Summary && !section.inherited.isEmpty()) {
- out() << "\n";
- generateSectionInheritedList(section, relative, marker);
- out() << " \n";
- }
-}
-
-void HtmlGenerator::generateSectionInheritedList(const Section& section,
- const Node *relative,
- CodeMarker *marker)
-{
- QList >::ConstIterator p = section.inherited.begin();
- while (p != section.inherited.end()) {
- out() << "";
- out() << (*p).second << " ";
- if ((*p).second == 1) {
- out() << section.singularMember;
- } else {
- out() << section.pluralMember;
- }
- out() << " inherited from "
- << protectEnc(marker->plainFullName((*p).first, relative))
- << " \n";
- ++p;
- }
-}
-
-void HtmlGenerator::generateSynopsis(const Node *node,
- const Node *relative,
- CodeMarker *marker,
- CodeMarker::SynopsisStyle style)
-{
- QString marked = marker->markedUpSynopsis(node, relative, style);
- QRegExp templateTag("(<[^@>]*>)");
- if (marked.indexOf(templateTag) != -1) {
- QString contents = protectEnc(marked.mid(templateTag.pos(1),
- templateTag.cap(1).length()));
- marked.replace(templateTag.pos(1), templateTag.cap(1).length(),
- contents);
- }
- marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])@param>"), "\\1\\2 ");
- marked.replace("<@param>", "");
- marked.replace("@param>", " ");
-
- if (style == CodeMarker::Summary)
- marked.replace("@name>", "b>");
-
- if (style == CodeMarker::SeparateList) {
- QRegExp extraRegExp("<@extra>.*@extra>");
- extraRegExp.setMinimal(true);
- marked.replace(extraRegExp, "");
- } else {
- marked.replace("<@extra>", "");
- marked.replace("@extra>", " ");
- }
-
- if (style != CodeMarker::Detailed) {
- marked.replace("<@type>", "");
- marked.replace("@type>", "");
- }
- out() << highlightedCode(marked, marker, relative);
-}
-
-QString HtmlGenerator::highlightedCode(const QString& markedCode,
- CodeMarker *marker,
- const Node *relative)
-{
- QString src = markedCode;
- QString html;
- QStringRef arg;
- QStringRef par1;
-
- const QChar charLangle = '<';
- const QChar charAt = '@';
-
- // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*(@link>)"
- static const QString linkTag("link");
- for (int i = 0, n = src.size(); i < n;) {
- if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
- i += 2;
- if (parseArg(src, linkTag, &i, n, &arg, &par1)) {
- const Node* node = CodeMarker::nodeForString(par1.toString());
- QString link = linkForNode(node, relative);
- addLink(link, arg, &html);
- }
- else {
- html += charLangle;
- html += charAt;
- }
- }
- else {
- html += src.at(i++);
- }
- }
-
- if (slow) {
- // is this block ever used at all?
- // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)(@func>)"
- src = html;
- html = QString();
- static const QString funcTag("func");
- for (int i = 0, n = src.size(); i < n;) {
- if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
- i += 2;
- if (parseArg(src, funcTag, &i, n, &arg, &par1)) {
- QString link = linkForNode(
- marker->resolveTarget(par1.toString(),
- myTree,
- relative),
- relative);
- addLink(link, arg, &html);
- par1 = QStringRef();
- }
- else {
- html += charLangle;
- html += charAt;
- }
- }
- else {
- html += src.at(i++);
- }
- }
- }
-
- // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)(@\\2>)" tags
- src = html;
- html = QString();
- static const QString typeTags[] = { "type", "headerfile", "func" };
- for (int i = 0, n = src.size(); i < n;) {
- if (src.at(i) == charLangle && src.at(i + 1) == charAt) {
- i += 2;
- bool handled = false;
- for (int k = 0; k != 3; ++k) {
- if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) {
- par1 = QStringRef();
- QString link = linkForNode(
- marker->resolveTarget(arg.toString(), myTree, relative),
- relative);
- addLink(link, arg, &html);
- handled = true;
- break;
- }
- }
- if (!handled) {
- html += charLangle;
- html += charAt;
- }
- }
- else {
- html += src.at(i++);
- }
- }
-
- // replace all
- // "<@comment>" -> "