Search in sources :

Example 1 with ParatextCharacterContentPart

use of biblemulticonverter.format.paratext.ParatextCharacterContent.ParatextCharacterContentPart in project BibleMultiConverter by schierlm.

the class AbstractParatextFormat method filterContents.

private void filterContents(List<ParatextCharacterContentPart> parts, EnumSet<KeepIf> partsToKeep) {
    for (int i = 0; i < parts.size(); i++) {
        ParatextCharacterContentPart part = parts.get(i);
        if (part instanceof AutoClosingFormatting) {
            KeepIf keepCondition = ((AutoClosingFormatting) part).getKind().getKeepIf();
            if (keepCondition != null && !partsToKeep.contains(keepCondition)) {
                parts.remove(i);
                i--;
                continue;
            }
        }
        if (part instanceof ParatextCharacterContentContainer) {
            filterContents(((ParatextCharacterContentContainer) part).getContent(), partsToKeep);
        }
    }
}
Also used : ParatextCharacterContentPart(biblemulticonverter.format.paratext.ParatextCharacterContent.ParatextCharacterContentPart) AutoClosingFormatting(biblemulticonverter.format.paratext.ParatextCharacterContent.AutoClosingFormatting) ParatextCharacterContentContainer(biblemulticonverter.format.paratext.ParatextBook.ParatextCharacterContentContainer) KeepIf(biblemulticonverter.format.paratext.ParatextCharacterContent.KeepIf)

Aggregations

ParatextCharacterContentContainer (biblemulticonverter.format.paratext.ParatextBook.ParatextCharacterContentContainer)1 AutoClosingFormatting (biblemulticonverter.format.paratext.ParatextCharacterContent.AutoClosingFormatting)1 KeepIf (biblemulticonverter.format.paratext.ParatextCharacterContent.KeepIf)1 ParatextCharacterContentPart (biblemulticonverter.format.paratext.ParatextCharacterContent.ParatextCharacterContentPart)1