Back to index

moin  1.9.0~rc2
text.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - Plain Text Parser, fallback for text/*
00004 
00005     @copyright: 2000-2002 Juergen Hermann <jh@web.de>
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 Dependencies = []
00010 
00011 class Parser:
00012     """
00013         Send plain text in a HTML <pre> element.
00014     """
00015 
00016     ## specify extensions willing to handle
00017     ## should be a list of extensions including the leading dot
00018     ## TODO: remove the leading dot from the extension. This is stupid.
00019     #extensions = ['.txt']
00020     ## use '*' instead of the list(!) to specify a default parser
00021     ## which is used as fallback
00022     extensions = '*'
00023     Dependencies = []
00024 
00025     def __init__(self, raw, request, **kw):
00026         self.raw = raw
00027         self.request = request
00028         self.form = request.form
00029         self._ = request.getText
00030 
00031     def format(self, formatter):
00032         """ Send the text. """
00033         self.request.write(formatter.preformatted(1))
00034         self.request.write(formatter.text(self.raw.expandtabs()))
00035         self.request.write(formatter.preformatted(0))