]> git.lyx.org Git - features.git/commitdiff
Restore XHTML output for InsetGraphics.
authorRichard Heck <rgheck@comcast.net>
Thu, 3 Dec 2009 19:52:46 +0000 (19:52 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 3 Dec 2009 19:52:46 +0000 (19:52 +0000)
To make this really good, we'd want to be able to rotate, crop, etc, the
images, as well as convert them to suitable output formats. This should
not be too difficult, since we do this sort of thing for display,
anyway. But I don't myself know how to do it. Anyone?

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32295 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetGraphics.cpp
src/insets/InsetGraphics.h

index 0fa18359078cd8dfd75c8836b800222b48c8de14..af89ebb415bd03a4202a6d8cee71d90a929cbf51 100644 (file)
@@ -66,6 +66,7 @@ TODO
 #include "MetricsInfo.h"
 #include "Mover.h"
 #include "OutputParams.h"
+#include "output_xhtml.h"
 #include "sgml.h"
 #include "TocBackend.h"
 
@@ -941,20 +942,25 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const
 }
 
 
-docstring InsetGraphics::xhtml(odocstream & os, OutputParams const & op) const
+docstring InsetGraphics::xhtml(XHTMLStream & xs, OutputParams const & op) const
 {
-       string output_file = prepareHTMLFile(op);
+       string const output_file = prepareHTMLFile(op);
        if (output_file.empty()) {
-               LYXERR0("InsetGraphics::xhtml: File `" << params().filename 
-                                               << "' not found.");
-               os << "<img src=\"" << params().filename.absFilename() << "\" />";
+               LYXERR0("InsetGraphics::xhtml: Unable to prepare file `" 
+                       << params().filename << "' for output. File missing?");
+               string const attr = "src='" + params().filename.absFilename() 
+                                   + "' alt='image: " + output_file + "'";
+               xs << CompTag("img", attr);
                return docstring();
        }
 
-       // FIXME Do we want to do something with the parameters, other than
-       // use them to do another conversion?
-       // FIXME Do the other conversion! Cropping, rotating, etc.
-       os << "<img src=\"" << from_utf8(output_file) << "\" />";
+       // FIXME XHTML 
+       // Do we want to do something with the parameters, other than use them to 
+       // crop, etc, the image?
+       // Speaking of which: Do the cropping, rotating, etc.
+       string const attr = "src='" + output_file + "' alt='image: " 
+                           + output_file + "'";
+       xs << CompTag("img", attr);
        return docstring();
 }
 
index 392a7acd82971ef4826adc7ef1389548b7f63b28..14a1f9caf791000790cc99bc72424970316c6715 100644 (file)
@@ -75,7 +75,7 @@ private:
        ///
        int docbook(odocstream &, OutputParams const &) const;
        ///
-       docstring xhtml(odocstream & os, OutputParams const &) const;
+       docstring xhtml(XHTMLStream & os, OutputParams const &) const;
        /** Tell LyX what the latex features you need i.e. what latex packages
            you need to be included.
         */