Description
Links to grandparent pages don't work properly. In general every parent page beyond the first is not recognized properly. Thus relative links beyond the first parent are not possible.
Actually I don't know whether this is considered a feature. For someone who like nested structures which can be moved around easily it is certainly a bug. -- StefanMerten 2006-08-27 19:29:51
How much was this patch tested in a production wiki? -- ThomasWaldmann 2006-09-09 00:35:51
It is active in this Wiki. Or see an example for a couple of examples (which now work better than before). -- StefanMerten 2006-09-20 18:33:02
- Did you also test with the GUI editor?
Nope. -- StefanMerten 2006-11-11 16:36:42
- Did you also test with the GUI editor?
Steps to reproduce
Just put a link ../../ on a page three levels deep. It won't end up on the grandparent properly.
Example
Details
MoinMoin Version |
Any |
OS and Version |
|
Python Version |
|
Server Setup |
|
Server Details |
|
Language you are using the wiki in (set in the browser/UserPreferences) |
|
Workaround
The following two patches (against V1.5.4) allow for abritrary parent page steps:
*** MoinMoin/wikiutil.py.orig Sun Jun 25 14:17:29 2006 --- MoinMoin/wikiutil.py Sun Aug 27 21:07:03 2006 *************** *** 749,755 **** @return: the absolute page name """ if pagename.startswith(PARENT_PREFIX): ! pagename = '/'.join(filter(None, context.split('/')[:-1] + [pagename[PARENT_PREFIX_LEN:]])) elif pagename.startswith(CHILD_PREFIX): pagename = context + '/' + pagename[CHILD_PREFIX_LEN:] return pagename --- 749,758 ---- @return: the absolute page name """ if pagename.startswith(PARENT_PREFIX): ! while context and pagename.startswith(PARENT_PREFIX): ! context = '/'.join(context.split('/')[:-1]) ! pagename = pagename[PARENT_PREFIX_LEN:] ! pagename = '/'.join(filter(None, [ context, pagename, ])) elif pagename.startswith(CHILD_PREFIX): pagename = context + '/' + pagename[CHILD_PREFIX_LEN:] return pagename
*** MoinMoin/parser/wiki.py.orig Thu May 11 18:24:00 2006 --- MoinMoin/parser/wiki.py Sun Aug 27 21:08:09 2006 *************** *** 41,47 **** 'u': config.chars_upper, 'l': config.chars_lower, 'subpages': wikiutil.CHILD_PREFIX + '?', ! 'parent': ur'(?:%s)?' % re.escape(PARENT_PREFIX), } url_rule = ur'%(url_guard)s(%(url)s)\:([^\s\<%(punct)s]|([%(punct)s][^\s\<%(punct)s]))+' % { 'url_guard': u'(^|(?<!\w))', --- 41,47 ---- 'u': config.chars_upper, 'l': config.chars_lower, 'subpages': wikiutil.CHILD_PREFIX + '?', ! 'parent': ur'(?:%s)*' % re.escape(PARENT_PREFIX), } url_rule = ur'%(url_guard)s(%(url)s)\:([^\s\<%(punct)s]|([%(punct)s][^\s\<%(punct)s]))+' % { 'url_guard': u'(^|(?<!\w))', *************** *** 335,341 **** if word.startswith(wikiutil.PARENT_PREFIX): if not text: text = word ! word = '/'.join(filter(None, self.formatter.page.page_name.split('/')[:-1] + [word[wikiutil.PARENT_PREFIX_LEN:]])) if not text: # if a simple, self-referencing link, emit it as plain text --- 335,341 ---- if word.startswith(wikiutil.PARENT_PREFIX): if not text: text = word ! word = wikiutil.AbsPageName(self.request, self.formatter.page.page_name, word) if not text: # if a simple, self-referencing link, emit it as plain text
Discussion
Plan
- Priority:
- Assigned to:
- Status:
- wikiutil fixed in 1.7 branch
- wiki parser fixed in 1.7-newlinkmarkup branch
- fixes backported to 1.6