Fix captions, in accord with observations by Abdel and JMarc.

Note that we will sometimes use the "caption trick", still in 
listings, for example.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30194 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-06-19 18:32:50 +00:00
parent 1ef0168dd4
commit 83a89711b0
6 changed files with 15 additions and 10 deletions

View File

@ -26,7 +26,7 @@ OutputParams::OutputParams(Encoding const * enc)
inComment(false), inTableCell(NO), inFloat(NONFLOAT),
inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED),
par_begin(0), par_end(0), isLastPar(false),
dryrun(false), verbatim(false)
dryrun(false), verbatim(false), disable_captions(false)
{
// Note: in PreviewLoader::Impl::dumpPreamble
// OutputParams runparams(0);

View File

@ -198,6 +198,8 @@ public:
bool dryrun;
/// Should we output verbatim or escape LaTeX's special chars?
bool verbatim;
/// Should we output captions? (Used in HTML output.)
bool disable_captions;
};

View File

@ -256,10 +256,15 @@ int InsetCaption::docbook(odocstream & os,
}
docstring InsetCaption::xhtml(odocstream &,
OutputParams const &) const
docstring InsetCaption::xhtml(odocstream & os,
OutputParams const & rp) const
{
return docstring();
if (rp.disable_captions)
return docstring();
os << "<div class='float-caption'>\n";
docstring def = getCaptionAsHTML(os, rp);
os << "</div>\n";
return def;
}
int InsetCaption::getArgument(odocstream & os,

View File

@ -70,7 +70,7 @@ private:
int plaintext(odocstream & os, OutputParams const & runparams) const;
///
int docbook(odocstream & os, OutputParams const & runparams) const;
/// This does nothing here. Instead, it is handled inside the float.
///
docstring xhtml(odocstream & os, OutputParams const & runparams) const;
///
void setCustomLabel(docstring const & label);

View File

@ -297,11 +297,7 @@ docstring InsetFloat::xhtml(odocstream & os, OutputParams const & rp) const
odocstringstream out;
docstring caption = getCaptionHTML(rp);
out << otag;
if (!caption.empty())
out << "<div class='float-caption'>" << caption << "</div>\n";
docstring def = InsetText::xhtml(out, rp);
out << ctag;

View File

@ -288,7 +288,9 @@ docstring InsetListings::xhtml(odocstream & os, OutputParams const & rp) const
}
out << "<pre>\n";
docstring def = InsetText::xhtml(out, rp);
OutputParams newrp = rp;
newrp.disable_captions = true;
docstring def = InsetText::xhtml(out, newrp);
out << "\n</pre>\n";
if (isInline) {