Description
When using the MonthCalendar macro there is no mouse over description of an subpage, when the page name contains an ampersand ("&").
Steps to reproduce
- Create a page containing an ampersand.
Edit the page and add <<MonthCalendar>> to use the macro.
- Store the page.
- Click on any date and create the page.
- Add a "h1" title like "= Test =".
- Store the test page.
Visit the page with the MonthCalendar macro again.
- Place the mouse pointer about the date.
On a calendar page without a "&" the mouse over text is shown.
Example
- See this wiki.
Component selection
- MoinMoin/macro/MonthCalendar.py
It looks like the "&" is not properly escaped
... <a class="cal-usedday" href="/testwiki/TestK%26/2010-04-01" onmouseout="untip()" onmouseover="tip('TestK&amp;/2010-04-01')">1</a></td>
The "&" is escaped twice.
Details
MoinMoin Version |
1.9.2 |
OS and Version |
SunOS sun 5.10 Generic_142901-09 i86pc i386 i86pc |
Python Version |
2.6.5 |
Server Setup |
Apache 2.2.15 |
Server Details |
mod_wsgi 3.2, mpm_prefork |
Language you are using the wiki in (set in the browser/UserPreferences) |
de |
- Browser: Firefox 3.6.3 on Linux
Workaround
Discussion
Bug exists in MoinMoin 1.9.3 .
- I looked at the code for some time. The problem seems to be that formatter.url escapes already escaped strings. So leaving out "wikiutil.escape" for the value that gets passed to formatter.url solves the problem.
- My first patch:
--- MonthCalendar.py.old Di Jun 29 00:41:03 2010 +++ MonthCalendar.py Do Nov 4 04:59:00 2010 @@ -361,12 +361,13 @@ title = match.group(1) title = wikiutil.escape(title).replace("'", "\\'") titletext.append(title) + tipname_unescaped = link.replace("'", "\\'") link = wikiutil.escape(link).replace("'", "\\'") tipname = link tiptitle = link tiptext = '<br>'.join(titletext) maketip_js.append("maketip('%s','%s','%s');" % (tipname, tiptitle, tiptext)) - attrs = {'onMouseOver': "tip('%s')" % tipname, + attrs = {'onMouseOver': "tip('%s')" % tipname_unescaped, 'onMouseOut': "untip()"} lowertip = tiptext.lower() if lowertip.find('open') >= 0:
Plan
- Priority:
- Assigned to:
Status: fixed by http://hg.moinmo.in/moin/1.9/rev/fa44b15b1ff1 - thanks for the patch!