Attachment 'schedules-1.0.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     MoinMoin - MoinMoin.formatter.schedules
   4 
   5     @copyright: 2019 IanRiley
   6     @copyright: 2009 MoinMoin:DmitrijsMilajevs
   7     @license: GNU GPL, see COPYING for details.
   8 """
   9 
  10 from MoinMoin.formatter import FormatterBase
  11 from MoinMoin import wikiutil
  12 
  13 class Formatter(FormatterBase):
  14     """
  15     Collect items of a schedule and format nothing.
  16 
  17     Schedules are stored in the members attribute.
  18     """
  19 
  20     def __init__(self, request, **kw):
  21         FormatterBase.__init__(self, request, **kw)
  22 
  23         self.members = []
  24         self._bullet_list_level = 0
  25         self._catch_page = False
  26         self._catch_args = False
  27 
  28     def bullet_list(self, on, **kw):
  29         if on:
  30             self._bullet_list_level += 1
  31         else:
  32             self._bullet_list_level -= 1
  33 
  34         assert self._bullet_list_level >= 0
  35 
  36         return self.null()
  37 
  38     def listitem(self, on, **kw):
  39         if on and self._bullet_list_level == 1:
  40             self._catch_page = True
  41             self._catch_args = False
  42         return self.null()
  43 
  44     def text(self, text, **kw):
  45         if self._catch_page:
  46             page = text.strip()
  47             self.members.append(page)
  48             self._catch_page = False
  49         if self._catch_args:
  50             args = text.strip()
  51             self.members[-1] += " %s" % args
  52             self._catch_args = False
  53         return self.null()
  54 
  55     def pagelink(self, on, pagename='', page=None, **kw):
  56         if self._catch_page:
  57             if not pagename and page:
  58                 pagename = page.page_name
  59             page = wikiutil.normalize_pagename(pagename, self.request.cfg)
  60             self.members.append(page)
  61             self._catch_page = False
  62         else:
  63             self._catch_args = True         
  64         return self.null()
  65 
  66     def null(self, *args, **kw):
  67         return ''
  68 
  69     # All these must be overriden here because they raise
  70     # NotImplementedError!@#! or return html?! in the base class.
  71     set_highlight_re = rawHTML = url = image = smiley = null
  72     strong = emphasis = underline = highlight = sup = sub = strike = null
  73     code = preformatted = small = big = code_area = code_line = null
  74     code_token = linebreak = paragraph = rule = icon = null
  75     number_list = definition_list = definition_term = definition_desc = null
  76     heading = table = null
  77     table_row = table_cell = attachment_link = attachment_image = attachment_drawing = null
  78     transclusion = transclusion_param = null
  79     macro = lang = anchordef = span = line_anchordef = sysmsg = null
  80     startContent = escapedText = line_anchorlink = null
  81     div = endContent = anchorlink = interwikilink = null

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