}
-void InsetCaption::addToToc(DocIterator const & cpit) const
+void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const
{
if (floattype_.empty())
return;
Toc & toc = buffer().tocBackend().toc(floattype_);
docstring str = full_label_;
- text().forToc(str, TOC_ENTRY_LENGTH);
- toc.push_back(TocItem(pit, 0, str));
+ 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.
- InsetText::addToToc(cpit);
+ InsetText::addToToc(cpit, output_active);
}
if (first_arg == "changetype") {
string const type = cmd.getArg(1);
status.setOnOff(type == type_);
- bool varia = true;
+ bool varia = type != "LongTableNoNumber";
// check if the immediate parent inset allows caption variation
if (cur.depth() > 1) {
- if (&cur[cur.depth() - 2].inset()
- && !cur[cur.depth() - 2].inset().allowsCaptionVariation())
- varia = false;
+ if (&cur[cur.depth() - 2].inset())
+ varia = cur[cur.depth() - 2].inset().allowsCaptionVariation(type);
}
status.setEnabled(varia
&& buffer().params().documentClass().hasInsetLayout(
}
-int InsetCaption::plaintext(odocstream & os,
- OutputParams const & runparams) const
+int InsetCaption::plaintext(odocstringstream & os,
+ OutputParams const & runparams, size_t max_length) const
{
os << '[' << full_label_ << "\n";
- InsetText::plaintext(os, runparams);
+ InsetText::plaintext(os, runparams, max_length);
os << "\n]";
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
{
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;
}
OutputParams const & runparams) const
{
os << full_label_ << ' ';
- return InsetText::plaintext(os, runparams);
+ odocstringstream ods;
+ int const retval = InsetText::plaintext(ods, runparams);
+ os << ods.str();
+ return retval;
}