Description

The huge regex for word_rule causes a syntax error

Steps to reproduce

  1. Either switch to gui or open page in gui

Example

error.jpg error4.jpg

Component selection

Error is caused by the regex put into word_rule:

oFCKeditor.Config['WordRule'] = '\n        (?:\n           # require anything not upper/lower/slash before\n         |\n         ^  # ... or beginning of line\n        )\n        (?P<word_bang>\\!)?  # configurable: avoid getting CamelCase rendered as link\n        (?P<word_name>\n         (?:\n          (\\.\\.\\/)*  # there might be either ../ parent prefix(es)\n          |\n 

Note I didn't copy it all, just enough so we both know what I am talking about....

Details

Happens with IE6 and IE7 on this wiki and my wiki - 1.6.1.

Firefox seems also be unhappy with the regex.

Update: Testing firefox on linux client to apache on linux doesn't have the problem.

Workaround

Revert the regex generation code in .../MoinMoin/parser/text_moin_wiki.py to largely follow 1.53 (wiki.py)

word_rule = ur'(?:(?<![%(u)s%(l)s])|^)%(parent)s(?:%(subpages)s(?:[%(u)s][%(l)s]+){2,})+(?![%(u)s%(l)s]+)' % {
                'u': config.chars_upper,
                'l': config.chars_lower,
                'subpages': re.escape(CHILD_PREFIX),
                'parent': ur'(?:%s)?' % re.escape(PARENT_PREFIX),
            }

which seems to solve the problem. Don't know if it breaks something else.

Update: this breaks all interpretation of camelcase as links by the parser

Workaround 2:

One of our programmers found a fix. Note we don't do much JavaScript and we only tested against our in house browser - IE6 on WinXP. We have not tested all other functionality.

Fix to be applied to the javascript generation code in .../MoinMoin/parser/text_moin_wiki.py lines 77,78,90

change:

(?P<word_bang>\\!)
(?P<word_name>\n...)
(?P<word_anchor>\\S+)

to

(?=P<word_bang>\\!)
(?=P<word_name>\n...)
(?=P<word_anchor>\\S+)

Discussion

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/GuiEditorSyntaxError (last edited 2008-03-21 13:05:57 by ThomasWaldmann)