Output width and height parameters for XHTML images. Thanks to Rob Oakes

for the patch.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37554 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2011-02-07 23:47:43 +00:00
parent 16d57e550f
commit 2bb01af413

View File

@ -960,6 +960,7 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const
docstring InsetGraphics::xhtml(XHTMLStream & xs, OutputParams const & op) const docstring InsetGraphics::xhtml(XHTMLStream & xs, OutputParams const & op) const
{ {
string const output_file = prepareHTMLFile(op); string const output_file = prepareHTMLFile(op);
if (output_file.empty()) { if (output_file.empty()) {
LYXERR0("InsetGraphics::xhtml: Unable to prepare file `" LYXERR0("InsetGraphics::xhtml: Unable to prepare file `"
<< params().filename << "' for output. File missing?"); << params().filename << "' for output. File missing?");
@ -970,10 +971,18 @@ docstring InsetGraphics::xhtml(XHTMLStream & xs, OutputParams const & op) const
} }
// FIXME XHTML // FIXME XHTML
// Do we want to do something with the parameters, other than use them to // We aren't doing anything with the crop and rotate parameters, and it would
// crop, etc, the image? // really be better to do width and height conversion, rather than to output
// Speaking of which: Do the cropping, rotating, etc. // these parameters here.
string const attr = "src='" + output_file + "' alt='image: " string imgstyle;
if (!params().width.zero())
imgstyle += "width:" + params().width.asHTMLString() + ";";
if (!params().height.zero())
imgstyle += " height:" + params().height.asHTMLString() + ";";
if (!imgstyle.empty())
imgstyle = "style='" + imgstyle + "' ";
string const attr = imgstyle + "src='" + output_file + "' alt='image: "
+ output_file + "'"; + output_file + "'";
xs << html::CompTag("img", attr); xs << html::CompTag("img", attr);
return docstring(); return docstring();