aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2010-02-13 22:23:42 -0500
committerWaylan Limberg <waylan@gmail.com>2010-02-13 22:23:42 -0500
commitb96331c66b8421d10f9e040758c82badf97191b1 (patch)
treef530dd835b4c45ce8d800c5d6914ab0d845c5d1a
parentee6fb73b160721e666e72a0921135d6abae19fa4 (diff)
downloadmarkdown-b96331c66b8421d10f9e040758c82badf97191b1.tar.gz
markdown-b96331c66b8421d10f9e040758c82badf97191b1.tar.bz2
markdown-b96331c66b8421d10f9e040758c82badf97191b1.zip
Removed imagelinks extension. It never worked without some third party code that has never been shipped with Markdown anyway - and that code it not readily available. See list discussion for more info.
-rw-r--r--markdown/extensions/imagelinks.py119
1 files changed, 0 insertions, 119 deletions
diff --git a/markdown/extensions/imagelinks.py b/markdown/extensions/imagelinks.py
deleted file mode 100644
index ee0b708..0000000
--- a/markdown/extensions/imagelinks.py
+++ /dev/null
@@ -1,119 +0,0 @@
-"""
-========================= IMAGE LINKS =================================
-
-
-Turns paragraphs like
-
-<~~~~~~~~~~~~~~~~~~~~~~~~
-dir/subdir
-dir/subdir
-dir/subdir
-~~~~~~~~~~~~~~
-dir/subdir
-dir/subdir
-dir/subdir
-~~~~~~~~~~~~~~~~~~~>
-
-Into mini-photo galleries.
-
-"""
-
-import re, markdown
-import url_manager
-
-
-IMAGE_LINK = """<a href="%s"><img src="%s" title="%s"/></a>"""
-SLIDESHOW_LINK = """<a href="%s" target="_blank">[slideshow]</a>"""
-ALBUM_LINK = """&nbsp;<a href="%s">[%s]</a>"""
-
-
-class ImageLinksExtension(markdown.Extension):
-
- def extendMarkdown(self, md, md_globals):
-
- md.preprocessors.add("imagelink", ImageLinkPreprocessor(md), "_begin")
-
-
-class ImageLinkPreprocessor(markdown.preprocessors.Preprocessor):
-
- def run(self, lines):
-
- url = url_manager.BlogEntryUrl(url_manager.BlogUrl("all"),
- "2006/08/29/the_rest_of_our")
-
-
- all_images = []
- blocks = []
- in_image_block = False
-
- new_lines = []
-
- for line in lines:
-
- if line.startswith("<~~~~~~~"):
- albums = []
- rows = []
- in_image_block = True
-
- if not in_image_block:
-
- new_lines.append(line)
-
- else:
-
- line = line.strip()
-
- 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:
- new_block += "&nbsp;"
- new_block += IMAGE_LINK % (photo_url,
- photo_url.get_thumbnail(),
- title)
-
- album_url_hash[str(photo_url.get_album())] = 1
-
- new_block += "<br/>"
-
- new_block += "</span>"
- new_block += SLIDESHOW_LINK % url.get_slideshow()
-
- album_urls = album_url_hash.keys()
- album_urls.sort()
-
- if len(album_urls) == 1:
- new_block += ALBUM_LINK % (album_urls[0], "complete album")
- else :
- for i in range(len(album_urls)) :
- new_block += ALBUM_LINK % (album_urls[i],
- "album %d" % (i + 1) )
-
- new_lines.append(new_block + "</center><br/></div>")
-
- elif line[1:6] == "~~~~~" :
- rows.append([]) # start a new row
- else :
- parts = line.split()
- line = parts[0]
- title = " ".join(parts[1:])
-
- album, photo = line.split("/")
- photo_url = url.get_photo(album, photo,
- len(all_images)+1)
- all_images.append(photo_url)
- rows[-1].append((photo_url, title))
-
- if not album in albums :
- albums.append(album)
-
- return new_lines
-
-
-def makeExtension(configs):
- return ImageLinksExtension(configs)
-