]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetWrap.cpp
Pure HTML output for math macros.
[lyx.git] / src / insets / InsetWrap.cpp
index 2b4e68ab8c067c01dcaa927933d9efd3add139e9..97fed142ec0a017fbbab2fae57d688f82544029e 100644 (file)
@@ -26,6 +26,7 @@
 #include "FuncStatus.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
+#include "output_xhtml.h"
 #include "TextClass.h"
 
 #include "support/debug.h"
@@ -113,20 +114,26 @@ bool InsetWrap::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetWrap::updateLabels(ParIterator const & it)
+void InsetWrap::updateBuffer(ParIterator const & it, UpdateType utype)
 {
        setLabel(_("wrap: ") + floatName(params_.type));
        Counters & cnts =
                buffer().masterBuffer()->params().documentClass().counters();
+       if (utype == OutputUpdate) {
+               // counters are local to the wrap
+               cnts.saveLastCounter();
+       }
        string const saveflt = cnts.current_float();
 
        // Tell to captions what the current float is
        cnts.current_float(params().type);
 
-       InsetCollapsable::updateLabels(it);
+       InsetCollapsable::updateBuffer(it, utype);
 
        // reset afterwards
        cnts.current_float(saveflt);
+       if (utype == OutputUpdate)
+               cnts.restoreLastCounter();
 }
 
 
@@ -214,18 +221,17 @@ int InsetWrap::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
-docstring InsetWrap::xhtml(odocstream &, OutputParams const & rp) const
+docstring InsetWrap::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 {
        string const len = params_.width.asHTMLString();
-       docstring retval = from_ascii("<div class='wrap'");
+       string const width = len.empty() ? "50%" : len;
+       string const attr = "class='wrap' style='width: " + len + ";'";
+       xs << html::StartTag("div", attr);
+       docstring const deferred = 
+               InsetText::insetAsXHTML(xs, rp, InsetText::WriteInnerTag);
        if (!len.empty())
-               retval += from_ascii(" style='width: " + len + ";");
-       retval += from_ascii("'>");
-       odocstringstream os;
-       docstring const deferred = InsetText::xhtml(os, rp);
-       retval += os.str() + from_ascii("</div>");
-       retval += deferred;
-       return retval;
+               xs << html::EndTag("div");
+       return deferred;
 }