From: Robin B. <ro...@kn...> - 2001-10-21 17:09:25
|
On Sunday 21 October 2001 18:31, Bjoern Hoehrmann wrote: > CSS::SAC currently completly ignores unknown at-rules, applications > don't even get the data if it is stored in a block (this should be > changed, really). That was really a bug in the code, it wanted to report the entire ignored at-rule, but didn't. Thanks for noting this, the patch is already in CVS (should work this way, at least it does here). > What could be done to let applications add additional > parsing steps for unknown at-rules? For the moment, I let CSS::SAC call > > $sac->[_dh_]->ignorable_at_rule($at_rule => $data) > > i.e. the extracted block gets stored in $data in place of undef and gets > reported to the application, where happens additional parsing. There are several solutions. Right now, with the latest patch, the application gets the _text_ of the entire ignored @rule. This is the simplest approach, the app can do its own parsing (and use CSS::SAC's helpers for that). Otherwise, we need to add another API to register @rules which could be cumbersome, but could be a good idea. If you jump to lines around 395, you'll see that @rules are dispatched on their names. If it is an unknown @rule, what could be done would be to have a hash mapping @rule name (the name being the IDENT following the @) to a callback. The callback would get the name, full text, and the sac object. From there it ought to be able to parse the rule correctly using parse_rule and parse_selector_list, or any scheme of its own device. Feel free to patch in support for that, to add it to the TODO, or to describe what it is you want in greater detail so that I can add it myself. -- _______________________________________________________________________ Robin Berjon <ro...@kn...> -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com ----------------------------------------------------------------------- Immature poets imitate, mature poets steal. -- T.S. Eliot |