view data/plugin/parser/interwiki.py @ 625:f4e63b74b969

FormSubmit: adapt to werkzeug MultiDict
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 17:47:30 +0100
parents 854b5b2a059c
children 127da830be6c
line wrap: on
line source
 # -*- coding: iso-8859-1 -*-
"""
    MoinMoin - interwiki parser 
    renders urls from the definition of the InterWikiMap page
    
    @copyright: 2008-2011 by MoinMoin:ReimarBauer
    
    @license: GNU GPL, see COPYING for details.
    
"""

Dependencies = []

from MoinMoin.formatter.text_html import Formatter

class Parser:

    extensions = '*'
    Dependencies = []

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

    def format(self, formatter):
        html_formatter = Formatter(self.request)
        lines = self.raw.split('\n')
        result = []
        result.append(formatter.number_list(1))
        for line in sorted(lines):
            if line:
                wiki, url = line.split()
                result.append(formatter.listitem(1))
                result.append(formatter.url(1, url))
                result.append(wiki)
                result.append(formatter.url(0))
                result.append(formatter.listitem(0))
        result.append(formatter.number_list(0))
        self.request.write(''.join(result))