BufferParams const & bp = buffer().params();
FloatList const & floats = bp.documentClass().floats();
FloatList::const_iterator it = floats[type];
- // FIXME UNICODE
- return (it == floats.end()) ? from_ascii(type) : bp.B_(it->second.name());
+ return (it == floats.end()) ? from_utf8(type) : bp.B_(it->second.name());
}
-void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active) const
+void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active,
+ UpdateType utype) const
{
DocIterator pit = cpit;
pit.push_back(CursorSlice(const_cast<InsetCaptionable &>(*this)));
docstring str;
- int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH;
- text().forOutliner(str, length);
+ // Leave str empty if we generate for output (e.g. xhtml lists of figures).
+ // This ensures that there is a caption if and only if the string is
+ // non-empty.
+ if (utype != OutputUpdate)
+ text().forOutliner(str, TOC_ENTRY_LENGTH);
shared_ptr<TocBuilder> b = buffer().tocBackend().builder(caption_type_);
b->pushItem(pit, str, output_active);
// Proceed with the rest of the inset.
- InsetCollapsable::addToToc(cpit, output_active);
+ InsetCollapsable::addToToc(cpit, output_active, utype);
b->pop();
}