in the Template for Cataloging HTML escaping title in the search results breaks search term highlighting
I recall there being a couple patches, one to HTML escape the title in search results, and another to reverse that change on the catalog page. HTML escaping the title breaks search term highlighting. The cataloging page still suffers from this breakage. Perhaps these fields could be html escaped before the search term highlighting is applied? Thanks.
The cataloging page still suffers from this breakage.
I've just submitted a patch to correct that.
Perhaps these fields could be html escaped before the search term highlighting is applied?
That seems like a real solution. Anyone care to bring their superior skills to bear on this problem? -- Owen -- Web Developer Athens County Public Libraries http://www.myacpl.org
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 -- Galen Charlton VP, Research & Development, LibLime galen.charlton@liblime.com p: 1-888-564-2457 x709 skype: gmcharlt
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.
participants (3)
-
Galen Charlton -
Michael Hafen -
Owen Leonard