##// END OF EJS Templates
Add a bbcode tag to render tag link
neko259 -
r1202:96809673 default
parent child Browse files
Show More
@@ -160,6 +160,17 b' def render_notification(tag_name, value,'
160 reverse('notifications', kwargs={'username': username}), username)
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 formatters = [
174 formatters = [
164 QuotePattern,
175 QuotePattern,
165 SpoilerPattern,
176 SpoilerPattern,
@@ -188,6 +199,7 b' class Parser:'
188 self.parser.add_formatter('post', render_reflink, strip=True)
199 self.parser.add_formatter('post', render_reflink, strip=True)
189 self.parser.add_formatter('quote', render_quote, strip=True)
200 self.parser.add_formatter('quote', render_quote, strip=True)
190 self.parser.add_formatter('user', render_notification, strip=True)
201 self.parser.add_formatter('user', render_notification, strip=True)
202 self.parser.add_formatter('tag', render_tag, strip=True)
191 self.parser.add_simple_formatter(
203 self.parser.add_simple_formatter(
192 'comment', '<span class="comment">//%(value)s</span>')
204 'comment', '<span class="comment">//%(value)s</span>')
193 self.parser.add_simple_formatter(
205 self.parser.add_simple_formatter(
General Comments 0
You need to be logged in to leave comments. Login now