Modify

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#5460 closed enhancement (fixed)

[Patch] Support for NumberedHeadlinesPlugin

Reported by: tiago@… Owned by: rjollos
Priority: low Component: SectionEditPlugin
Severity: minor Keywords:
Cc: martin_s Trac Release: 0.11

Description (last modified by rjollos)

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 5 years ago by rjollos

  • Summary changed from Support for NumberedHeadlinesPlugin to [Patch] Support for NumberedHeadlinesPlugin

comment:4 follow-up: Changed 4 years ago by rjollos

  • Description modified (diff)
  • Type changed from defect to enhancement

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 4 years ago by rjollos

  • Owner changed from cbalan to rjollos
  • Status changed from new to assigned

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 follow-up: Changed 4 years ago by rjollos

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

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

comment:5 Changed 4 years ago by rjollos

  • Cc martin_s added; anonymous removed

comment:6 Changed 4 years ago by rjollos

#6712 and #6946 closed as duplicates.

comment:7 Changed 3 years ago by rjollos

#9302 is probably related.

Add Comment

Modify Ticket

Action
as closed The owner will remain rjollos.
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.