On Tue, 2008-10-14 at 15:04 -0400, Galen Charlton wrote:
Hi,
On Tue, Oct 14, 2008 at 2:55 PM, Owen Leonard <oleonard@myacpl.org> wrote:
That seems like a real solution. Anyone care to bring their superior skills to bear on this problem?
A suggestion - search term highlighting boils down to generating a list of words, some of which should be styled with the highlight and other that should not. Instead of having the code know about the CSS class to use for a given word and worry about HTML escaping, it could be changed to emit a template structure like this:
record_snippet => [ { word => 'normal' }, { word => 'highlighted', highlight => 1 }, { word => 'normal' } ]
that would be consumed like this:
<TMPL_LOOP NAME="record_snippet"> <TMPL_IF NAME="highlight"> <span class="highlight"><TMPL_VAR NAME="word" ESCAPE="HTML"></span> </TMPL_ELSE> <TMPL_VAR NAME="word" ESCAPE="HTML"> </TMPL_IF> </TMPL_LOOP>
I can toss together a patch for this.
Regards,
Galen
yeah, that was my original thought for a solution, but it seemed to complex to me. What you have done here is totally cool though. I think this is the way to go. Thanks.