Mercurial > public > src > moin > extensions
diff data/plugin/parser/text_x_arnica.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 | cd6645e6841f |
children | 1e804e86b6f9 |
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py Sat Nov 08 16:28:11 2008 +0100 +++ b/data/plugin/parser/text_x_arnica.py Wed Nov 26 23:07:44 2008 +0100 @@ -286,6 +286,21 @@ from MoinMoin.parser.text_moin_wiki import Parser as WikiParser return wikiutil.renderText(self.request, WikiParser, text) + def get_image_alias(self): + """ gets the quotes from the item list and returns a dictionary of image and alias """ + # ToDo keep the order of the given quotes + quotes = self.raw.split('\n') + quotes = [quote.strip() for quote in quotes] + quotes = [quote[2:] for quote in quotes if quote.startswith('* ')] + image_alias = {} + counter = 0 + 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) + counter += 1 + return image_alias + def select_files(self, formatter): """ select files """ # we need to take the page_name from the formatter.page otherwise @@ -295,14 +310,7 @@ self.pagename = self.target_page path = AttachFile.getAttachDir(self.request, self.pagename, create=1) image_dict = {} - image_alias = {} - counter = 0 - for attfile in _get_files(self.request, self.pagename): - itemname = self.pagename + '/' + attfile - img = self.Image(self.request, itemname, raw=self.raw) - if img.description != attfile: - image_alias[attfile] = (img.description, counter) - counter += 1 + 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()