diff options
author | Martin Smith <martin.smith@nokia.com> | 2010-12-06 14:34:19 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2010-12-06 14:34:19 (GMT) |
commit | b5915ef3a6d0417440ad82e9369d6679505b953e (patch) | |
tree | 5cb6a85dade01bdd9371b8df3978de0eb6e8baac /tools | |
parent | c5d942a039b924b0179a9845cce2e4660905f2f8 (diff) | |
download | Qt-b5915ef3a6d0417440ad82e9369d6679505b953e.zip Qt-b5915ef3a6d0417440ad82e9369d6679505b953e.tar.gz Qt-b5915ef3a6d0417440ad82e9369d6679505b953e.tar.bz2 |
qdoc: Fixed some reported bugs in the XML.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 69 | ||||
-rw-r--r-- | tools/qdoc3/test/qt-ditaxml.qdocconf | 8 |
2 files changed, 39 insertions, 38 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> } } diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 63baead..1feb2b2 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -2,7 +2,8 @@ include(qt.qdocconf) imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ - $QTDIR/doc/src/template/images + $QTDIR/doc/src/declarative/pics \ + $QTDIR/doc/src/template/images outputdir = $QTDIR/doc/ditaxml outputformats = DITAXML @@ -40,3 +41,8 @@ macro.begincomment = "\\c{/*}" macro.endcomment = "\\c{*/}" macro.uuml.DITAXML = "ü" macro.mdash.DITAXML = "—" + +macro.beginfloatleft.HTML = " " +macro.beginfloatright.HTML = " " +macro.endfloat.HTML = " " +macro.clearfloat.HTML = " " |