Allow styling images
This commit is contained in:
parent
05e239b9ff
commit
ce9ec5e341
@ -110,10 +110,15 @@ roles['Ref'] = make_role_ref(True)
|
||||
|
||||
class RoleImage(Role):
|
||||
def render(self):
|
||||
image = self.content[:self.content.index(';')] if ';' in self.content else self.content
|
||||
style = self.content[self.content.index(';')+1:] if ';' in self.content else None
|
||||
|
||||
el = RoleElement('a')
|
||||
el.set('href', flask.url_for('image_about', name=self.content))
|
||||
el.set('href', flask.url_for('image_about', name=image))
|
||||
img = ET.SubElement(el, 'img')
|
||||
img.set('src', flask.url_for('image_view', name=self.content))
|
||||
img.set('src', flask.url_for('image_view', name=image))
|
||||
if style:
|
||||
img.set('style', style)
|
||||
return el
|
||||
|
||||
roles['image'] = RoleImage
|
||||
|
Reference in New Issue
Block a user