Attachment 'EmbedContent.py'

Download

   1 # -*- coding: utf-8 -*-
   2 
   3 """
   4      MoinMoin - macro to embed content of an other (wiki) page
   5  
   6      <<EmbedContent(http://www.someplace.com/page.html)>>
   7      <<EmbedContent(file:c:\folder\file.txt)>>
   8 	 http://moinmo.in/MacroMarket/EmbedContent
   9      @copyright: 2010 by MoinMoin:ReimarBauer
  10      @license: GNU GPL, see COPYING for details.
  11 """
  12 import urllib2
  13  
  14 def macro_EmbedContent(macro, url=u""):
  15     fmt = macro.formatter
  16     if url:
  17         uo = urllib2.urlopen(url)
  18         html = uo.read()
  19         uo.close()
  20         return fmt.rawHTML(html)

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] (2010-06-15 18:18:33, 0.6 KB) [[attachment:EmbedContent.py]]
  • [get | view] (2010-06-15 20:39:37, 1.4 KB) [[attachment:test.html]]
 All files | Selected Files: delete move to page copy to page

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