Back to index

moin  1.9.0~rc2
InterWiki.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     Outputs the interwiki map.
00004 
00005     @copyright: 2007 MoinMoin:ThomasWaldmann
00006     @license: GNU GPL, see COPYING for details
00007 """
00008 
00009 Dependencies = ["pages"] # if interwikimap is editable
00010 
00011 from MoinMoin import wikiutil
00012 
00013 def macro_InterWiki(macro):
00014     interwiki_list = wikiutil.load_wikimap(macro.request)
00015     iwlist = interwiki_list.items() # this is where we cached it
00016     iwlist.sort()
00017     fmt = macro.formatter
00018     output = []
00019     output.append(fmt.definition_list(1))
00020     for tag, url in iwlist:
00021         output.append(fmt.definition_term(1))
00022         output.append(fmt.code(1))
00023         output.append(fmt.url(1, wikiutil.join_wiki(url, 'RecentChanges')))
00024         output.append(fmt.text(tag))
00025         output.append(fmt.url(0))
00026         output.append(fmt.code(0))
00027         output.append(fmt.definition_term(0))
00028         output.append(fmt.definition_desc(1))
00029         output.append(fmt.code(1))
00030         if '$PAGE' not in url:
00031             output.append(fmt.url(1, url))
00032             output.append(fmt.text(url))
00033             output.append(fmt.url(0))
00034         else:
00035             output.append(fmt.text(url))
00036         output.append(fmt.code(0))
00037         output.append(fmt.definition_desc(1))
00038     output.append(fmt.definition_list(0))
00039     return u''.join(output)
00040