%import shlex, unicodedata %def strip_accents(s): return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn')) %include header title=" - " + query['keywords']+" ("+str(len(res))+")" %include search query=query, dirs=dirs, sorts=sorts
Found {{len(res)}} matching: {{qs}} ({{time.seconds}}.{{time.microseconds/10000}}s)
%if len(res) > 0:
JSON CSV
%end
%for i in range(0, len(res)): %d = res[i]
%if len(d['ipath']) > 0:
[{{d['ipath']}}]
%end %if len(d['author']) > 0:
{{d['author']}}
%end
{{d['time']}}
%for q in shlex.split(query['keywords'].replace("'","\\'")): %if not q == "OR": % w = strip_accents(q.decode('utf-8').lower()).encode('utf-8') % d['snippet'] = d['snippet'].replace(w,''+w+'') %end %end
{{!d['snippet']}}
%end
%include footer