escaping wikinames, done

This commit is contained in:
Elan Ruusamäe 2012-06-20 01:10:32 +02:00
parent 7c6fe19324
commit dcb2be4d85
2 changed files with 23 additions and 2 deletions

View file

@ -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] * [file://servername/full/path/to/file/filename%20with%20spaces.txt Click here to read filename with spaces.txt]
* me@privacy.net * me@privacy.net
== Escaping WikiNames ==
{{{
Wiki''''''Name
Wiki``Name
}}}
Wiki''''''Name
Wiki``Name
= Bullet list = = Bullet list =
{{{ {{{
* item 1 * item 1

View file

@ -198,11 +198,23 @@ class Formatter(FormatterBase):
def image(self, src=None, **kw): def image(self, src=None, **kw):
valid_attrs = ['src', 'width', 'height', 'alt', 'title'] 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(): for key, value in kw.items():
if key in valid_attrs: if key in valid_attrs:
attrs[key] = value 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): def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1):
syntax = '' syntax = ''