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 import neo_cgi, neo_util, neo_cs
00022
00023
00024 Dependencies = ["namespace"]
00025
00026 def execute(macro, args):
00027 request = macro.request
00028 content = []
00029 page_name = macro.formatter.page.page_name
00030
00031
00032 include_page_name = ''
00033 if args is not None:
00034 (include_page_name, _, hdf_text) = args.partition(',')
00035
00036 include_page_name = wikiutil.AbsPageName(page_name, include_page_name)
00037
00038 include_page = Page(request, include_page_name)
00039
00040 if include_page is None:
00041 return ''
00042 if not request.user.may.read(include_page_name):
00043 return ''
00044
00045 cstemplate = include_page.getPageText()
00046
00047 pagename = macro.formatter.page.page_name
00048
00049 hdf = neo_util.HDF()
00050 hdf.readString(hdf_text)
00051
00052 hdf.setValue("Config.WhiteSpaceStrip ", "0")
00053
00054 cs = neo_cs.CS(hdf)
00055 cs.parseStr(cstemplate)
00056
00057 body = cs.render()
00058
00059 body = wikiutil.renderText(request, WikiParser, body)
00060 return body
00061