]> git.lyx.org Git - features.git/commitdiff
Restore XHTML for InsetBox.
authorRichard Heck <rgheck@comcast.net>
Thu, 26 Nov 2009 16:38:26 +0000 (16:38 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 26 Nov 2009 16:38:26 +0000 (16:38 +0000)
I guess that this should be "inline", that is, appear where it appears
in the LyX file, as opposed to being deferred until after the current
paragraph is output. But I'm not sure about this. If anyone has a view,
let me know.

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

src/insets/InsetBox.cpp
src/insets/InsetBox.h
src/insets/InsetText.cpp
src/insets/InsetText.h

index 25552d5aa88f4ff4d87a381fad5d6357aac64259..ad2084f5bb7497c54d54f6e4db9390c075aa3a7f 100644 (file)
@@ -24,6 +24,7 @@
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
+#include "output_xhtml.h"
 #include "TextClass.h"
 
 #include "support/debug.h"
@@ -478,24 +479,24 @@ int InsetBox::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
-docstring InsetBox::xhtml(odocstream &, OutputParams const & runparams) const
+docstring InsetBox::xhtml(XHTMLStream & xs, OutputParams const & runparams) const
 {
+       // construct attributes
+       string attrs = "class='" + params_.type + "'";
        string style;
        if (!params_.width.empty())
                style += ("width: " + params_.width.asHTMLString() + ";");
        if (!params_.height.empty())
                style += ("height: " + params_.height.asHTMLString() + ";");
-       
-       docstring retval = from_ascii("<div class='" + params_.type + "'");
        if (!style.empty())
-               retval += from_ascii(" style='" + style + "'");
-       retval += ">\n";
-       odocstringstream os;
-       docstring defer = InsetText::xhtml(os, runparams);
-       retval += os.str();
-       retval += "</div>\n";
-       retval += defer + "\n";
-       return retval;
+               attrs += " style='" + style + "'";
+
+       xs << StartTag("div", attrs);
+       XHTMLOptions const opts = InsetText::WriteLabel | InsetText::WriteInnerTag;
+       docstring defer = InsetText::insetAsXHTML(xs, runparams, opts);
+       xs << EndTag("div");
+       xs << defer;
+       return docstring();
 }
 
 
index 1a45b04d8f948c1e1b20b09a0b936667a1b6298b..83ba43403e07129dd5270eb6446a85970aa820f6 100644 (file)
@@ -117,7 +117,7 @@ private:
        ///
        int docbook(odocstream &, OutputParams const &) const;
        ///
-       docstring xhtml(odocstream &, OutputParams const &) const;
+       docstring xhtml(XHTMLStream &, OutputParams const &) const;
        ///
        void validate(LaTeXFeatures &) const;
        ///
index 1d57c843a919a33e29216c14f41681f61848aa78..ccdc9f04ac826bea23d804fa986b37528e484aec 100644 (file)
@@ -889,4 +889,9 @@ docstring InsetText::getCaptionHTML(OutputParams const & runparams) const
 }
 
 
+InsetText::XHTMLOptions operator|(InsetText::XHTMLOptions a1, InsetText::XHTMLOptions a2)
+{
+       return static_cast<InsetText::XHTMLOptions>((int)a1 | (int)a2);
+}
+
 } // namespace lyx
index fb1fb0a6ba9e7a1d91abe9dacee8c885bb4bdbad..421870b0e6b2705e289e68a76c0dfb81053536e3 100644 (file)
@@ -222,6 +222,9 @@ private:
        mutable Text text_;
 };
 
+
+InsetText::XHTMLOptions operator|(InsetText::XHTMLOptions a1, InsetText::XHTMLOptions a2);
+
 } // namespace lyx
 
 #endif