[html-formfu] HTMLScrubber filter
Charlie Garrison
garrison at zeta.org.au
Tue Jul 27 15:05:27 GMT 2010
Good morning,
On 14/07/10 at 7:53 PM +0100, Nigel Metheringham
<nigel.metheringham at dev.intechnology.co.uk> wrote:
>On 14 Jul 2010, at 15:27, Charlie Garrison wrote:
>
>> Did you get the rules attribute to work? I'm using YAML for
>>form configs and I can't get the correct list of hashes for
>>rules; I keep getting a hash of hashes. Or do I have something
>>wrong with my yaml config:
>
>This config appears to work correctly for me - lightly tested
>as yet, need to hammer it some more...
>
>filters:
>- type: HTMLScrubber
>allow:
>- p
>- em
>- strong
>- sup
>- ul
>- li
>- ol
>rules:
>- a:
>href: 1
>name: 1
>'*': 0
>- img:
>src: 1
>alt: 1
>'*': 0
>- '*':
>'*': 0
>
I still can't get that (or similar YAML) to produce the format
needed by HTMLScrubber.
My YAML is:
filter:
- TrimEdges
- type: HTMLScrubber
allow:
- 'p'
- 'span'
- 'strong'
- 'em'
- 'u'
- 'li'
- 'ul'
- 'ol'
- 'br'
default: 0
rules:
- p:
style: 0
class: 1
'*': 0
- span:
style: 1
class: 1
'*': 0
- '*':
'*': 0
comment: 0
script: 0
And I'm expecting a `rules` list like this (to match what
HTMLScrubber expects):
@rules = (
'p' => {
'style' => 0,
'class' => 1,
'*' => 0
},
'span' => {
'style' => 1,
'class' => 1,
'*' => 0
},
'*' => {
'*' => 0
}
);
But instead I'm getting a list of hashrefs:
@rules = (
{
'p' => {
'style' => 0,
'class' => 1,
'*' => 0
}
},
{
'span' => {
'style' => 1,
'class' => 1,
'*' => 0
}
},
{
'*' => {
'*' => 0
}
}
);
So is it possible to write YAML that will generate a suitable
(simple) list, or will I need to munge the `rules` list before
passing it to HTMLScrubber?
Charlie
--
Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠 http://www.ietf.org/rfc/rfc1855.txt
More information about the HTML-FormFu
mailing list