1 """
   2     MoinMoin - Slide macro
   3 
   4     Usage - Used as a marker to separate slides within a wiki page - use
   5             together with the slideshow action to create a slideshow
   6 
   7             Create a page with the format:
   8 
   9                 general introduction or comments
  10                 [[Slide]]
  11                 Slide 1 contents
  12                 [[Slide]]
  13                 Slide 2 contents
  14                 ...
  15                 [[Slide]]
  16                 Final slide contents
  17 
  18     @copyright: 2005 Jim Clark
  19     @license: GNU GPL, see COPYING for details.
  20 """
  21 from MoinMoin import wikiutil
  22 
  23 Dependencies = []
  24 
  25 def execute(macro, args):
  26     # A running count of the Slide macros on the page allows us to link to
  27     # a specific slide
  28     if hasattr(macro.request, 'slidecount'):
  29         macro.request.slidecount += 1
  30     else:
  31         macro.request.slidecount = 1
  32 
  33     # Add a horizontal rule to separate the slides, and a link to the
  34     # slideshow action
  35     formatter = macro.formatter
  36     text = formatter.rule()
  37     page = wikiutil.quoteWikinameURL(formatter.page.page_name)
  38     url = '%s?action=slideshow&slidenumber=%d' % (page, macro.request.slidecount)
  39     text += wikiutil.link_tag(macro.request, url, text='slide',
  40                               formatter=formatter)
  41     return text

MoinMoin: JimClark/Slide.py (last edited 2007-10-29 19:10:12 by localhost)