From 3c561c29ba342dcffe0eb0add9f2e6dcdd0f59e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 19 Sep 2012 23:04:07 +0200 Subject: [PATCH] build pagelinks here build here, not via moin wrappers, as all links are absolute we can build proper links --- text_dokuwiki.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/text_dokuwiki.py b/text_dokuwiki.py index f72daf0..65d4b89 100644 --- a/text_dokuwiki.py +++ b/text_dokuwiki.py @@ -33,8 +33,6 @@ class Formatter(FormatterBase): self.list_depth = 0 self.list_type = ' ' - # dokuwiki namespace spearator, ':' or '/', see 'useslash' config - self.ns_sep = '/'; def _escape(self, text, extra_mapping={"'": "'", '"': """}): return saxutils.escape(text, extra_mapping) @@ -61,10 +59,10 @@ class Formatter(FormatterBase): return '' + markup + '' def pagelink(self, on, pagename='', page=None, **kw): - apply(FormatterBase.pagelink, (self, on, pagename, page), kw) - if page is None: - page = Page(self.request, pagename, formatter=self) - return page.link_to(self.request, on=on, **kw) + if on: + return '[[:' + ":".join(pagename.split("/")) + "|" + else: + return ']]' def interwikilink(self, on, interwiki='', pagename='', **kw): if on: @@ -73,7 +71,7 @@ class Formatter(FormatterBase): return ']]' def url(self, on, url='', css=None, **kw): - return ('[[%s|' % (self._escape(url)), ']]') [not on] + return ('[[%s|' % (self._escape(url)), ']]')[not on] def attachment_link(self, url, text, **kw): return '{{%s|%s}}' % (url, text)