##// END OF EJS Templates
Allow inserting text hints
neko259 -
r1662:64ac1a71 default
parent child Browse files
Show More
@@ -119,6 +119,15 class CodePattern(TextFormatter):
119 format_right = '[/code]'
119 format_right = '[/code]'
120
120
121
121
122 class HintPattern(TextFormatter):
123 name = 'hint'
124 preview_left = '<span class="hint">'
125 preview_right = '</span>'
126
127 format_left = '[hint]'
128 format_right = '[/hint]'
129
130
122 def render_reflink(tag_name, value, options, parent, context):
131 def render_reflink(tag_name, value, options, parent, context):
123 result = '>>%s' % value
132 result = '>>%s' % value
124
133
@@ -165,6 +174,15 def render_quote(tag_name, value, option
165 return result
174 return result
166
175
167
176
177 def render_hint(tag_name, value, options, parent, context):
178 if 'hint' in options:
179 hint = options['hint']
180 result = '<span class="hint" title="{}">{}</span>'.format(hint, value)
181 else:
182 result = value
183 return result
184
185
168 def render_notification(tag_name, value, options, parent, content):
186 def render_notification(tag_name, value, options, parent, content):
169 username = value.lower()
187 username = value.lower()
170
188
@@ -199,6 +217,7 formatters = [
199 CommentPattern,
217 CommentPattern,
200 StrikeThroughPattern,
218 StrikeThroughPattern,
201 CodePattern,
219 CodePattern,
220 HintPattern,
202 ]
221 ]
203
222
204
223
@@ -218,6 +237,7 class Parser:
218
237
219 self.parser.add_formatter('post', render_reflink, strip=True)
238 self.parser.add_formatter('post', render_reflink, strip=True)
220 self.parser.add_formatter('quote', render_quote, strip=True)
239 self.parser.add_formatter('quote', render_quote, strip=True)
240 self.parser.add_formatter('hint', render_hint, strip=True)
221 self.parser.add_formatter('user', render_notification, strip=True)
241 self.parser.add_formatter('user', render_notification, strip=True)
222 self.parser.add_formatter('tag', render_tag, strip=True)
242 self.parser.add_formatter('tag', render_tag, strip=True)
223 self.parser.add_formatter('spoiler', render_spoiler, strip=True)
243 self.parser.add_formatter('spoiler', render_spoiler, strip=True)
@@ -164,3 +164,7 textarea, input {
164 .required-field:before {
164 .required-field:before {
165 content: '* ';
165 content: '* ';
166 }
166 }
167
168 .hint {
169 border-bottom: dashed 1px;
170 }
General Comments 0
You need to be logged in to leave comments. Login now