Martin Vermeer <[EMAIL PROTECTED]> writes:

> Sorry... I don't understand this. What do you mean? What
> code does this require?

Something like that (untested)

InsetLayout const & TextClass::insetlayout(docstring const & name) const 
{
        docstring n = name;
        while (!n.empty()) {
                if (insetlayoutlist_.count(n) > 0)
                        return insetlayoutlist_[n];
                docstring::size_type i = n.rfind(':');
                if (i != string::npos) // delimiter was found
                        n = n.substr(0, i);
                else
                        break;
        }
        static const InsetLayout empty;
        return empty;
}

Assuming that you ask for "charstyle:author", which does not exist,
the code will next try to find an entry for "charstyle" (by removing
the last part), which could be set to

InsetLayout charstyle
        LabelString           "Error!"
        LatexType             command
        LatexName             ""
        LabelFont
          Color               Red
        EndFont
End

This gives us for free the handling of unknown charstyles.

Is it clearer now?

JMarc

Reply via email to