Show More
@@ -160,6 +160,17 b' def render_notification(tag_name, value,' | |||
|
160 | 160 | reverse('notifications', kwargs={'username': username}), username) |
|
161 | 161 | |
|
162 | 162 | |
|
163 | def render_tag(tag_name, value, options, parent, context): | |
|
164 | tag_name = value.lower() | |
|
165 | ||
|
166 | try: | |
|
167 | url = boards.models.Tag.objects.get(name=tag_name).get_view() | |
|
168 | except ObjectDoesNotExist: | |
|
169 | url = tag_name | |
|
170 | ||
|
171 | return url | |
|
172 | ||
|
173 | ||
|
163 | 174 | formatters = [ |
|
164 | 175 | QuotePattern, |
|
165 | 176 | SpoilerPattern, |
@@ -188,6 +199,7 b' class Parser:' | |||
|
188 | 199 | self.parser.add_formatter('post', render_reflink, strip=True) |
|
189 | 200 | self.parser.add_formatter('quote', render_quote, strip=True) |
|
190 | 201 | self.parser.add_formatter('user', render_notification, strip=True) |
|
202 | self.parser.add_formatter('tag', render_tag, strip=True) | |
|
191 | 203 | self.parser.add_simple_formatter( |
|
192 | 204 | 'comment', '<span class="comment">//%(value)s</span>') |
|
193 | 205 | self.parser.add_simple_formatter( |
General Comments 0
You need to be logged in to leave comments.
Login now