diff data/plugin/macro/Image.py @ 299:1c25a98e3d9d

reverted changeset 269:1e3e876e38fb for Image and partly for text_x_arnica
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 26 Nov 2008 23:07:44 +0100
parents 03071c3569d8
children 91e4b1f42614
line wrap: on
line diff
--- a/data/plugin/macro/Image.py	Sat Nov 08 16:28:11 2008 +0100
+++ b/data/plugin/macro/Image.py	Wed Nov 26 23:07:44 2008 +0100
@@ -48,11 +48,9 @@
                  item_name, # PageName/AttachName for now, later this is just the item name
                  headline=None,
                  caption=None,
-                 raw=None,
         ):
         self.request = request
         self.pagename, self.attachname = item_name.rsplit('/', 1)
-        self.raw = raw
 
         # cached property values:
         self.__filename = None
@@ -63,25 +61,6 @@
         self.__ctime = None
         self.__headline = headline
         self.__caption = caption
-        self.__description = self.attachname
-
-    def _get_description(self):
-        if self.raw is None:
-            self.__description = self.attachname
-            return self.__description
-        else:
-            quotes = self.raw.split('\n')
-            quotes = [quote.strip() for quote in quotes]
-            quotes = [quote[2:] for quote in quotes if quote.startswith('* ')]
-            image_alias = self.attachname
-            for line in quotes:
-                if line.startswith('[[') and line.endswith(']]'):
-                    img, alias = line[2:-2].split('|', 1)
-                    if img.strip() == self.attachname:
-                        self.__description = alias.strip()
-                        break
-            return self.__description
-    description = property(_get_description)
 
     def _get_filename(self):
         if self.__filename is None:
@@ -265,16 +244,8 @@
 
         <<Image(PageName/attachname,width=100,alt="sample image")>>
     """
-    arnica_parser = wikiutil.importWikiPlugin(macro.request.cfg, "parser", "text_x_arnica", function="Parser")
     if '/' not in itemname:
         itemname = macro.formatter.page.page_name + '/' + itemname
-    raw = " * [[%s | %s]]\n" % (itemname.split('/')[1], (alt or (itemname.split('/')[1])))
-    img = Image(macro.request, itemname, caption=alt, raw=raw)
-    try:
-        exif_date = time.strftime("%Y-%m-%d %H:%M:%S", macro.request.user.getTime(img.exif["DateTimeOriginal"]))
-    except KeyError:
-        exif_date = '--'
-    # ToDo use alt attribute in arnica for one image instead of Slide Show title
-    ap = arnica_parser(raw, macro.request, image=img)
-    ap.arnica_image[img.attachname] = (img.url(), img.url(size=(width, height)), exif_date, img.description, "0")
-    return ap.render(macro.formatter)
+    img = Image(macro.request, itemname, caption=alt)
+    return macro.formatter.image(src=img.url((width, height)), alt=img.caption)
+