Jean-Marc Lasgouttes wrote:
I took a look at uses of _CODE and one of the first non-trivial uses I
found is:

int InsetPrintNomencl::docbook(odocstream & os, OutputParams const &) const
{
        os << "<glossary>\n";
        int newlines = 2;
        for (InsetIterator it = inset_iterator_begin(buffer().inset()); it;) {
                if (it->lyxCode() == NOMENCL_CODE) {
                        newlines += static_cast<InsetNomencl const &>(*it).docbo
okGlossary(os);
                        ++it;
                } else if(it->lyxCode() == NOTE_CODE &&
                          static_cast<InsetNote const &>(*it).params().type == I
nsetNoteParams::Note) {
                        // Don't output anything nested in note insets
                        size_t const depth = it.depth();
                        ++it;
                        while (it.depth() > depth)
                                ++it;
                } else {
                        ++it;
                }
        }
        os << "</glossary>\n";
        return newlines;
}

While it can be argued that testing NOMENCL_CODE makes sense, the test
for NOTE_CODE is plain stupid. There are other cases where code is not
output, like an inactive branch. And rather than adding a test for
BRANCH_CODE, it just looks like having a bool Inset::producesInput()
virtual method would help a lot.

Yes, you're undoubtedly correct. And I see you changed it already.

rh

Reply via email to