Details

Applies to
Moin 1.5.4
Purpose
Allows you to apply an arbitrary header/footer to the body before it's parsed.
Description

The basic idea here is to allow the user to prepend/append arbitrary wiki text to the body of every page. On our wiki, for example, we use this to display something similar to [[AttachList]] at the bottom of every page, to make it easier for our end users to find & download attachments; though there are certainly innumerable other uses. The configuration parameter is a dictionary, so that you're able to specify a different header/footer for each formatter.

Sample Configuration

    page_format_footer={'wiki':"\n[[EasyAttachList]]"}

Patch

   1 diff -ur moin-1.5.4/MoinMoin/Page.py /usr/local/lib/python2.4/site-packages/MoinMoin/Page.py
   2 --- moin-1.5.4/MoinMoin/Page.py	Thu May 11 09:24:00 2006
   3 +++ /usr/local/lib/python2.4/site-packages/MoinMoin/Page.py	Sat Sep 16 00:12:49 2006
   4 @@ -1229,6 +1229,11 @@
   5          elif not request.user.may.read(self.page_name):
   6              request.write("<strong>%s</strong><br>" % _("You are not allowed to view this page."))
   7          else:
   8 +            # Add in-page header & footer.
   9 +            body = self.request.cfg.page_format_header.get(self.pi_format, '') \
  10 +                   + body \
  11 +                   + self.request.cfg.page_format_footer.get(self.pi_format, '')
  12 +
  13              # parse the text and send the page content
  14              self.send_page_content(request, Parser, body,
  15                                     format_args=pi_formatargs,
  16 diff -ur moin-1.5.4/MoinMoin/multiconfig.py /usr/local/lib/python2.4/site-packages/MoinMoin/multiconfig.py
  17 --- moin-1.5.4/MoinMoin/multiconfig.py	Fri Jun 30 03:46:21 2006
  18 +++ /usr/local/lib/python2.4/site-packages/MoinMoin/multiconfig.py	Sat Sep 16 00:06:02 2006
  19 @@ -277,6 +277,9 @@
  20      navi_bar = [u'RecentChanges', u'FindPage', u'HelpContents', ]
  21      nonexist_qm = 0
  22  
  23 +    page_format_header = {}
  24 +    page_format_footer = {}
  25 +    
  26      page_credits = [
  27          '<a href="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a>',
  28          '<a href="http://www.python.org/">Python Powered</a>',

inbody_hdr_ftr-1.5.4.patch

Discussion

Plan


CategoryMoinMoinPatch

MoinMoin: MoinMoinPatch/ParsedInBodyHeaderFooter (last edited 2007-10-29 19:06:13 by localhost)