[wiki-lenny/local/parser/Box.py] La boîte parse les lwikiliens

darcs-hash:20081109222007-bd074-9b163d2145ab36e6e9be69246acc821366ee41ad.gz
This commit is contained in:
Antoine Durand-Gasselin 2008-11-09 23:20:07 +01:00
parent dbcfa624dd
commit 7cf7940535

View file

@ -1,6 +1,22 @@
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Portail parser
..
.... ............ ........
. ....... . .... ..
. ... .. .. .. .. ..... . ..
.. .. ....@@@. .. . ........ .
.. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
.@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
@@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
.@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
...@@@.... @@@ .@@.......... ........ ..... ..
. ..@@@@.. . .@@@@. .. ....... . .............
. .. .... .. .. . ... ....
. . .... ............. .. ...
.. .. ... ........ ... ...
................................
MoinMoin - Box parser
PURPOSE:
une boite jolie
@ -13,13 +29,13 @@
tables, images....
}}}
Copyright 2008 Antoine Durand-Gasselin <adg@crans.org>
"""
from MoinMoin import config, wikiutil
from MoinMoin.macro import Macro
from MoinMoin.parser.text_creole import Emitter
from MoinMoin.parser._creole import Parser as CreoleParser
import os,string,re,StringIO
from MoinMoin import config, wikiutil
from MoinMoin.parser.text_moin_wiki import Parser as WikiParser
Dependencies = []
color_list = ['orange', 'black', 'red', 'green', 'blue', 'gray']
@ -65,12 +81,14 @@ class Parser:
try: color = self.settings['color']
except: color=None
# On crée l'arbre de syntaxe
content_tree = CreoleParser(self.raw).parse()
content_buf = StringIO.StringIO()
self.request.redirect(content_buf)
WikiParser(self.raw, self.request).format(formatter)
content = content_buf.getvalue()
self.request.redirect()
# On le formatte
fmt_content = Emitter(content_tree, formatter, self.request, Macro(self)).emit()
del content_buf
# On le fout dans une boîte
self.request.write(formatter.crans_box(title, fmt_content, color))
self.request.write(formatter.crans_box(title, content, color))