- docstring retval = from_ascii("<div class='wrap'");
- 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;
+ string const width = len.empty() ? "50%" : len;
+ InsetLayout const & il = getLayout();
+ string const & tag = il.htmltag();
+ string const attr = il.htmlattr() + " style='width:" + width + ";'";
+ xs << html::StartTag(tag, attr);
+ docstring const deferred =
+ InsetText::insetAsXHTML(xs, rp, InsetText::WriteInnerTag);
+ xs << html::EndTag(tag);
+ return deferred;