xing/wysihtml5 — pull request #166 by p3drosola (2012-07-25 10:24:50+00:00)
Title: Allow functions as check_attributes rules

This allows rules to be specified as functions, so you can easily add logic into the rules, without having to patch the wysihtml5 core.

for example this rule only allows the `color` attribute of a `h1` to be `green` if it's `id` is `main`.

"h1": {
"check_attributes": {
"color" : function(val, oldNode) {
if (val === 'green' && oldNode.id === 'main') return val;
}
},

The example is pretty silly, but it can be quite powerful.