changeset 320:a9f7a24a567d

text_x_arnica: bug fix of the only_item list problem of multiple aliases for one image by skipping duplications.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 18 Dec 2008 13:46:08 +0100
parents daa964f86828
children c958b4dbfa4a
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Wed Dec 17 21:08:31 2008 +0100
+++ b/data/plugin/parser/text_x_arnica.py	Thu Dec 18 13:46:08 2008 +0100
@@ -217,7 +217,6 @@
         @param image: image as key for corresponding data
         @param selected_images: ordered list of selected images
         """
-        img = selected_images[0]
         title = ""
         if self.album:
             title = '<div class="title">%(n)d images (%(album_title)s)</div>' % {"n": len(self.arnica_image),
@@ -300,8 +299,10 @@
         for line in quotes:
             if line.startswith('[[') and line.endswith(']]'):
                 img, alias = line[2:-2].split('|', 1)
-                image_alias[img.strip()] = (self.formatter.text(alias.strip()), counter, img.strip())
-                counter += 1
+                # don't count an image more than once
+                if img.strip() not in image_alias.keys():
+                    image_alias[img.strip()] = (self.formatter.text(alias.strip()), counter, img)
+                    counter += 1
         return image_alias
 
     def select_files(self, formatter):
@@ -314,6 +315,7 @@
 
         image_alias = self.get_image_alias()
         if self.only_items:
+            # get the same order of files and aliastext as on the page written
             files = image_alias.keys()
             all_files = [fn for fn in files if wikiutil.isPicture(fn) and
                          AttachFile.exists(self.request, self.pagename, fn)]
@@ -364,6 +366,7 @@
         image_dict = {}
         if self.only_items:
             image_alias = self.get_image_alias()
+            image_names = image_alias.keys()
             alias_text = image_alias.values()
             to_order = [int(alias_text[ix][1]) for ix in range(len(alias_text))]
             names = [alias_text[ix][2] for ix in range(len(alias_text))]