view data/plugin/macro/ @ 565:03bb9b27aca8

macro LinkTo introduced for a list of pages who links to the current page
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 31 Jul 2011 11:04:54 +0200
children 127da830be6c
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - LinkTo

    print a list of pages who links to the current page

    @copyright:  2001 Juergen Hermann <>,
                 2011 MoinMoin:ReimarBauer

    @license: GNU GPL, see COPYING for details.
Dependencies = ["namespace"]

def macro_LinkTo(macro, reverse=False):
    request = macro.request
    formatter = request.formatter
    pages = request.rootpage.getPageDict()
    pagelist = pages.keys()
    pageobjs = []
    for name in pagelist:
        if in pages[name].getPageLinks(request):

    links = [''.join([formatter.listitem(1),
                formatter.url(1, href=page.url(request, escape=0)),
                formatter.url(0)]) for page in pageobjs]
    if reverse:
    return ''.join(links)