00001
00002 """MoinMoin - IncludeWikiContent
00003
00004 A macro to include another wiki page content with the context set to the current
00005 page. This Inclusion is not recursive (included pages won't get their
00006 IncludeWikiContent macro evaluated).
00007
00008 Usage:
00009 Use this macro to include common elements of your wiki, such as standard
00010 subpages, headers etc...
00011
00012 Syntax:
00013 <<IncludeWikiContent(include page name)>>
00014
00015 """
00016
00017 from MoinMoin.Page import Page
00018 from MoinMoin import wikiutil
00019 from MoinMoin.parser.text_moin_wiki import Parser as WikiParser
00020
00021
00022
00023 Dependencies = ["namespace"]
00024
00025 def execute(macro, args):
00026 request = macro.request
00027 content = []
00028 page_name = macro.formatter.page.page_name
00029
00030
00031 include_page_name = ''
00032 if args is not None:
00033 include_page_name = args
00034
00035 include_page_name = wikiutil.AbsPageName(page_name, include_page_name)
00036
00037 include_page = Page(request, include_page_name)
00038
00039 if include_page is None:
00040 return ''
00041 if not request.user.may.read(include_page_name):
00042 return ''
00043 else:
00044 return wikiutil.renderText(request, WikiParser, include_page.getPageText())
00045