view MoinMoin/parser/ @ 3077:66d35649ca99

add 'percent' kw to getText (must be True when using result as left side of % operator), refactored some code, better comments (ported from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 22 Feb 2008 22:35:46 +0100
parents 01f05e74aa9c
children ff39884957af
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - HTML Parser

    @copyright: 2006 MoinMoin:AlexanderSchremmer
    @license: GNU GPL, see COPYING for details.

from import Markup
from HTMLParser import HTMLParseError

Dependencies = []

class Parser:
        Sends HTML code after filtering it.

    extensions = ['.htm', '.html']
    Dependencies = Dependencies

    def __init__(self, raw, request, **kw):
        self.raw = raw
        self.request = request

    def format(self, formatter):
        """ Send the text. """
        except HTMLParseError, e:
            self.request.write(formatter.sysmsg(1) +
                formatter.text(u'HTML parsing error: %s in "%s"' % (e.msg,
                                  self.raw.splitlines()[e.lineno - 1].strip())) +