diff --git a/wiki/parser/BgPic.py b/wiki/parser/BgPic.py new file mode 100644 index 00000000..c89642ec --- /dev/null +++ b/wiki/parser/BgPic.py @@ -0,0 +1,79 @@ +# -*- coding: iso-8859-1 -*- +""" + .. + .... ............ ........ + . ....... . .... .. + . ... .. .. .. .. ..... . .. + .. .. ....@@@. .. . ........ . + .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. .... + .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... .... + @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. .. + .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. ..... + ...@@@.... @@@ .@@.......... ........ ..... .. + . ..@@@@.. . .@@@@. .. ....... . ............. + . .. .... .. .. . ... .... + . . .... ............. .. ... + .. .. ... ........ ... ... + ................................ + + MoinMoin - Block with bgpicture + + PURPOSE: + Un block avec une image en arrière-plan + + CALLING SEQUENCE: + {{{ + #!BgPic picture + blablabla + + tables, images.... + }}} + + Copyright 2009 © Antoine Durand-Gasselin + +""" + +import os,string,re,StringIO +from MoinMoin import wikiutil +from MoinMoin.action import AttachFile +from MoinMoin.parser.text_moin_wiki import Parser as WikiParser + +Dependencies = [] + +##################################################################### +# Parser : classe principale, c'est elle qui fait tout +####### +class Parser: + parsername = "BgPic" + Dependencies=Dependencies + + def __init__(self, raw, request, **kw): + self.request = request + self.pn = request.page.page_name + self.raw = raw + self.pic = kw["format_args"].strip() + + def format(self, formatter): + + content_buf = StringIO.StringIO() + self.request.redirect(content_buf) + WikiParser(self.raw, self.request).format(formatter) + content = content_buf.getvalue() + self.request.redirect() + + del content_buf + + html_fmt = ''' +
+%s +
+ ''' + + pic_url = AttachFile.getAttachUrl(self.pn, self.pic, self.request) + pic_url = wikiutil.escape(pic_url) + + html = formatter.rawHTML(html_fmt % (pic_url, content)) + self.request.write(html) + + +