aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-11-22 23:15:52 -0500
committerWaylan Limberg <waylan@gmail.com>2008-11-22 23:15:52 -0500
commitb2e7ffb5f2752db01a21a32e9afc4206669d63d3 (patch)
tree08ef626c7b77cca480ef4f820c693de9cdb4dc1c
parentbe7c1cf7b3367f5afbbe09f093ec96074bf468d5 (diff)
downloadmarkdown-b2e7ffb5f2752db01a21a32e9afc4206669d63d3.tar.gz
markdown-b2e7ffb5f2752db01a21a32e9afc4206669d63d3.tar.bz2
markdown-b2e7ffb5f2752db01a21a32e9afc4206669d63d3.zip
Updated imagelinks extension for recent package refactor.
-rw-r--r--markdown/extensions/imagelinks.py26
1 files 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 = """<a href="%s" target="_blank">[slideshow]</a>"""
ALBUM_LINK = """&nbsp;<a href="%s">[%s]</a>"""
-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 = "<div><br/><center><span class='image-links'>\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 += "&nbsp;"
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)