From 43207c17bcfa0a20bd61d3d45263c26c38424809 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sun, 13 Dec 2009 21:14:53 +0000 Subject: [PATCH] Restore XHTML output for InsetListings. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32515 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetListings.cpp | 26 +++++++++++++++----------- src/insets/InsetListings.h | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index 0174a977f8..e20d3c76df 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -26,6 +26,7 @@ #include "Language.h" #include "MetricsInfo.h" #include "output_latex.h" +#include "output_xhtml.h" #include "TextClass.h" #include "support/debug.h" @@ -267,34 +268,37 @@ int InsetListings::latex(odocstream & os, OutputParams const & runparams) const } -docstring InsetListings::xhtml(odocstream & os, OutputParams const & rp) const +docstring InsetListings::xhtml(XHTMLStream & os, OutputParams const & rp) const { - odocstringstream out; + odocstringstream ods; + XHTMLStream out(ods); bool const isInline = params().isInline(); if (isInline) - out << "
\n"; + out << CompTag("br"); else { - out << "
\n"; + out << StartTag("div", "class='float float-listings'"); docstring caption = getCaptionHTML(rp); if (!caption.empty()) - out << "
" << caption << "
\n"; + out << StartTag("div", "class='float-caption'") + << caption << EndTag("div"); } - out << "
\n";
+	out << StartTag("pre");
 	OutputParams newrp = rp;
 	newrp.html_disable_captions = true;
 	docstring def = InsetText::xhtml(out, newrp);
-	out << "\n
\n"; + out << EndTag("pre"); if (isInline) { - out << "
\n"; - os << out.str(); + out << CompTag("br"); + // escaping will already have been done + os << XHTMLStream::NextRaw() << ods.str(); } else { - out << "
"; + out << EndTag("div"); // In this case, this needs to be deferred, but we'll put it // before anything the text itself deferred. - def = out.str() + '\n' + def; + def = ods.str() + '\n' + def; } return def; } diff --git a/src/insets/InsetListings.h b/src/insets/InsetListings.h index 4459c9ee14..fc2ba3bd5a 100644 --- a/src/insets/InsetListings.h +++ b/src/insets/InsetListings.h @@ -57,7 +57,7 @@ private: /// int latex(odocstream &, OutputParams const &) const; /// - docstring xhtml(odocstream &, OutputParams const &) const; + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// void validate(LaTeXFeatures &) const; /// -- 2.39.2