Modify

Opened 8 years ago

Closed 6 years ago

Last modified 5 years ago

#5460 closed enhancement (fixed)

[Patch] Support for NumberedHeadlinesPlugin

Reported by: tiago@… Owned by: Ryan J Ollos
Priority: low Component: SectionEditPlugin
Severity: minor Keywords:
Cc: Martin Scharrer Trac Release: 0.11

Description (last modified by Ryan J Ollos)

When trying to edit a section delimited by the NumberedHeadlinesPlugin, an error such as the following is seen:

The section 1 that you chose could not find.

Not sure if it´s a consistent solution, however I hacked the re in line 99 of web_ui.py and seems to work fine here for both =* and #* headline syntax:

  • 0.11/tracsectionedit/web_ui.py

     
    9696                is_code_block = True
    9797            elif is_code_block == True and re.match(r'^\s*}}}\s*$', line):
    9898                is_code_block = False
    99             if is_code_block == False and re.match(r'^\s*(={1,5}) .+ \1(?:\s*#.+)?\s*$', line):
     99            if is_code_block == False and re.match(r'^\s*([=#]{1,5}) .+ \1(?:\s*#.+)?\s*$', line):
    100100                count = count + 1
    101101            if count < int(section):
    102102                pre.append(line)
     
    106106                break
    107107        post = page_list[i:]
    108108        if len(target) == 0:
    109             raise TracError(_('The section %(num)d that you chose could not find.', num=int(section)), _('Initialize Error'))
     109            raise TracError(_('The section %(num)d that you chose could not be found.', num=int(section)), _('Initialize Error'))
    110110
    111111        return pre, target, post

Thanks,

Attachments (0)

Change History (7)

comment:3 Changed 7 years ago by Ryan J Ollos

Summary: Support for NumberedHeadlinesPlugin[Patch] Support for NumberedHeadlinesPlugin

comment:4 Changed 6 years ago by Ryan J Ollos

Description: modified (diff)
Type: defectenhancement

I fixed up the patch in the description and tested it out. I'd like to see it applied to the repository if possible, it's a net 3 char change to the regex. I'm happy to go ahead and do this if its okay with the plugin maintainer (have global write access to the repository).

comment:5 in reply to:  4 Changed 6 years ago by Ryan J Ollos

Owner: changed from Catalin BALAN to Ryan J Ollos
Status: newassigned

Replying to rjollos:

I fixed up the patch in the description and tested it out. I'd like to see it applied to the repository if possible, it's a net 3 char change to the regex. I'm happy to go ahead and do this if its okay with the plugin maintainer (have global write access to the repository).

Since no response from the author after two weeks and its such a simple patch, I'm going to go ahead and apply it. We can always roll it back if the author has an objection.

comment:4 Changed 6 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

(In [9816]) Added support for the NumberedHeadlinesPlugin. Thanks to tiago for the patch. Fixes #5460.

comment:5 Changed 6 years ago by Ryan J Ollos

Cc: Martin Scharrer added; anonymous removed

comment:6 Changed 6 years ago by Ryan J Ollos

#6712 and #6946 closed as duplicates.

comment:7 Changed 5 years ago by Ryan J Ollos

#9302 is probably related.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.