httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <>
Subject Re: mod_substitute docs
Date Tue, 12 Feb 2008 21:07:03 GMT

On Feb 11, 2008, at 10:15 AM, Rich Bowen wrote:

> On Oct 22, 2007, at 14:07, Jim Jagielski wrote:
>>> I'm a little concerned if the module ships /without/ the 'f'latten  
>>> flag
>>> triggered by default.  I'd rather the module offered the inverse  
>>> option.
>>> This is truly a 'bug' users won't understand (my text contains  
>>> 'jimfoojag',
>>> why isn't it translating to 'jimbarjag'?!?)
>> It would... it's only an issue really if there are subsequent
>> substitutions *and* a previous substitution would result in
>> a string that would also be affected by a latter one.
> Sorry to dredge up an ancient thread, but I'm finally using  
> mod_substitute in production, and I'm finding this to be much more  
> complex than the contrived example.
> Are there cases in which it might just happen to work without  
> flattening? And, if so, is it possible that it will work sometimes  
> and not other times, or is it going to be completely consistent from  
> one pass to the next?
> I've gotten some answers to these on IRC, so it may be that the  
> light is beginning to dawn.
> The actual example that I'm using is here :
> Slightly more complex than just s/foo/bar/
> The background is probably too stupid to go into - using TinyMCE to  
> edit content, and IE7 unwilling to honor align="left" in certain  
> contexts.

IN general, think of it this way. mod_substitute generally works on
content within a bucket. Say we have a bucket that contains the
text "Rich Bowen wants a pony dude" and we have the directive to
change 'pony' to 'puma'. Without flattening, mod_substitute turns
this single bucket into 3, the 1st containing "Rich Bowen wants a ",
the 2nd containing "puma" and the third containing " dude".

If there are no more substitutions, then  we're golden and can move on.
But NOW say that you also have another sub that wants to turn 'a puma'
into 'an aardvark'... Since it's operating on buckets, even though
the *stream* contains 'a pony', it's not in a single bucket, in
which case *this* substitution will never happen.

So if you have substituted content that you think will be re-substituted
by another rule, then you should flatten. If they are one-shots, or
self contained, or in "no way" could result in overlaps, then flattening
isn't required. :)

View raw message