[Moin-devel] CVS: MoinMoin/processor Colorize.py,NONE,1.1 __init__.py,NONE,1.1
J?rgen Hermann
jhermann at users.sourceforge.net
Sat Mar 16 12:33:22 EST 2002
Update of /cvsroot/moin/MoinMoin/processor
In directory usw-pr-cvs1:/tmp/cvs-serv29854/MoinMoin/processor
Added Files:
Colorize.py __init__.py
Log Message:
Processors added
--- NEW FILE: Colorize.py ---
"""
MoinMoin - Processor for Syntax Highlighting
Copyright (c) 2002 by Jürgen Hermann <jh at web.de>
All rights reserved, see COPYING for details.
$Id: Colorize.py,v 1.1 2002/03/16 20:31:37 jhermann Exp $
"""
import string, sys, cStringIO
from MoinMoin.parser import python
def process(formatter, lines):
if string.strip(lines[0]) == "#!python":
del lines[0]
# !!! same code as with "inline:" handling in parser/wiki.py,
# this needs to be unified!
buff = cStringIO.StringIO()
colorizer = python.Parser(string.join(lines, '\n'), out = buff)
colorizer.format(formatter, {})
sys.stdout.write(formatter.rawHTML(buff.getvalue()))
sys.stdout.write(formatter.preformatted(0))
--- NEW FILE: __init__.py ---
"""
MoinMoin - Processor Package
Copyright (c) 2002 by Jürgen Hermann <jh at web.de>
All rights reserved, see COPYING for details.
Processors need to define a process() function that gets
passed the current formatter and a list of lines to be
processed. A processor is allowed to manipulate that list,
since it is destroyed after processing.
Currently, when a processor is called, a preformatted
section is open. So you have to either close it immediately,
or after you emitted the output.
$Id: __init__.py,v 1.1 2002/03/16 20:31:37 jhermann Exp $
"""
from MoinMoin.util import getPackageModules
processors = getPackageModules(__file__)
del getPackageModules
More information about the Moin-devel
mailing list