build pagelinks here

build here, not via moin wrappers, as all links are absolute we can build proper links
This commit is contained in:
Elan Ruusamäe 2012-09-19 23:04:07 +02:00
parent 51ed0143c6
commit 3c561c29ba

View file

@ -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 '<html>' + markup + '</html>'
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)