mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Better preview for images.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38192 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d7a2ae0bf3
commit
17f1b1d04a
@ -2145,19 +2145,26 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
|
|||||||
// but what follows is equivalent, since we'll enter only if either (a) we
|
// but what follows is equivalent, since we'll enter only if either (a) we
|
||||||
// tried and failed with MathML or HTML or (b) didn't try yet at all but
|
// tried and failed with MathML or HTML or (b) didn't try yet at all but
|
||||||
// aren't doing LaTeX, in which case we are doing Images.
|
// aren't doing LaTeX, in which case we are doing Images.
|
||||||
if (!success && mathtype != BufferParams::LaTeX && !op.dryrun) {
|
if (!success && mathtype != BufferParams::LaTeX) {
|
||||||
|
graphics::PreviewImage const * pimage = 0;
|
||||||
|
if (!op.dryrun) {
|
||||||
loadPreview(docit_);
|
loadPreview(docit_);
|
||||||
graphics::PreviewImage const * pimage = preview_->getPreviewImage(buffer());
|
pimage = preview_->getPreviewImage(buffer());
|
||||||
if (pimage) {
|
|
||||||
// FIXME Do we always have png?
|
// FIXME Do we always have png?
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pimage || op.dryrun) {
|
||||||
|
string const filename = pimage ? pimage->filename().onlyFileName()
|
||||||
|
: "previewimage.png";
|
||||||
string const tag = (getType() == hullSimple) ? "span" : "div";
|
string const tag = (getType() == hullSimple) ? "span" : "div";
|
||||||
FileName const & mathimg = pimage->filename();
|
xs << html::CR()
|
||||||
xs << html::StartTag(tag)
|
<< html::StartTag(tag)
|
||||||
<< html::CompTag("img", "src=\"" + mathimg.onlyFileName() + "\"")
|
<< html::CompTag("img", "src=\"" + filename + "\"")
|
||||||
<< html::EndTag(tag)
|
<< html::EndTag(tag)
|
||||||
<< html::CR();
|
<< html::CR();
|
||||||
|
if (pimage)
|
||||||
// add the file to the list of files to be exported
|
// add the file to the list of files to be exported
|
||||||
op.exportdata->addExternalFile("xhtml", mathimg);
|
op.exportdata->addExternalFile("xhtml", pimage->filename());
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user