fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor fixes in picture publishing process.
[wolnelektury.git]
/
apps
/
search
/
templatetags
/
search_tags.py
diff --git
a/apps/search/templatetags/search_tags.py
b/apps/search/templatetags/search_tags.py
index
555edd2
..
8dbad9d
100644
(file)
--- a/
apps/search/templatetags/search_tags.py
+++ b/
apps/search/templatetags/search_tags.py
@@
-34,7
+34,7
@@
def book_searched(context, result):
hits = filter(lambda (idx, h):
result.snippets[idx] is not None
or 'fragment' in h, enumerate(result.hits))
hits = filter(lambda (idx, h):
result.snippets[idx] is not None
or 'fragment' in h, enumerate(result.hits))
- print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits))
+
#
print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits))
for (idx, hit) in hits:
# currently we generate one snipper per hit though.
for (idx, hit) in hits:
# currently we generate one snipper per hit though.
@@
-43,16
+43,13
@@
def book_searched(context, result):
snip = result.snippets[idx]
# fix some formattting
snip = re.subn(r"(^[ \t\n]+|[ \t\n]+$)", u"",
snip = result.snippets[idx]
# fix some formattting
snip = re.subn(r"(^[ \t\n]+|[ \t\n]+$)", u"",
- re.subn(r"[ \t\n]*\n[ \t\n]*", u"\n", snip)
)
+ re.subn(r"[ \t\n]*\n[ \t\n]*", u"\n", snip)
[0])[0]
snip = snip.replace("\n", "<br />").replace('---', '—')
hit['snippet'] = snip
return {
snip = snip.replace("\n", "<br />").replace('---', '—')
hit['snippet'] = snip
return {
- 're
lated': book.related_info()
,
+ 're
quest': context['request']
,
'book': book,
'book': book,
- 'main_link': book.get_absolute_url(),
- 'request': context.get('request'),
- 'hits': hits and zip(*hits)[1] or [],
- 'main_link': book.get_absolute_url(),
+ 'hits': hits and zip(*hits)[1] or []
}
}