Modify

Opened 9 years ago

Closed 9 years ago

Last modified 5 years ago

#124 closed defect (fixed)

Link escape (!) in header is not removed

Reported by: anonymous Owned by: athomas
Priority: normal Component: TocMacro
Severity: normal Keywords:
Cc: Trac Release:

Description

Since WikiFormatting is now supported in headers, (some of) that needs to be
removed for the TOC. The specific example I ran into is when you have a header
such as '== The !SomeWeirdThing Parameter ==' - the ! is used to prevent the
linking, and hence is not displayed in the header, but it appears in the TOC.
Here is a simple patch to fix this:

--- TOC.py.orig 2006-01-06 03:45:53.000000000 -0800
+++ TOC.py      2006-01-11 20:39:26.000000000 -0800
@@ -7,6 +7,7 @@
 from trac.wiki.formatter import Formatter

 rules_re = re.compile(r"""(?P<heading>^\s*(?P<hdepth>=+)\s(?P<header>.*)\s(?P=hdepth)\s*$)""")
+fmt_esc_re = re.compile('!([A-Z][a-z]+[A-Z][a-z])')

 def parse_toc(env, out, page, body, max_depth=999, min_depth=1, title_index=False):
     current_depth = min_depth
@@ -35,6 +36,7 @@
         match = rules_re.match(line)
         if match:
             header = match.group('header')
+            header = fmt_esc_re.sub(r'\1', header);
             new_depth = len(match.group('hdepth'))
             if new_depth < min_depth:
                 continue

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by athomas

  • Resolution set to fixed
  • Status changed from new to closed

(In [319]) * Add format for header formatting introduced in Trac 0.9. Closes #124

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.