Index: apps/markdownext/utils.py =================================================================== --- apps/markdownext/utils.py (rvision 223) +++ apps/markdownext/utils.py (copie de travail) @@ -8,7 +8,7 @@ self.images = images def to_html(self): - md = markdown.Markdown(['video']) + md = markdown.Markdown(['video', 'gallery']) for image in self.images: md.references[image.name] = (image.image.url, '') html = md.convert(self.text) Index: external_apps/mdx_gallery.py =================================================================== --- external_apps/mdx_gallery.py (rvision 0) +++ external_apps/mdx_gallery.py (rvision 0) @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +""" +Embeds web videos using URLs. For instance, if a URL to an youtube video is +found in the text submitted to markdown and it isn't enclosed in parenthesis +like a normal link in markdown, then the URL will be swapped with a embedded +youtube video. + +All resulting HTML is XHTML Strict compatible. + +""" + +import markdown +import xml +from django.template.loader import render_to_string +from xml.etree import ElementTree + +version = "0.1.0" + +class Gallery(markdown.Extension): + def __init__(self, configs): + self.config = { + } + + # Override defaults with user settings + for key, value in configs: + self.setConfig(key, value) + + def add_inline(self, md, name, klass, re): + pattern = klass(re) + pattern.md = md + pattern.ext = self + md.inlinePatterns.add(name, pattern, ".*)\]$') + +class GalleryImpl(markdown.inlinepatterns.Pattern): + def handleMatch(self, m): + params=eval("["+m.group('params')+"]", {}, {}) + images=[] + for param in params: + image={} + image["url"]=param + image["caption"]="captionnnnneeee" + images+=image + + gallery={} + gallery["name"]="Gallery name" + gallery["images"]=images + + data={} + data["gallery"]=gallery + + html=render_to_string("gallery/show_gallery.html", data) + print "\""+html+"\"" + return markdown.etree.ElementTree.fromstring(html) + +"""ret="(gallery("+str(len(images))+"):" + for image in images: + try: + ret+=MarkdownContent(image)+" " + #ret+=image+" " + except Exception as detail: + ret+="(error: "+detail+")" + ret+=")" + except Exception: + ret="{Gallery: Invalid Syntax}""" + +def makeExtension(configs=None) : + return Gallery(configs=configs) + +if __name__ == "__main__": + import doctest + doctest.testmod() Index: templates/gallery/show_gallery.html =================================================================== --- templates/gallery/show_gallery.html (rvision 0) +++ templates/gallery/show_gallery.html (rvision 0) @@ -0,0 +1,28 @@ +{% load i18n %} + \ No newline at end of file Index: templates/gallery/gallery.html =================================================================== --- templates/gallery/gallery.html (rvision 0) +++ templates/gallery/gallery.html (rvision 0) @@ -0,0 +1,35 @@ +{% extends "base.html" %} + +{% load i18n %} + +{% block content %} +

+ {% trans + {% trans "Screenshots" %}: {{ project.name }} +

+ +
+ +
+ {% if prev_screenshot %} + + {% trans + + {% endif %} + + {% if next_screenshot %} + + {% trans + + {% endif %} + {{ current_screenshot.caption }} ({{ screenshot_index }}/{{ screenshot_count }}) +
+ +{% trans "Go back to the project page" %} + +
+ {% trans +
+ +
+{% endblock %} Index: templates/gallery/no_pictures.html =================================================================== --- templates/gallery/no_pictures.html (rvision 0) +++ templates/gallery/no_pictures.html (rvision 0) @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% load i18n %} + +{% block content %} +

+ {% trans + {% trans "Screenshots" %}: {{ project.name }} +

+ +
+

{% trans "No screenshots are available for this project." %}

+ +{% trans "Go back to the project page" %} +
+{% endblock %} Index: templates/gallery/gallery_js.html =================================================================== --- templates/gallery/gallery_js.html (rvision 0) +++ templates/gallery/gallery_js.html (rvision 0) @@ -0,0 +1,79 @@ +{% load i18n %} + + + + Index: templates/contact/contact_portfolio.html =================================================================== --- templates/contact/contact_portfolio.html (rvision 229) +++ templates/contact/contact_portfolio.html (copie de travail) @@ -12,6 +12,8 @@ {% trans {% trans "Contact" %} + {% include "gallery/gallery_js.html" %} + {% with user.userprofile as profile%}