[Koha-devel] in the Template for Cataloging HTML escaping title in the search results breaks search term highlighting

Galen Charlton galen.charlton at liblime.com
Tue Oct 14 21:04:35 CEST 2008


Hi,

On Tue, Oct 14, 2008 at 2:55 PM, Owen Leonard <oleonard at 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 at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt



More information about the Koha-devel mailing list