view data/plugin/macro/ @ 124:a95e17b99d2c

arnica: added the div class arnica to the macro
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 28 Jun 2008 13:55:21 +0200
parents 564e8ffe3d4b
children ed4b7f8ea143
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - arnica

    This macro is used to call the parser arnica,
    it is just a thin wrapper around it.

    based on Gallery2/gallery2image by ReimarBauer 2005-2008

    @copyright: 2008 by MoinMoin:ReimarBauer
    @license: GNU GPL, see COPYING for details.
from MoinMoin import wikiutil

class arnica:
    def __init__(self, macro, args):
        self.macro = macro
        self.formatter = macro.formatter
        self.args = args

    def renderInPage(self):
        arnica_parser = wikiutil.importPlugin(self.macro.cfg, 'parser', 'text_x_arnica', 'Parser')
        if arnica_parser is None:
            return self.formatter.text("Please install the arnica parser!")

        ap = arnica_parser("", self.macro.request, format_args=self.args)
        if ap.init_settings:
            return ap.render(self.formatter)

def execute(macro, args):
    return '<div class="arnica">' + arnica(macro, args).renderInPage() + '</div>'