use of com.vladsch.flexmark.Extension in project flexmark-java by vsch.
the class Parser method removeExtensions.
/**
* Remove extension(s) of given class from the extension list
*
* @param options mutable options holding existing extensions
* @param extensions extension classes to remove
* @return mutable options
*/
public static MutableDataHolder removeExtensions(MutableDataHolder options, Class... extensions) {
Iterable<Extension> extensionIterable = options.get(Parser.EXTENSIONS);
HashSet<Extension> extensionList = new HashSet<Extension>();
for (Extension extension : extensionIterable) {
boolean keep = true;
for (Class clazz : extensions) {
if (clazz.isInstance(extension)) {
keep = false;
break;
}
}
if (keep) {
extensionList.add(extension);
}
}
options.set(Parser.EXTENSIONS, extensionList);
return options;
}
Aggregations