[Filterproxy-devel] Re: (originally) new mozilla vulnerability
Brought to you by:
mcelrath
From: Bob M. <mce...@dr...> - 2002-06-27 15:10:22
|
Sean Maguire [ma...@mi...] wrote: > Hello again, >=20 > In response to your offer, pointers on matching stylesheet elements with = rewrite=20 > rules would be welcome. I have not yet figured out how to set up an appr= opriate=20 > XSLT stylesheet (while I am sure it would be a valuable skill, I have not= yet=20 > had any other need to deal with them), and have failed to have even the m= ost=20 > explicit matches work on the code example (tested with lynx using FilterP= roxy). >=20 > Since there is a fixed version of Mozilla out now, it is less of a concer= n.=20 > However, considering the potential for sneaking in unpleasant formatting = with=20 > stylesheets, I would like to be able to effectively rewrite those element= s also. Well the most straightforward thing to do would be to add a new keyword. Each Rewrite keyword (tag/tagblock/regex) is a function in FilterProxy/Rewrite.pm. The simplest similar function in this file to use as an example is probably "regex". These functions are passed: my($content_ref, $spec_ref, $start, $end) =3D @_; The first is a reference to the document. The second is a reference to the rule being used. I use the /\G/g construct to parse $spec_ref so that pos($$spec_ref) should point to the next keyword after your new keyword when your function is done. The $start and $end are the position of any existing match. You should use pos($$content_ref) =3D $end; and then m/\G/g to start searching where the last attempt left off. =20 This function should return 2 numbers, corresponding to the beginning and end of the matched substring. If none is found, it should return undef for both. > Great program that FilterProxy, btw. Thanks! BTW, did the regex rule I sent you in my last mail work? Cheers, -- Bob Bob McElrath (rsm...@st...)=20 Univ. of Wisconsin at Madison, Department of Physics |