~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/parser/text.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: iso-8859-1 -*-
 
2
"""
 
3
    MoinMoin - Plain Text Parser, fallback for text/*
 
4
 
 
5
    @copyright: 2000-2002 Juergen Hermann <jh@web.de>
 
6
    @license: GNU GPL, see COPYING for details.
 
7
"""
 
8
 
 
9
Dependencies = []
 
10
 
 
11
class Parser:
 
12
    """
 
13
        Send plain text in a HTML <pre> element.
 
14
    """
 
15
 
 
16
    ## specify extensions willing to handle
 
17
    ## should be a list of extensions including the leading dot
 
18
    ## TODO: remove the leading dot from the extension. This is stupid.
 
19
    #extensions = ['.txt']
 
20
    ## use '*' instead of the list(!) to specify a default parser
 
21
    ## which is used as fallback
 
22
    extensions = '*'
 
23
    Dependencies = []
 
24
 
 
25
    def __init__(self, raw, request, **kw):
 
26
        self.raw = raw
 
27
        self.request = request
 
28
        self.form = request.form
 
29
        self._ = request.getText
 
30
 
 
31
    def format(self, formatter):
 
32
        """ Send the text. """
 
33
        self.request.write(formatter.preformatted(1))
 
34
        self.request.write(formatter.text(self.raw.expandtabs()))
 
35
        self.request.write(formatter.preformatted(0))