Attachment 'TextOnRight.py'

Download

   1 """
   2 
   3     TextOnRight is a MoinMoin 1.1 Processor that creates a simple table
   4     with a picture on the left and text on the right.
   5 
   6     At Geary Central (http://www.geary.com), I often use a bit of page
   7     layout that looks like this:
   8 
   9     +-------+
  10     | photo |   Text on the right.
  11     | photo |   More text.
  12     | photo |
  13     | photo |   And more.
  14     +-------+
  15 
  16     This can be coded with standard MoinMoin tables, but it is fairly
  17     painful. This example has a line break added--the actual text has
  18     to be all on one line:
  19 
  20     ||<tableborder=0 valign=top>http://www.example.com/photo.jpg||<width=8>
  21     ||<valign=top>Text on the right.[[BR]]More text.[[BR]][[BR]]And more.||
  22 
  23     The TextOnRight processor provides a much cleaner way to code this layout:
  24 
  25     {{{#!TextOnRight
  26     http://www.sample.com/photo.jpg
  27     Text on the right.
  28     More text.
  29     
  30     And more.
  31     }}}
  32 
  33     At the moment, this macro has no parameters, no complications.
  34     Life is simple.
  35 
  36     Public domain code by Michael Geary
  37     mailto:Mike@Geary.com
  38     http://www.geary.com
  39 """
  40 
  41 from MoinMoin.parser import wiki
  42 
  43 def process( request, formatter, lines ):
  44 
  45     last = len(lines) - 1
  46     if last < 2:
  47         output = 'ERROR: The TextOnRight macro requires at least two lines.'
  48 
  49     else:
  50         output = '||<tableborder=0 valign=top>' + lines[1] + '||<width=8> ||<valign=top>'
  51 
  52         for r in range( 2, last ):
  53             output += lines[r] + '[[BR]]'
  54     
  55         output += lines[last] + '||\n'
  56 
  57     wikiizer = wiki.Parser( output, request )
  58     wikiizer.format( formatter )

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] (2004-05-05 21:34:20, 10.3 KB) [[attachment:AbcMusic.py]]
  • [get | view] (2004-04-15 07:19:38, 3.4 KB) [[attachment:DataLanguage.py]]
  • [get | view] (2004-04-15 20:23:33, 2.5 KB) [[attachment:GANTT-1.2.1.py]]
  • [get | view] (2003-12-07 18:15:55, 2.4 KB) [[attachment:GANTT.py]]
  • [get | view] (2004-07-29 15:04:28, 12.1 KB) [[attachment:IndentTable.py]]
  • [get | view] (2004-10-05 13:12:16, 10.6 KB) [[attachment:MySQL.py]]
  • [get | view] (2004-03-27 18:55:57, 3.7 KB) [[attachment:SimpleTable.py]]
  • [get | view] (2003-12-07 18:15:55, 1.5 KB) [[attachment:TextOnRight.py]]
  • [get | view] (2004-09-17 06:53:46, 3.0 KB) [[attachment:awktable-1.2.3.py]]
  • [get | view] (2004-10-28 13:55:04, 1.0 KB) [[attachment:colorer.py]]
  • [get | view] (2004-11-04 00:26:37, 1.4 KB) [[attachment:csv_python_module.diff]]
  • [get | view] (2004-04-21 18:29:38, 0.2 KB) [[attachment:html.py]]
  • [get | view] (2004-08-16 10:59:24, 4.8 KB) [[attachment:latex-1.2.3.py]]
  • [get | view] (2004-08-07 07:36:59, 3.9 KB) [[attachment:latex-cygwin.py]]
  • [get | view] (2004-04-09 17:05:33, 2.9 KB) [[attachment:latex.1.2.1.py]]
  • [get | view] (2004-02-29 16:50:13, 2.1 KB) [[attachment:latex.py]]
 All files | Selected Files: delete move to page copy to page

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