summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/ditaxmlgenerator.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@nokia.com>2010-12-06 14:34:19 (GMT)
committerMartin Smith <martin.smith@nokia.com>2010-12-06 14:34:19 (GMT)
commitb5915ef3a6d0417440ad82e9369d6679505b953e (patch)
tree5cb6a85dade01bdd9371b8df3978de0eb6e8baac /tools/qdoc3/ditaxmlgenerator.cpp
parentc5d942a039b924b0179a9845cce2e4660905f2f8 (diff)
downloadQt-b5915ef3a6d0417440ad82e9369d6679505b953e.zip
Qt-b5915ef3a6d0417440ad82e9369d6679505b953e.tar.gz
Qt-b5915ef3a6d0417440ad82e9369d6679505b953e.tar.bz2
qdoc: Fixed some reported bugs in the XML.
Diffstat (limited to 'tools/qdoc3/ditaxmlgenerator.cpp')
-rw-r--r--tools/qdoc3/ditaxmlgenerator.cpp69
1 files changed, 32 insertions, 37 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp
index d4285a8..b4a42ab 100644
--- a/tools/qdoc3/ditaxmlgenerator.cpp
+++ b/tools/qdoc3/ditaxmlgenerator.cpp
@@ -714,27 +714,24 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
break;
case Atom::Code:
{
- xmlWriter().writeStartElement("pre");
- xmlWriter().writeAttribute("outputclass","highlightedcode");
+ xmlWriter().writeStartElement("codeblock");
QString chars = trimmedTrailing(atom->string());
writeText(chars, marker, relative);
- xmlWriter().writeEndElement(); // </pre>
+ xmlWriter().writeEndElement(); // </codeblock>
}
break;
case Atom::Qml:
- xmlWriter().writeStartElement("pre");
- xmlWriter().writeAttribute("outputclass","highlightedcode");
+ xmlWriter().writeStartElement("codeblock");
writeText(trimmedTrailing(atom->string()), marker, relative);
- xmlWriter().writeEndElement(); // </pre>
+ xmlWriter().writeEndElement(); // </codeblock>
break;
case Atom::CodeNew:
xmlWriter().writeStartElement("p");
xmlWriter().writeCharacters("you can rewrite it as");
xmlWriter().writeEndElement(); // </p>
- xmlWriter().writeStartElement("pre");
- xmlWriter().writeAttribute("outputclass","highlightedcode");
+ xmlWriter().writeStartElement("codeblock");
writeText(trimmedTrailing(atom->string()), marker, relative);
- xmlWriter().writeEndElement(); // </pre>
+ xmlWriter().writeEndElement(); // </codeblock>
break;
case Atom::CodeOld:
xmlWriter().writeStartElement("p");
@@ -742,10 +739,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
xmlWriter().writeEndElement(); // </p>
// fallthrough
case Atom::CodeBad:
- xmlWriter().writeStartElement("pre");
- xmlWriter().writeAttribute("outputclass","highlightedcode");
- xmlWriter().writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string()))));
- xmlWriter().writeEndElement(); // </pre>
+ xmlWriter().writeStartElement("codeblock");
+ xmlWriter().writeCharacters(trimmedTrailing(plainCode(atom->string())));
+ xmlWriter().writeEndElement(); // </codeblock>
break;
case Atom::FootnoteLeft:
// ### For now
@@ -1043,30 +1039,30 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
if (atom->next() != 0)
text = atom->next()->string();
if (fileName.isEmpty()) {
- xmlWriter().writeStartElement("b");
- xmlWriter().writeAttribute("outputclass","error");
- xmlWriter().writeCharacters("[Missing image: ");
- xmlWriter().writeCharacters(protectEnc(atom->string()));
- xmlWriter().writeEndElement(); // </b>
+ /*
+ Don't bother outputting an error message.
+ Just output the href as if the image is in
+ the images directory...
+ */
+ fileName = QLatin1String("images/") + protectEnc(atom->string());
}
+
+ xmlWriter().writeStartElement("fig");
+ xmlWriter().writeStartElement("image");
+ xmlWriter().writeAttribute("href",protectEnc(fileName));
+ if (atom->type() == Atom::InlineImage)
+ xmlWriter().writeAttribute("placement","inline");
else {
- xmlWriter().writeStartElement("fig");
- xmlWriter().writeStartElement("image");
- xmlWriter().writeAttribute("href",protectEnc(fileName));
- if (atom->type() == Atom::InlineImage)
- xmlWriter().writeAttribute("placement","inline");
- else {
- xmlWriter().writeAttribute("placement","break");
- xmlWriter().writeAttribute("align","center");
- }
- if (!text.isEmpty()) {
- xmlWriter().writeStartElement("alt");
- xmlWriter().writeCharacters(protectEnc(text));
- xmlWriter().writeEndElement(); // </alt>
- }
- xmlWriter().writeEndElement(); // </image>
- xmlWriter().writeEndElement(); // </fig>
+ xmlWriter().writeAttribute("placement","break");
+ xmlWriter().writeAttribute("align","center");
+ }
+ if (!text.isEmpty()) {
+ xmlWriter().writeStartElement("alt");
+ xmlWriter().writeCharacters(protectEnc(text));
+ xmlWriter().writeEndElement(); // </alt>
}
+ xmlWriter().writeEndElement(); // </image>
+ xmlWriter().writeEndElement(); // </fig>
}
break;
case Atom::ImageText:
@@ -2263,10 +2259,9 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker)
void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* marker)
{
if (!inner->includes().isEmpty()) {
- xmlWriter().writeStartElement("pre");
- xmlWriter().writeAttribute("outputclass","highlightedcode");
+ xmlWriter().writeStartElement("codeblock");
writeText(marker->markedUpIncludes(inner->includes()), marker, inner);
- xmlWriter().writeEndElement(); // </pre>
+ xmlWriter().writeEndElement(); // </codeblock>
}
}