QDoc: Force writing \n before a snippet in DITAXML.

Previously the snippet text would be indented, which causes an XSLT to
render the first line of a snippet at the indentation level of the .dita
file.

Change-Id: Iead8d07277f83ca5ccbf463f1cdb1c8210459d56
Reviewed-by: Martin Smith <martin.smith@nokia.com>
This commit is contained in:
Casper van Donderen 2012-05-29 15:42:01 +02:00 committed by Qt by Nokia
parent 4f539b2671
commit 28ae5aa332

View File

@ -828,14 +828,15 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
{
writeStartTag(DT_codeblock);
xmlWriter().writeAttribute("outputclass","cpp");
QString chars = trimmedTrailing(atom->string());
writeText(chars, marker, relative);
writeCharacters("\n");
writeText(trimmedTrailing(atom->string()), marker, relative);
writeEndTag(); // </codeblock>
}
break;
case Atom::Qml:
writeStartTag(DT_codeblock);
xmlWriter().writeAttribute("outputclass","qml");
writeCharacters("\n");
writeText(trimmedTrailing(atom->string()), marker, relative);
writeEndTag(); // </codeblock>
break;
@ -844,6 +845,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
xmlWriter().writeCharacters("you can rewrite it as");
writeEndTag(); // </p>
writeStartTag(DT_codeblock);
writeCharacters("\n");
writeText(trimmedTrailing(atom->string()), marker, relative);
writeEndTag(); // </codeblock>
break;
@ -854,6 +856,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom,
// fallthrough
case Atom::CodeBad:
writeStartTag(DT_codeblock);
writeCharacters("\n");
writeCharacters(trimmedTrailing(plainCode(atom->string())));
writeEndTag(); // </codeblock>
break;