Restore XHTML output for InsetListings.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32515 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-12-13 21:14:53 +00:00
parent 9f6c1b8ccb
commit 43207c17bc
2 changed files with 16 additions and 12 deletions

View File

@ -26,6 +26,7 @@
#include "Language.h" #include "Language.h"
#include "MetricsInfo.h" #include "MetricsInfo.h"
#include "output_latex.h" #include "output_latex.h"
#include "output_xhtml.h"
#include "TextClass.h" #include "TextClass.h"
#include "support/debug.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(); bool const isInline = params().isInline();
if (isInline) if (isInline)
out << "<br />\n"; out << CompTag("br");
else { else {
out << "<div class='float float-listings'>\n"; out << StartTag("div", "class='float float-listings'");
docstring caption = getCaptionHTML(rp); docstring caption = getCaptionHTML(rp);
if (!caption.empty()) if (!caption.empty())
out << "<div class='float-caption'>" << caption << "</div>\n"; out << StartTag("div", "class='float-caption'")
<< caption << EndTag("div");
} }
out << "<pre>\n"; out << StartTag("pre");
OutputParams newrp = rp; OutputParams newrp = rp;
newrp.html_disable_captions = true; newrp.html_disable_captions = true;
docstring def = InsetText::xhtml(out, newrp); docstring def = InsetText::xhtml(out, newrp);
out << "\n</pre>\n"; out << EndTag("pre");
if (isInline) { if (isInline) {
out << "<br />\n"; out << CompTag("br");
os << out.str(); // escaping will already have been done
os << XHTMLStream::NextRaw() << ods.str();
} else { } else {
out << "</div>"; out << EndTag("div");
// In this case, this needs to be deferred, but we'll put it // In this case, this needs to be deferred, but we'll put it
// before anything the text itself deferred. // before anything the text itself deferred.
def = out.str() + '\n' + def; def = ods.str() + '\n' + def;
} }
return def; return def;
} }

View File

@ -57,7 +57,7 @@ private:
/// ///
int latex(odocstream &, OutputParams const &) const; int latex(odocstream &, OutputParams const &) const;
/// ///
docstring xhtml(odocstream &, OutputParams const &) const; docstring xhtml(XHTMLStream &, OutputParams const &) const;
/// ///
void validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
/// ///