Modify

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#5 closed defect (fixed)

Skip over headers appearing in wiki-escaped blocks

Reported by: Steven N. Severinghaus <sns@…> Owned by: athomas
Priority: normal Component: TocMacro
Severity: minor Keywords: toc macro code example bug
Cc: sns@… Trac Release:

Description

For example, the header example on the WikiFormatting page confuses the parser. I have a fix but don't have any great way to communicate it. (I'd supply a diff, but I've already made some unrelated changes which would obscure the relevant changes.) Below is what the relevant portion of my version of TOC.py looks like:

def parse_toc(env, out, page, body):
    depth = 1
    in_example = False
    for line in body.splitlines():
        line = escape(line)

        # Skip over wiki-escaped code, e.g. code examples
        if in_example:
            if line == '}}}':
                in_example = False
            else:
                continue
        if line == '{{{':
            in_example = True
            continue

        # If we're not in an example block, check for list stuff
        match = rules.match(line)
        if match:

You'll recognize the top couple of lines and the bottom couple of lines, beyond which there were no changes. This bit of code fixes the problem on the WikiFormatting page's TOC without any obvious negative side-effects.

I hope this was an appropriate way of communicating the problem!

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by athomas

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

Resolved by [12].

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from athomas. Next status will be '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.