Skip to content

Filtering Rework: Mark Elements As Excluded

Jarno Elovirta edited this page Aug 31, 2021 · 3 revisions

(Capturing my analysis of the current filtering code so I don't forget it)

Looking at the ProfilingFilter, used from the DitaWriter as configured by the DebugAndFilter module, it looks like the relevant code is at about line 81:

if (exclude) {
    // If it is the start of a child of an excluded tag, level increase
    level++;
} else { // exclude shows whether it's excluded by filtering
    if (foreignLevel <= 1 && filterUtils.needExclude(atts, props)) {
        exclude = true;
        level = 0;
    } else {
        elementOutput = true;
        getContentHandler().startElement(uri, localName, qName, atts);
    }
}

The change would be simply add a dita-ot:exclude='yes' attribute to each element when exclude == true, but then apply the normal startElement() processing.

Clone this wiki locally