Opened 7 years ago

Closed 6 years ago

#5460 closed enhancement (fixed)

Reported by: Owned by: tiago@… rjollos low SectionEditPlugin minor martin_s 0.11

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

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

Thanks,

comment:3 Changed 7 years ago by rjollos

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

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

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

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: ↓ 5 Changed 6 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 6 years ago by rjollos

• Cc martin_s added; anonymous removed

comment:6 Changed 6 years ago by rjollos

#6712 and #6946 closed as duplicates.

comment:7 Changed 5 years ago by rjollos

#9302 is probably related.