From dcb2be4d85c41655b9b59580d90fc26dad3481af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= <glen@pld-linux.org> Date: Wed, 20 Jun 2012 01:10:32 +0200 Subject: [PATCH] escaping wikinames, done --- syntaxreference.txt | 9 +++++++++ text_dokuwiki.py | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/syntaxreference.txt b/syntaxreference.txt index 9501ff2..db0fe22 100644 --- a/syntaxreference.txt +++ b/syntaxreference.txt @@ -74,6 +74,15 @@ foo = new something(1, "soo\nice") * [file://servername/full/path/to/file/filename%20with%20spaces.txt Click here to read filename with spaces.txt] * me@privacy.net +== Escaping WikiNames == +{{{ +Wiki''''''Name +Wiki``Name +}}} +Wiki''''''Name +Wiki``Name + + = Bullet list = {{{ * item 1 diff --git a/text_dokuwiki.py b/text_dokuwiki.py index 382b102..fc35c5e 100644 --- a/text_dokuwiki.py +++ b/text_dokuwiki.py @@ -198,11 +198,23 @@ class Formatter(FormatterBase): def image(self, src=None, **kw): valid_attrs = ['src', 'width', 'height', 'alt', 'title'] - attrs = {'src': src} + + url = src + if '?' in url: + url += '&' + else: + url += '?' + + attrs = {} for key, value in kw.items(): if key in valid_attrs: attrs[key] = value - return apply(FormatterBase.image, (self,), attrs) + '</img>' + + # TODO: finish this + if attrs.has_key('width'): + url += attrs['width'] + + return '{{' + url + '}}' def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1): syntax = ''