changeset 502:f9845325cfcf

macro.Image: optional parameter clear added. This is for clearing the floating style.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 17 Feb 2010 15:52:17 +0100
parents 16aa5b518631
children 84e949d36271
files data/plugin/macro/Image.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/Image.py	Wed Feb 17 15:19:45 2010 +0100
+++ b/data/plugin/macro/Image.py	Wed Feb 17 15:52:17 2010 +0100
@@ -237,13 +237,15 @@
         return cache.url(request, key)
 
 
-def macro_Image(macro, itemname=wikiutil.required_arg(unicode), width=9999, height=9999, alt=u'', description=u''):
+def macro_Image(macro, itemname=wikiutil.required_arg(unicode), width=9999, height=9999, alt=u'', description=u'', clear=("none", "both", "left", "right")):
     """ Embed an Image into a wiki page.
 
         We use a very high default value for width and height, because PIL will calculate the
         image dimensions to not be larger than (width, height) and also not be larger than
         the original image. Thus, by not giving width or height, you'll get the original image,
         and if you specify width or height you will get an image of that width or that height.
+        
+        Optional you can set by the clear parameter how following text should be handled. 
 
         <<Image(PageName/attachname,width=100,alt="sample image")>>
     """
@@ -255,13 +257,17 @@
     img = Image(macro.request, itemname, caption=alt)
 
     div_width = ""
+    br_clear = ""
+    if clear != "none":
+       br_clear =  '<br style="clear:%s;">' % clear
     if width != 9999:
         div_width = '<div style="width:%spx">' % width
     return """<div class="thumbnail">%s<div class="decription">%s%s
-              <div class="show-datetime">%s</div></div></div>""" % (
+              <div class="show-datetime">%s</div></div></div>%s""" % (
                                      macro.formatter.image(src=img.url((width, height)), alt=img.caption),
                                      div_width,
                                      macro.formatter.text(description),
                                      macro.request.user.getFormattedDateTime(img.ctime),
+                                     br_clear
                                      )