Restore XHTML output for InsetCaption.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32247 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-11-30 17:27:10 +00:00
parent 83df2047c5
commit bad0994dcd
3 changed files with 17 additions and 12 deletions

View File

@ -28,6 +28,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 "OutputParams.h" #include "OutputParams.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "TextClass.h" #include "TextClass.h"
@ -250,17 +251,17 @@ int InsetCaption::docbook(odocstream & os,
} }
docstring InsetCaption::xhtml(odocstream & os, docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const
OutputParams const & rp) const
{ {
if (rp.html_disable_captions) if (rp.html_disable_captions)
return docstring(); return docstring();
os << "<div class='float-caption'>\n"; xs << StartTag("div", "class='float-caption'");
docstring def = getCaptionAsHTML(os, rp); docstring def = getCaptionAsHTML(xs, rp);
os << "</div>\n"; xs << EndTag("div");
return def; return def;
} }
int InsetCaption::getArgument(odocstream & os, int InsetCaption::getArgument(odocstream & os,
OutputParams const & runparams) const OutputParams const & runparams) const
{ {
@ -283,11 +284,13 @@ int InsetCaption::getCaptionAsPlaintext(odocstream & os,
} }
docstring InsetCaption::getCaptionAsHTML(odocstream & os, docstring InsetCaption::getCaptionAsHTML(XHTMLStream & xs,
OutputParams const & runparams) const OutputParams const & runparams) const
{ {
os << full_label_ << ' '; xs << full_label_ << ' ';
return InsetText::xhtml(os, runparams); InsetText::XHTMLOptions const opts =
InsetText::WriteLabel | InsetText::WriteInnerTag;
return InsetText::insetAsXHTML(xs, runparams, opts);
} }

View File

@ -31,7 +31,7 @@ public:
/// return the caption text /// return the caption text
int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const; int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
/// return the caption text as HTML /// return the caption text as HTML
docstring getCaptionAsHTML(odocstream & os, OutputParams const &) const; docstring getCaptionAsHTML(XHTMLStream & os, OutputParams const &) const;
private: private:
/// ///
void write(std::ostream & os) const; void write(std::ostream & os) const;
@ -69,7 +69,7 @@ private:
/// ///
int docbook(odocstream & os, OutputParams const & runparams) const; int docbook(odocstream & os, OutputParams const & runparams) const;
/// ///
docstring xhtml(odocstream & os, OutputParams const & runparams) const; docstring xhtml(XHTMLStream & os, OutputParams const & runparams) const;
/// ///
void setCustomLabel(docstring const & label); void setCustomLabel(docstring const & label);
/// ///

View File

@ -882,9 +882,11 @@ docstring InsetText::getCaptionHTML(OutputParams const & runparams) const
return docstring(); return docstring();
odocstringstream ods; odocstringstream ods;
docstring def = ins->getCaptionAsHTML(ods, runparams); XHTMLStream xs(ods);
docstring def = ins->getCaptionAsHTML(xs, runparams);
if (!def.empty()) if (!def.empty())
ods << def << '\n'; // should already have been escaped
xs << XHTMLStream::NextRaw() << def << '\n';
return ods.str(); return ods.str();
} }