From f623ded10945d1bc81efcb9ac4b63c25de5c21a1 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 10 Jul 2012 17:44:21 -0400 Subject: [PATCH] Fix bug #7948 by not hardcoding XHTML info for captions but instead using InsetLayout. --- lib/layouts/aastex.layout | 1 + lib/layouts/aguplus.inc | 1 + lib/layouts/apa.layout | 1 + lib/layouts/apa6.layout | 1 + lib/layouts/bicaption.module | 1 + lib/layouts/scrclass.inc | 2 ++ lib/layouts/stdinsets.inc | 1 + src/insets/InsetCaption.cpp | 17 +++++++++++------ 8 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/layouts/aastex.layout b/lib/layouts/aastex.layout index 9b507bb65e..7e34d3c830 100644 --- a/lib/layouts/aastex.layout +++ b/lib/layouts/aastex.layout @@ -632,6 +632,7 @@ InsetLayout Caption:FigCaption margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-figcaption'" End diff --git a/lib/layouts/aguplus.inc b/lib/layouts/aguplus.inc index 5b866f342f..2a359305a2 100644 --- a/lib/layouts/aguplus.inc +++ b/lib/layouts/aguplus.inc @@ -215,6 +215,7 @@ InsetLayout Caption:Table margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-table'" End diff --git a/lib/layouts/apa.layout b/lib/layouts/apa.layout index 374a048f65..68c3a0de12 100644 --- a/lib/layouts/apa.layout +++ b/lib/layouts/apa.layout @@ -263,6 +263,7 @@ InsetLayout Caption:Centered margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-centered'" End diff --git a/lib/layouts/apa6.layout b/lib/layouts/apa6.layout index 9641621f15..5fd0bcbcd0 100644 --- a/lib/layouts/apa6.layout +++ b/lib/layouts/apa6.layout @@ -363,6 +363,7 @@ InsetLayout Caption:Centered margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-centered'" End diff --git a/lib/layouts/bicaption.module b/lib/layouts/bicaption.module index fad79db73b..122d9fc4f7 100644 --- a/lib/layouts/bicaption.module +++ b/lib/layouts/bicaption.module @@ -61,4 +61,5 @@ InsetLayout Caption:Bicaption margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-bicaption'" End diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc index f870eee916..471d9c0be2 100644 --- a/lib/layouts/scrclass.inc +++ b/lib/layouts/scrclass.inc @@ -279,6 +279,7 @@ InsetLayout Caption:Above margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-above'" End @@ -298,6 +299,7 @@ InsetLayout Caption:Below margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-below'" End diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index 1054254fc3..c38edbadf6 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -486,6 +486,7 @@ InsetLayout Caption:Standard margin: 1ex; } EndHTMLStyle + HTMLAttr "class='float-caption float-caption-standard'" End diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index 550f9fe6e1..37913bc480 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -305,13 +305,18 @@ docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const { if (rp.html_disable_captions) return docstring(); - 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 + 1, our_class); + } + xs << html::StartTag(tag, attr); docstring def = getCaptionAsHTML(xs, rp); - xs << html::EndTag("div"); + xs << html::EndTag(tag); return def; }