3 Defining custom whitelists - Reference Documentation
Authors: Sudhir Nimavat
Version: 0.1
3 Defining custom whitelists
Plugin provides a DSL to define custom whitelists in configuration.Define a custom whitelist sample that will allow just <b>,<i>,<p> and <span> tags.Config.groovyhtmlcleaner { whitelists = { whitelist("sample") { startwith "none" allow "b", "p", "i", "span" } } }
htmlcleaner { whitelists = { whitelist("sample2") { startwith "sample" allow("a") { attributes "href" enforce attribute:"rel", value:"nofollow" } } } }
htmlcleaner { whitelists = { whitelist("basic-with-tables") { startwith "basic" allow "table", "tr", "td" } } }
htmlcleaner { whitelists = { whitelist("sample") { allow("div") { attributes "id", "class" } } } }
htmlcleaner { whitelists = { whitelist("sample") { allow("div") { enforce attribute:"class", value:"block" } } } }
htmlcleaner { whitelists = { whitelist("sample") { startwith "none" allow "b", "p", "span" } whitelist("sample-with-anchor") { startwith "sample" allow("a") { attributes "href" enforce attribute:"rel", value:"nofollow" } } whitelist("basic-with-tables") { startwith "basic" allow "table", "tr", "td" } } }