- string attr = "class='float-caption";
- if (!floattype_.empty())
- attr += " float-caption-" + floattype_;
- attr += "'";
- xs << html::StartTag("div", attr);
+ InsetLayout const & il = getLayout();
+ string const & tag = il.htmltag();
+ string attr = il.htmlattr();
+ if (!type_.empty()) {
+ string const our_class = "float-caption-" + type_;
+ size_t const loc = attr.find("class='");
+ if (loc != string::npos)
+ attr.insert(loc + 7, our_class + " ");
+ else
+ attr = attr + " class='" + our_class + "'";
+ }
+ xs << html::StartTag(tag, attr);