comparison MoinMoin/formatter/text_gedit.py @ 1704:fe19c9ac4b82

text_gedit: Feature scalable images for gui added
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 06 Jan 2007 15:27:29 +0100
parents 55761640667a
children a31498666626
comparison
equal deleted inserted replaced
1703:0803e5da055d 1704:fe19c9ac4b82
1 # -*- coding: iso-8859-1 -*- 1 # -*- coding: iso-8859-1 -*-
2 """ 2 """
3 MoinMoin - "text/html+css" Formatter for feeding the GUI editor 3 MoinMoin - "text/html+css" Formatter for feeding the GUI editor
4 4
5 @copyright: (c) Bastian Blank, Florian Festi, Thomas Waldmann 5 @copyright: (c) Bastian Blank, Florian Festi, Thomas Waldmann, Reimar Bauer
6 @license: GNU GPL, see COPYING for details. 6 @license: GNU GPL, see COPYING for details.
7 """ 7 """
8 8
9 from MoinMoin.formatter import FormatterBase, text_html 9 from MoinMoin.formatter import FormatterBase, text_html
10 from MoinMoin import wikiutil, config 10 from MoinMoin import wikiutil, config
91 return '<span style="background-color:#ffff11">!</span>' + self.text(text) 91 return '<span style="background-color:#ffff11">!</span>' + self.text(text)
92 92
93 # Dynamic stuff / Plugins ############################################ 93 # Dynamic stuff / Plugins ############################################
94 94
95 def macro(self, macro_obj, name, args): 95 def macro(self, macro_obj, name, args):
96 if args is not None: 96 #use ImageLink for resized images
97 if name == "ImageLink" and args is not None:
98 pagename = self.page.page_name
99 if args:
100 args = args.split(',')
101 args = [arg.strip() for arg in args]
102 else:
103 args = []
104 argc = len(args)
105 url = args[0]
106 keywords = {}
107 width = None
108 height = None
109 alt = None
110 for arg in args:
111 if arg.find('=') > -1:
112 key, value = arg.split('=')
113 if key == 'width':
114 width = value
115 if key == 'height':
116 height = value
117 if key == 'alt':
118 alt = value
119 target = None
120 if argc >= 2 and args[1]:
121 target = args[1]
122
123 return self.image(
124 title="attachment:%s" % wikiutil.quoteWikinameURL(url),
125 src=AttachFile.getAttachUrl(pagename, url, self.request, addts=1), width=width, height=height, alt=alt, target=target)
126
127 elif args is not None:
97 result = "[[%s(%s)]]" % (name, args) 128 result = "[[%s(%s)]]" % (name, args)
98 else: 129 else:
99 result = "[[%s]]" % name 130 result = "[[%s]]" % name
100 return '<span style="background-color:#ffff11">%s</span>' % result 131 return '<span style="background-color:#ffff11">%s</span>' % result
101 132