1 """
   2     Raw HTML Macro
   3 
   4     Originally by Christian Bird <chris.bird@lineo.com>
   5     Modified by Adam Shand <adam@personaltelco.net> on 14 April 2003
   6     Now allows arbitrary HTML if the page is immutable.
   7 
   8     Much thanks to Thomas and Jürgen for all the help.
   9 
  10     Usage: [[HTML(<b>This is HTML.</b>)]]
  11 """
  12 
  13 import cgi
  14                                                                                 
  15 def execute(macro, args):
  16     _ = macro.request.getText
  17     page = macro.formatter.page
  18 
  19     if page.isWritable():
  20         ret = '<p><strong class="error">%s</strong></p>' % _('Raw HTML not returned because page is writable.')
  21         ret += cgi.escape(args)
  22     else:
  23         ret = "\n<!-- Begin HTML.py Output -->\n %s \n<!-- End HTML.py Output -->\n" % args
  24                                                                                 
  25     return macro.formatter.rawHTML(ret)

MoinMoin: macro/HTML2.py (last edited 2007-10-29 19:12:47 by localhost)