Hi,
On 2024/08/08 1:11, Clemens Feige wrote:
> Hello
>
> I suspect there is a regression with the popular WikiExtrasPlugin, see
> [1]. After upgrading from TRAC 1.4 to 1.6 the handling delimiters
> adjacent to a phrase seems affected.
>
> Here is a quote of what WikiExtrasPlugin advertises, and what is
> accomplished in code with method `add_style` in file `phrases.py`; see [2]:
>
>> Any delimiter ():<> adjacent to a phrase will not be presented. This makes
>> it possible to naturally write FIXME:, for example, but view the phrase
>> highlighted without the colon (:) which would not look natural.
>
> However, in TRAC 1.6 for a phrase like FIXME: the colon is not removed,
> but it should be. For dual colons i.e. :FIXME: both colons are removed,
> which is correct.
> TRAC 1.4, all colons in FIXME: and in :FIXME: are removed.
>
> If you are using the WikiExtrasPlugin and the new TRAC 1.6, then please
> tell me: What comes out if you write a phrase with trailing adjacent
> delimiter i.e. "FIXME:"?
>
> Anybody who can comment on this?
> Depending on other people's feedback I would file a bug ticket.
>
> Unfortunately I do not understand the code in method `add_style` in file
> `phrases.py`; see [2]. What is `self.text` for example?
>
> Thanks
> Clemens
>
>
> P.S.
>
> [1]
> https://trac-hacks.org/wiki/WikiExtrasPlugin
>
> [2]
> https://trac-hacks.org/browser/wikiextrasplugin/trunk/tracwikiextras/phrases.py?rev=16718#L90
>
That is caused by the generated regular expression from the plugin.
The longer symbols in (...|...|...) of the regular expression should
come first.
Please try the following patch:
[[[
Index: tracwikiextras/util.py
===================================================================
--- tracwikiextras/util.py (revision 18650)
+++ tracwikiextras/util.py (working copy)
@@ -35,7 +35,7 @@
unicode = str
def prepare_regexp(d):
- syms = sorted(d.keys(), key=lambda a: len(a))
+ syms = sorted(d.keys(), key=lambda a: len(a), reverse=True)
return "|".join([r'%s%s%s'
% (r'\b' if re.match(r'\w', s[0]) else '',
re.escape(s),
]]]
--
Jun Omae <[email protected]> (大前 潤)
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/trac-users/b77005b7-24bd-466e-9469-979eb5039464%40gmail.com.