|
a/views/result.tpl |
|
b/views/result.tpl |
1 |
%import shlex, unicodedata, os
|
1 |
%import shlex, unicodedata, os
|
2 |
<div class="search-result">
|
2 |
<div class="search-result">
|
3 |
%number = (query['page'] - 1)*config['perpage'] + i + 1
|
3 |
%number = (query['page'] - 1)*config['perpage'] + i + 1
|
4 |
<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>
|
5 |
%url = d['url'].replace('file://', '')
|
5 |
%url = d['url'].replace(b'file://', b'')
|
6 |
%for dr, prefix in config['mounts'].items():
|
6 |
%for dr, prefix in config['mounts'].items():
|
7 |
%url = url.replace(dr, prefix)
|
7 |
%url = url.replace(dr.encode('utf-8'), prefix.encode('utf-8'))
|
8 |
%end
|
8 |
%end
|
9 |
<div class="search-result-title" id="r{{d['sha']}}" title="{{d['abstract']}}">
|
9 |
<div class="search-result-title" id="r{{d['sha']}}" title="{{d['abstract']}}">
|
10 |
%if config.has_key('title_link') and config['title_link'] != 'download':
|
10 |
%if 'title_link' in config and config['title_link'] != 'download':
|
11 |
%if config['title_link'] == 'open':
|
11 |
%if config['title_link'] == 'open':
|
12 |
<a href="{{url}}">{{d['label']}}</a>
|
12 |
<a href="{{url}}">{{d['label']}}</a>
|
13 |
%elif config['title_link'] == 'preview':
|
13 |
%elif config['title_link'] == 'preview':
|
14 |
<a href="preview/{{number-1}}?{{query_string}}">{{d['label']}}</a>
|
14 |
<a href="preview/{{number-1}}?{{query_string}}">{{d['label']}}</a>
|
15 |
%end
|
15 |
%end
|
|
... |
|
... |
18 |
%end
|
18 |
%end
|
19 |
</div>
|
19 |
</div>
|
20 |
%if len(d['ipath']) > 0:
|
20 |
%if len(d['ipath']) > 0:
|
21 |
<div class="search-result-ipath">[{{d['ipath']}}]</div>
|
21 |
<div class="search-result-ipath">[{{d['ipath']}}]</div>
|
22 |
%end
|
22 |
%end
|
23 |
%if d.has_key('author') and len(d['author']) > 0:
|
23 |
%if 'author' in d and len(d['author']) > 0:
|
24 |
<div class="search-result-author">{{d['author']}}</div>
|
24 |
<div class="search-result-author">{{d['author']}}</div>
|
25 |
%end
|
25 |
%end
|
26 |
<div class="search-result-url">
|
26 |
<div class="search-result-url">
|
27 |
%urllabel = os.path.dirname(d['url'].replace('file://', ''))
|
27 |
%urllabel = os.path.dirname(d['url'].replace(b'file://', b''))
|
28 |
%for r in config['dirs']:
|
28 |
%for r in config['dirs']:
|
29 |
%urllabel = urllabel.replace(r.rsplit('/',1)[0] + '/' , '')
|
29 |
%urllabel = urllabel.replace(r.encode('utf-8').rsplit(b'/',1)[0] + b'/' , b'')
|
30 |
%end
|
30 |
%end
|
31 |
<a href="{{os.path.dirname(url)}}">{{urllabel}}</a>
|
31 |
<a href="{{os.path.dirname(url)}}">{{urllabel}}</a>
|
32 |
</div>
|
32 |
</div>
|
33 |
<div class="search-result-links">
|
33 |
<div class="search-result-links">
|
34 |
<a href="{{url}}">Open</a>
|
34 |
<a href="{{url}}">Open</a>
|