view data/plugin/macro/ @ 653:127da830be6c

updated copyright
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 19 Apr 2016 16:29:54 +0200
parents dda4017bc8a4
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - ShortText macro

    It shows the first 180 chars of a wiki page without any processing instructions
    and only if the user is allowed to read that page.

    @copyright: 2005-2016 by MoinMoin:ReimarBauer
    @license: GNU GPL, see COPYING for details.
Dependencies = ["pages"]

from MoinMoin.Page import Page
from MoinMoin import wikiutil

def macro_ShortText(macro, pagename=unicode, length=180):
    request = macro.request
    _ = request.getText
        raw = Page(request, pagename).get_data()
        return request.formatter.text(raw[:length])
        return _("You are not allowed to view this page.")