Attachment 'interwiki.py'

Download

   1  # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - interwiki parser 
   4     can be used to render urls from the definition of the InterWikiMap
   5     page
   6     
   7     @copyright: 2008 by MoinMoin:ReimarBauer
   8     
   9     @license: GNU GPL, see COPYING for details.
  10     
  11 """
  12 
  13 Dependencies = []
  14 
  15 from MoinMoin.formatter.text_html import Formatter
  16 
  17 class Parser:
  18 
  19     extensions = '*'
  20     Dependencies = []
  21 
  22     def __init__(self, raw, request, **kw):
  23         self.raw = raw
  24         self.request = request
  25         self.form = request.form
  26         self._ = request.getText
  27 
  28     def format(self, formatter):
  29         html_formatter = Formatter(self.request)
  30         lines = self.raw.split('\n')
  31         result = []
  32         result.append(formatter.number_list(1))
  33         for line in lines:
  34             if line:
  35                 wiki, url = line.split()
  36                 result.append(formatter.listitem(1))
  37                 result.append(formatter.url(1, url))
  38                 result.append(wiki)
  39                 result.append(formatter.url(0))
  40                 result.append(formatter.listitem(0))
  41         result.append(formatter.number_list(0))
  42         self.request.write(''.join(result))

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2008-07-22 21:12:04, 1.1 KB) [[attachment:interwiki.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.