Ticket #992: anchors.diff
| File anchors.diff, 846 bytes (added by trac-form@…, 7 years ago) |
|---|
-
WikiFormatter.py
old new 269 269 270 270 _compiled_rules = re.compile('(?:' + string.join(_rules, '|') + ')') 271 271 _processor_re = re.compile('#\!([a-zA-Z0-9/+-]+)') 272 _anchor_re = re.compile('[^A-Za-z0-9]+') 272 273 mime_type = "" 273 274 274 275 … … 362 363 self.close_paragraph() 363 364 self.close_indentation() 364 365 self.close_list() 365 self.out.write('<h%d>%s</h%d>' % (depth, match[depth + 1:len(match) - depth - 1], depth)) 366 heading = match[depth + 1:len(match) - depth - 1] 367 anchor = self._anchor_re.sub("", heading) 368 self.out.write('<a name="%s"><h%d>%s</h%d></a>' % (anchor, depth, heading, depth)) 366 369 return '' 367 370 368 371 def _svnimg_formatter(self, match, fullmatch):
