-docstring expandLabel(Buffer const & buf,
- LyXLayout_ptr const & layout, bool appendix)
-{
- LyXTextClass const & tclass = buf.params().getLyXTextClass();
-
- docstring fmt = buf.B_(appendix ? layout->labelstring_appendix()
- : layout->labelstring());
-
- // handle 'inherited level parts' in 'fmt',
- // i.e. the stuff between '@' in '@Section@.\arabic{subsection}'
- size_t const i = fmt.find('@', 0);
- if (i != docstring::npos) {
- size_t const j = fmt.find('@', i + 1);
- if (j != docstring::npos) {
- docstring parent(fmt, i + 1, j - i - 1);
- // FIXME UNICODE
- docstring label = expandLabel(buf, tclass[lyx::to_utf8(parent)], appendix);
- fmt = docstring(fmt, 0, i) + label + docstring(fmt, j + 1, docstring::npos);
- }
- }
-
- return tclass.counters().counterLabel(fmt);
-}