Hi all,

I'm Masakazu HAMAJI @ Japan, and It's my first post in this mailing
list. Sorry for my awesome English in advance.

I've encountered a strange slow rendering wiki page at Trac 0.11.2 and
I've found it came from the following unicode string..

It looks like '[<Japanese UTF-8 strings with no white space>]'. (Sorry
for non-Japanese people)

\u005B\u30B3\u30E2\u30F3\u30BB\u30EB\u3067\u3082\u5148\u982D
\u30B8\u30AA\u30E1\u30C8\u30EA\u30FC\u30EC\u30B3\u30FC\u30C9\u306F
\u7D76\u5BFE\u30E2\u30FC\u30C9\u3092\u4F7F\u7528\u3059\u308B
\u3088\u3046\u4FEE\u6B63\u005D

It seems that 'negative lookahead assertion' of regex makes it much
slower. That regex is changed at [4693] for unicode support.
I think it may be a problem of python, but I wonder we can use simpler
regex to detect CamelCase.

Below is my quick hack in my local copy. I haven't tested it very
much, but it will helps you to understand what I'm talking about

Index: trac/wiki/api.py
===================================================================
--- trac/wiki/api.py    (revision 346)
+++ trac/wiki/api.py    (working copy)
@@ -257,8 +257,8 @@

     def get_wiki_syntax(self):
         from trac.wiki.formatter import Formatter
-        lower = r'(?<![A-Z0-9_])' # No Upper case when looking behind
-        upper = r'(?<![a-z0-9_])' # No Lower case when looking behind
+        lower = r'(?<=[a-z])' # No Upper case when looking behind
+        upper = r'(?<=[A-Z])' # No Lower case when looking behind
         wiki_page_name = (
             r"\w%s(?:\w%s)+(?:\w%s(?:\w%s)*[\w/]%s)+" % # wiki words
             (upper, lower, upper, lower, lower) +


Thank you,

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to