def execute(macro, args): # Parse arguments if args is None: args = '' args = [x.strip() for x in args.split(',')] metatableargs = '' includeargs = '' split = None try: split = args.index('') except ValueError: metatableargs = ','.join(args) if split: metatableargs = ','.join(args[:split]) includeargs = ','.join(args[split + 1:]) # Get pages pagelist, metakeys, styles = metatable_parseargs(macro.request, metatableargs, get_all_keys=True) if not pagelist: return "No match for '{0}'".format(text_escape(metatableargs)) # Use MoinMoin's include to print the pages return moinInclude.execute(macro, make_pagelist(pagelist) + includeargs)
def create_wp_list(macro, request, parser, formatter, character_name): j = load_json_from_page(request, parser, character_name, u'character') if not j: return 'No WP(s) are defined for this character.' j = j.get(u'ウェポンパック', []) text = u'' last_parser = macro.parser for wp_name in j: include_args = u'%(wp_name)s, "%(wp_name)s", 3, from="=== %(wp_name)s ===", to="==== コメント ===="' % { u'wp_name': wp_name } text += Include.execute(macro, include_args) return text
def macro_CollapsibleSection(macro, title, page, visible=False, header=u'h2', plus=u'+', minus=u'-'): request = macro.request idx = request.uid_generator(section_base) html = u'' if idx == section_base: #this is the first call to this macro, include the main JS code html = section_js % (minus, plus) if header is None: header = u'h2' title = u"%s %s" % (minus, title) page_html = Include.execute(macro, page) html += section_template % (header, idx, idx, title, header, idx, page_html) if not visible: hide_html = section_hide_template % idx html += hide_html return macro.formatter.rawHTML(html)