view data/plugin/parser/text_x_sort.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 5726458585d7
children 127da830be6c
line wrap: on
line source
#-*- coding: utf-8 -*-
""" 
sort to sort one level of input
===================================

This parser is used to sort text lines
    

Install
-------

remove the version number 
Put it in your wiki/data/plugin/parser/


Example
-------

{{{
#!sort
 * B
 * A
 * D
 * C
}}}
 

Result::

 * A
 * B
 * C
 * D
    

Legal
-----
@copyright 2005-2012 MoinMoin:ReimarBauer

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
"""

from MoinMoin.parser import text_moin_wiki as wiki

Dependencies = []


class Parser:

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


    def format(self, formatter):
        raw = self.raw.split('\n')
        raw.sort()

        wikiizer = wiki.Parser('\n'.join(raw), self.request)
        wikiizer.format(formatter)