Show More
@@ -34,11 +34,20 b' class QuotePattern(Pattern):' | |||
|
34 | 34 | |
|
35 | 35 | class ReflinkPattern(Pattern): |
|
36 | 36 | def handleMatch(self, m): |
|
37 | ref_element = etree.Element('a') | |
|
38 | 37 | post_id = m.group(4) |
|
39 | ref_element.set('href', reverse(boards.views.jump_to_post, | |
|
40 | kwargs={'post_id': post_id})) | |
|
41 | ref_element.text = m.group(2) | |
|
38 | ||
|
39 | post = Post.objects.filter(id=post_id) | |
|
40 | if post: | |
|
41 | ref_element = etree.Element('a') | |
|
42 | ||
|
43 | if post.thread: | |
|
44 | link = reverse(thread, kwargs={'post_id': post.thread.id}) | |
|
45 | + '#' + post_id) | |
|
46 | else: | |
|
47 | link = reverse(thread, post_id=post_id) | |
|
48 | ||
|
49 | ref_element.set('href', link) | |
|
50 | ref_element.text = m.group(2) | |
|
42 | 51 | |
|
43 | 52 | return ref_element |
|
44 | 53 |
General Comments 0
You need to be logged in to leave comments.
Login now