]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCaption.cpp
Fix conflicting inset font defaults (bug #8874)
[lyx.git] / src / insets / InsetCaption.cpp
index 4c7cd74e4e6940fd7461ac929637c893b47fcaa4..aaf06286f9abf3ee1f685b9b52ae5496d1f4e32b 100644 (file)
@@ -31,6 +31,7 @@
 #include "output_xhtml.h"
 #include "OutputParams.h"
 #include "Paragraph.h"
+#include "ParIterator.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
 #include "TocBackend.h"
@@ -107,7 +108,8 @@ void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const
 
        Toc & toc = buffer().tocBackend().toc(floattype_);
        docstring str = full_label_;
-       text().forToc(str, TOC_ENTRY_LENGTH);
+       int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH;
+       text().forToc(str, length);
        toc.push_back(TocItem(pit, 0, str, output_active));
 
        // Proceed with the rest of the inset.
@@ -274,6 +276,9 @@ void InsetCaption::latex(otexstream & os,
        // optional argument.
        runparams.moving_arg = !runparams.inTableCell;
        InsetText::latex(os, runparams);
+       // Backwards compatibility: We always had a linebreak after
+       // the caption (see #8514)
+       os << breakln;
        runparams_in.encoding = runparams.encoding;
 }
 
@@ -311,7 +316,9 @@ docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const
                string const our_class = "float-caption-" + type_;
                size_t const loc = attr.find("class='");
                if (loc != string::npos)
-                       attr.insert(loc + 1, our_class);
+                       attr.insert(loc + 7, our_class+ " ");
+               else
+                       attr = attr + " class='" + our_class + "'";
        }
        xs << html::StartTag(tag, attr);
        docstring def = getCaptionAsHTML(xs, rp);