Opened 17 years ago

Closed 17 years ago

Last modified 14 years ago

#124 closed defect (fixed)

Link escape (!) in header is not removed

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


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:

--- 2006-01-06 03:45:53.000000000 -0800
+++      2006-01-11 20:39:26.000000000 -0800
@@ -7,6 +7,7 @@
 from 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 ='header')
+            header = fmt_esc_re.sub(r'\1', header);
             new_depth = len('hdepth'))
             if new_depth < min_depth:

Attachments (0)

Change History (1)

comment:1 Changed 17 years ago by Alec Thomas

Resolution: fixed
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

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

Note: See TracTickets for help on using tickets.