- docstring const number = convert<docstring>(counter_);
- docstring label = custom_label_.empty()? buf.B_(type_): custom_label_;
- full_label_ = bformat(from_ascii("%1$s %2$s:"), label, number);
+ // FIXME: life would be _much_ simpler if listings was
+ // listed in Floating.
+ docstring name;
+ if (type == "listing")
+ name = master.B_("Listing");
+ else
+ name = master.B_(tclass.floats().getType(type).name());
+ docstring counter = from_utf8(type);
+ if ((is_subfloat_ = cnts.isSubfloat())) {
+ // only standard captions allowed in subfloats
+ type_ = "Standard";
+ counter = "sub-" + from_utf8(type);
+ name = bformat(_("Sub-%1$s"),
+ master.B_(tclass.floats().getType(type).name()));
+ }
+ docstring sec;
+ docstring const lstring = getLayout().labelstring();
+ docstring const labelstring = isAscii(lstring) ?
+ master.B_(to_ascii(lstring)) : lstring;
+ if (cnts.hasCounter(counter)) {
+ // for longtables, we step the counter upstream
+ if (!cnts.isLongtable())
+ cnts.step(counter, utype);
+ sec = cnts.theCounter(counter, lang);
+ }
+ if (labelstring != master.B_("standard")) {
+ if (!sec.empty())
+ sec += from_ascii(" ");
+ sec += bformat(from_ascii("(%1$s)"), labelstring);
+ }
+ if (!sec.empty())
+ full_label_ = bformat(from_ascii("%1$s %2$s: "), name, sec);
+ else
+ full_label_ = bformat(from_ascii("%1$s #: "), name);