Modify ↓
#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: |
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)
Note: See
TracTickets for help on using
tickets.



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