# HG changeset patch # User Paul Boddie # Date 1225570396 -3600 # Node ID 2797ebfc8e2f9404ed1bf9fd0faed084d125c966 # Parent 7aa975d1ddc1730c2763f591a2f9d1660778b666 Update to CategoryMenu 0.1. diff -r 7aa975d1ddc1 -r 2797ebfc8e2f macros/CategoryMenu.py --- a/macros/CategoryMenu.py Sat Nov 01 03:33:02 2008 +0100 +++ b/macros/CategoryMenu.py Sat Nov 01 21:13:16 2008 +0100 @@ -12,9 +12,15 @@ from MoinMoin import wikiutil, search, version import re +__version__ = "0.1" + +Dependencies = ['pages'] + +# Regular expressions where MoinMoin does not provide the required support. + category_regexp = None -Dependencies = ['pages'] +# Utility functions. def isMoin15(): return version.release.startswith("1.5.") @@ -32,6 +38,8 @@ category_regexp = re.compile(u'^%s$' % ur'(?PCategory(?P(?!Template)\S+))', re.UNICODE) return category_regexp +# The main activity functions. + def getCategories(request): """ @@ -81,6 +89,12 @@ return pages def execute(macro, args): + + """ + Execute the 'macro' with the given 'args': an optional list of selected + category names (categories whose pages are to be shown). + """ + request = macro.request fmt = macro.formatter page = fmt.page @@ -153,6 +167,8 @@ else: break + # Use an em-dash to indicate subpages. + prefix = u"\u2014" * common suffix = "/".join(parts[common:])