From b2e7ffb5f2752db01a21a32e9afc4206669d63d3 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sat, 22 Nov 2008 23:15:52 -0500 Subject: Updated imagelinks extension for recent package refactor. --- markdown/extensions/imagelinks.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/markdown/extensions/imagelinks.py b/markdown/extensions/imagelinks.py index ba86d24..ee0b708 100644 --- a/markdown/extensions/imagelinks.py +++ b/markdown/extensions/imagelinks.py @@ -27,16 +27,16 @@ SLIDESHOW_LINK = """[slideshow]""" ALBUM_LINK = """ [%s]""" -class ImageLinksExtension (markdown.Extension): +class ImageLinksExtension(markdown.Extension): - def extendMarkdown(self, md, md_globals) : + def extendMarkdown(self, md, md_globals): md.preprocessors.add("imagelink", ImageLinkPreprocessor(md), "_begin") -class ImageLinkPreprocessor (markdown.Preprocessor): +class ImageLinkPreprocessor(markdown.preprocessors.Preprocessor): - def run(self, lines) : + def run(self, lines): url = url_manager.BlogEntryUrl(url_manager.BlogUrl("all"), "2006/08/29/the_rest_of_our") @@ -48,29 +48,29 @@ class ImageLinkPreprocessor (markdown.Preprocessor): new_lines = [] - for line in lines : + for line in lines: - if line.startswith("<~~~~~~~") : + if line.startswith("<~~~~~~~"): albums = [] rows = [] in_image_block = True - if not in_image_block : + if not in_image_block: new_lines.append(line) - else : + else: line = line.strip() - if line.endswith("~~~~~~>") or not line : + if line.endswith("~~~~~~>") or not line: in_image_block = False new_block = "

\n" album_url_hash = {} - for row in rows : - for photo_url, title in row : + for row in rows: + for photo_url, title in row: new_block += " " new_block += IMAGE_LINK % (photo_url, photo_url.get_thumbnail(), @@ -86,7 +86,7 @@ class ImageLinkPreprocessor (markdown.Preprocessor): album_urls = album_url_hash.keys() album_urls.sort() - if len(album_urls) == 1 : + if len(album_urls) == 1: new_block += ALBUM_LINK % (album_urls[0], "complete album") else : for i in range(len(album_urls)) : @@ -114,6 +114,6 @@ class ImageLinkPreprocessor (markdown.Preprocessor): return new_lines -def makeExtension(configs) : +def makeExtension(configs): return ImageLinksExtension(configs) -- cgit v1.2.3