|
a/views/result.tpl |
|
b/views/result.tpl |
1 |
%import shlex, unicodedata
|
1 |
%import shlex, unicodedata
|
2 |
%def strip_accents(s): return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn'))
|
|
|
3 |
<div class="search-result">
|
2 |
<div class="search-result">
|
4 |
%number = (query['page'] - 1)*config['perpage'] + i + 1
|
3 |
%number = (query['page'] - 1)*config['perpage'] + i + 1
|
5 |
<div class="search-result-number"><a href="#r{{d['sha']}}">#{{number}}</a></div>
|
4 |
<div class="search-result-number"><a href="#r{{d['sha']}}">#{{number}}</a></div>
|
6 |
%url = d['url'].replace('file://', '')
|
5 |
%url = d['url'].replace('file://', '')
|
7 |
%for dr, prefix in config['mounts'].items():
|
6 |
%for dr, prefix in config['mounts'].items():
|
|
... |
|
... |
26 |
<a href="/preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
|
25 |
<a href="/preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
|
27 |
<a href="/download/{{number-1}}?{{query_string}}">Download</a>
|
26 |
<a href="/download/{{number-1}}?{{query_string}}">Download</a>
|
28 |
</div>
|
27 |
</div>
|
29 |
%end
|
28 |
%end
|
30 |
<div class="search-result-date">{{d['time']}}</div>
|
29 |
<div class="search-result-date">{{d['time']}}</div>
|
31 |
%for q in shlex.split(query['query'].replace("'","\\'")):
|
|
|
32 |
%if not q == "OR":
|
|
|
33 |
% w = strip_accents(q.decode('utf-8').lower()).encode('utf-8')
|
|
|
34 |
% d['snippet'] = d['snippet'].replace(w,'<span class="search-result-highlight">'+w+'</span>')
|
|
|
35 |
%end
|
|
|
36 |
%end
|
|
|
37 |
<div class="search-result-snippet">{{!d['snippet']}}</div>
|
30 |
<div class="search-result-snippet">{{!d['snippet']}}</div>
|
38 |
</div>
|
31 |
</div>
|
39 |
<!-- vim: fdm=marker:tw=80:ts=4:sw=4:sts=4:et:ai
|
32 |
<!-- vim: fdm=marker:tw=80:ts=4:sw=4:sts=4:et:ai
|
40 |
-->
|
33 |
-->
|