Fix bug #7948 by not hardcoding XHTML info for captions but instead

using InsetLayout.
This commit is contained in:
Richard Heck 2012-07-10 17:44:21 -04:00
parent 7821022ca0
commit f623ded109
8 changed files with 19 additions and 6 deletions

View File

@ -632,6 +632,7 @@ InsetLayout Caption:FigCaption
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-figcaption'"
End End

View File

@ -215,6 +215,7 @@ InsetLayout Caption:Table
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-table'"
End End

View File

@ -263,6 +263,7 @@ InsetLayout Caption:Centered
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-centered'"
End End

View File

@ -363,6 +363,7 @@ InsetLayout Caption:Centered
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-centered'"
End End

View File

@ -61,4 +61,5 @@ InsetLayout Caption:Bicaption
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-bicaption'"
End End

View File

@ -279,6 +279,7 @@ InsetLayout Caption:Above
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-above'"
End End
@ -298,6 +299,7 @@ InsetLayout Caption:Below
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-below'"
End End

View File

@ -486,6 +486,7 @@ InsetLayout Caption:Standard
margin: 1ex; margin: 1ex;
} }
EndHTMLStyle EndHTMLStyle
HTMLAttr "class='float-caption float-caption-standard'"
End End

View File

@ -305,13 +305,18 @@ docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const
{ {
if (rp.html_disable_captions) if (rp.html_disable_captions)
return docstring(); return docstring();
string attr = "class='float-caption"; InsetLayout const & il = getLayout();
if (!floattype_.empty()) string const tag = il.htmltag();
attr += " float-caption-" + floattype_; string attr = il.htmlattr();
attr += "'"; if (!type_.empty()) {
xs << html::StartTag("div", attr); string const our_class = "float-caption-" + type_;
size_t const loc = attr.find("class='");
if (loc != string::npos)
attr.insert(loc + 1, our_class);
}
xs << html::StartTag(tag, attr);
docstring def = getCaptionAsHTML(xs, rp); docstring def = getCaptionAsHTML(xs, rp);
xs << html::EndTag("div"); xs << html::EndTag(tag);
return def; return def;
} }