Ticket #4356: trac_wiki_creole-r4428.patch
| File trac_wiki_creole-r4428.patch, 2.9 KB (added by cboos, 5 years ago) |
|---|
-
trac/wiki/formatter.py
152 152 153 153 BOLDITALIC_TOKEN = "'''''" 154 154 BOLD_TOKEN = "'''" 155 BOLD_TOKEN_WC = r"\*\*" 155 156 ITALIC_TOKEN = "''" 157 ITALIC_TOKEN_WC = "//" 156 158 UNDERLINE_TOKEN = "__" 157 159 STRIKE_TOKEN = "~~" 158 160 SUBSCRIPT_TOKEN = ",," … … 182 184 # Font styles 183 185 r"(?P<bolditalic>!?%s)" % BOLDITALIC_TOKEN, 184 186 r"(?P<bold>!?%s)" % BOLD_TOKEN, 187 r"(?P<bold_wc>!?%s)" % BOLD_TOKEN_WC, 185 188 r"(?P<italic>!?%s)" % ITALIC_TOKEN, 189 r"(?P<italic_wc>!?%s)" % ITALIC_TOKEN_WC, 186 190 r"(?P<underline>!?%s)" % UNDERLINE_TOKEN, 187 191 r"(?P<strike>!?%s)" % STRIKE_TOKEN, 188 192 r"(?P<subscript>!?%s)" % SUBSCRIPT_TOKEN, … … 199 203 r"(?P<citation>^(?P<cdepth>>(?: *>)*))", 200 204 # &, < and > to &, < and > 201 205 r"(?P<htmlescape>[&<>])", 206 # [[macro]] call 207 (r"(?P<macro>!?\[\[(?P<macroname>[\w/+-]+)" 208 r"(\]\]|\((?P<macroargs>.*?)\)\]\]))"), 202 209 # wiki:TracLinks 203 210 r"(?P<shref>!?((?P<sns>%s):(?P<stgt>%s|%s(?:%s*%s)?)))" \ 204 211 % (LINK_SCHEME, QUOTED_STRING, 205 212 SHREF_TARGET_FIRST, SHREF_TARGET_MIDDLE, SHREF_TARGET_LAST), 206 213 # [wiki:TracLinks with optional label] or [/relative label] 207 (r"(?P<lhref>!?\[ (?:"214 (r"(?P<lhref>!?\[\[?(?:" 208 215 r"(?P<rel>%s)|" % LHREF_RELATIVE_TARGET + # ./... or /... 209 r"(?P<lns>%s):(?P<ltgt>%s|[^\]\s ]*))" % \216 r"(?P<lns>%s):(?P<ltgt>%s|[^\]\s\|]*))" % \ 210 217 (LINK_SCHEME, QUOTED_STRING) + # wiki:TracLinks or wiki:"trac links" 211 r"(?:\s+(?P<label>%s|[^\]]+))?\])" % QUOTED_STRING), # optional label 212 # [[macro]] call 213 (r"(?P<macro>!?\[\[(?P<macroname>[\w/+-]+)" 214 r"(\]\]|\((?P<macroargs>.*?)\)\]\]))"), 218 r"(?:(?:\s+|\|)(?P<label>%s|[^\]]+))?\]\]?)" % QUOTED_STRING), # label 215 219 # == heading == #hanchor 216 220 r"(?P<heading>^\s*(?P<hdepth>=+)\s.*\s(?P=hdepth)\s*" 217 221 r"(?P<hanchor>#%s)?$)" % XML_NAME, … … 302 306 303 307 def _bold_formatter(self, match, fullmatch): 304 308 return self.simple_tag_handler(match, '<strong>', '</strong>') 309 # should be <b> 305 310 311 def _bold_wc_formatter(self, match, fullmatch): 312 return self.simple_tag_handler(match, '<b>', '</b>') 313 # should be <strong> 314 306 315 def _italic_formatter(self, match, fullmatch): 307 316 return self.simple_tag_handler(match, '<i>', '</i>') 308 317 318 def _italic_wc_formatter(self, match, fullmatch): 319 return self.simple_tag_handler(match, '<em>', '</em>') 320 309 321 def _underline_formatter(self, match, fullmatch): 310 322 return self.simple_tag_handler(match, '<span class="underline">', 311 323 '</span>')
