From 28ae5aa332f00920bd29d876159d6b92922798dc Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Tue, 29 May 2012 15:42:01 +0200 Subject: 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 --- src/tools/qdoc/ditaxmlgenerator.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 9c84c43bd3..c448f0e413 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -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(); // } break; case Atom::Qml: writeStartTag(DT_codeblock); xmlWriter().writeAttribute("outputclass","qml"); + writeCharacters("\n"); writeText(trimmedTrailing(atom->string()), marker, relative); writeEndTag(); // break; @@ -844,6 +845,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters("you can rewrite it as"); writeEndTag(); //

writeStartTag(DT_codeblock); + writeCharacters("\n"); writeText(trimmedTrailing(atom->string()), marker, relative); writeEndTag(); // 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(); // break; -- cgit v1.2.3