#13524 closed enhancement (wontfix)
Exclude InterTrac ticket references
Reported by: | Marcel Gestewitz | Owned by: | lucid |
---|---|---|---|
Priority: | normal | Component: | PageTicketsMacro |
Severity: | normal | Keywords: | |
Cc: | clemens | Trac Release: |
Description
The useful PageTickets
macro should avoid to list also ticket numbers which are not intended to be a reference to a ticket.
On the one hand this can be InterTrac links to tickets of other TRAC repositories. Furthermore this may also be escaped references like #13523.
For me it works to adapt the regular expression to the following statement:
tickets_re = re.compile('(?:(?:^|(?:[\s,;.-]))(?:#|(?:ticket:|issue:|bug:)))(\d+)')
With this statement ticket references needs to be
- at the very beginning of the text
- preceded by a white space, dot, comma, semicolon, hyphen
In other cases keywords for ticket references are ignored.
Relation
This change may also be of interest for the MentionedTickets
plugin.
Attachments (0)
Change History (5)
comment:1 Changed 6 years ago by
Cc: | clemens added |
---|
comment:2 follow-up: 3 Changed 6 years ago by
Are all the (?: )
needed?
tickets_re = re.compile(""" (?: ^ # At the beginning of the text | # OR [\s,;.-] # After whitespace or punctuation ) (?: \# # # | # OR ticket: # ticket: | # OR issue: # issue: | # OR bug: # bug: ) (\d+) # Group 1: The ticket number """, re.VERBOSE)
comment:3 Changed 6 years ago by
Replying to anonymous:
Are all the
(?: )
needed?tickets_re = re.compile(""" (?: ^ # At the beginning of the text | # OR [\s,;.-] # After whitespace or punctuation ) (?: \# # # | # OR ticket: # ticket: | # OR issue: # issue: | # OR bug: # bug: ) (\d+) # Group 1: The ticket number """, re.VERBOSE)
Yes this is correct and an useful reduction of the regular expression.
I added the condition for beginning of text later, thus my statement was more complex than necessary.
I did not changed the latter part. In my opinion it is also not required to split \#
and the other ticket keywords. See ticket #12499. I did not know why this is the case.
Your regular expression works perfect for me.
comment:4 Changed 6 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Thanks for the suggestions. Unfortunately there's a problem: This excludes links of the form comment:2:ticket:13524. Subjectively I rate this breakage higher than the exclusion of intertrac links, so for now I close this as WONTFIX. Please reopen if there's a reasobaly simple solution to this obstacle.
Hello
We use a lot of InterTrac links and in my opinion it makes sense to exclude them from the
PageTickets
macro, because the underlyingTicketQuery
cannot resolve those external InterTrac links anyway.Ditto for the MentionedTicketsPlugin.
Clemens