Attachment 'IncludeUrlContentWiki-1.6.py'

Download

   1 """
   2         IncludeUrlContentWiki macro for MoinMoin 1.6
   3         
   4         Get the content from an URL, process it as wiki markup, and return those
   5         formatted results. 
   6         
   7         I personally use this in cases where I have a web server
   8         process to dynamically generate content that relies on wiki
   9         features like macros, smileys, table layout rules, etc.
  10         
  11         Usage: <<IncludeUrlContentWiki( http://foo.com/wikimarkup )>>
  12         
  13         Originally written by:
  14         2005-03-31 Steve Poole, stevep@wrq.com 
  15         
  16         Updated by:
  17         2008-02-11 Dexter Arver, http://moinmo.in/counterpoke
  18 
  19         @copyright: 2008 Dexter Arver
  20         @license: GNU GPL, see COPYING for details
  21 """
  22 
  23 import urllib
  24 from MoinMoin import wikiutil
  25 
  26 def execute( macro, url ):
  27     request = macro.request
  28     try:
  29         text = urllib.urlopen( url ).read()
  30     except IOError:
  31         text = "{{{ IncludeUrlContentWiki failed on " + url + " }}}"
  32     Parser = wikiutil.searchAndImportPlugin(request.cfg, "parser", request.page.pi['format'])
  33     return wikiutil.renderText(request, Parser, text, line_anchors=False)

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] (2008-02-12 00:43:52, 1.1 KB) [[attachment:IncludeUrlContentWiki-1.6.py]]
  • [get | view] (2008-11-19 23:33:08, 1.2 KB) [[attachment:IncludeUrlContentWiki-1.8.py]]
  • [get | view] (2005-04-01 01:15:07, 1.1 KB) [[attachment:IncludeUrlContentWiki.py]]
 All files | Selected Files: delete move to page copy to page

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