1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/README.txt Sat Nov 01 01:42:32 2008 +0100
1.3 @@ -0,0 +1,61 @@
1.4 +Introduction
1.5 +------------
1.6 +
1.7 +The CategoryMenu macro for MoinMoin provides support for navigation menus,
1.8 +placed in the page content itself, showing the categories available in a Wiki,
1.9 +along with the pages in the selected category.
1.10 +
1.11 +Installation
1.12 +------------
1.13 +
1.14 +To install the macro in a Wiki, consider using the instmacros script provided:
1.15 +
1.16 + ./instmacros path-to-wiki
1.17 +
1.18 +On non-UNIX platforms, it is necessary to manually copy the contents of the
1.19 +macros directory in this distribution into the macros directory of your Wiki.
1.20 +
1.21 +It should now be possible to edit pages and use the macro as follows. For
1.22 +MoinMoin 1.5:
1.23 +
1.24 + [[CategoryMenu()]]
1.25 +
1.26 +For MoinMoin 1.6 and above:
1.27 +
1.28 + <<CategoryMenu()>>
1.29 +
1.30 +As arguments to the macro, you can indicate a comma-separated list of selected
1.31 +(or opened) categories in the menu. For example:
1.32 +
1.33 + <<CategoryMenu(Homepage)>>
1.34 +
1.35 +Although this should display the menu as a hierarchical list, you may wish to
1.36 +change the appearance of the menu to something more visually attractive; to do
1.37 +so, consider using the insttheme script provided:
1.38 +
1.39 + ./insttheme path-to-wiki theme-name
1.40 +
1.41 +Again, on non-UNIX platforms, it is necessary to manually copy the files. In
1.42 +this case, just copy the contents of the css directory into the css directory
1.43 +of themes which will support styling of category menus.
1.44 +
1.45 +Contact, Copyright and Licence Information
1.46 +------------------------------------------
1.47 +
1.48 +No Web page has yet been made available for this work, but the author can be
1.49 +contacted at the following e-mail address:
1.50 +
1.51 +paul@boddie.org.uk
1.52 +
1.53 +Copyright and licence information can be found in the docs directory - see
1.54 +docs/COPYING.txt and docs/LICENCE.txt for more information.
1.55 +
1.56 +Release Procedures
1.57 +------------------
1.58 +
1.59 +Update the CategoryMenu.py __version__ attribute.
1.60 +Change the version number and package filename/directory in the documentation.
1.61 +Update the release notes (see above).
1.62 +Tag, export.
1.63 +Archive, upload.
1.64 +Update the MacroMarket (http://moinmo.in/MacroMarket).
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/instmacros Sat Nov 01 01:42:32 2008 +0100
2.3 @@ -0,0 +1,11 @@
2.4 +#!/bin/bash
2.5 +
2.6 +if [ ! $1 ] ; then
2.7 + echo "Please specify a directory such as ../mysite or /tmp/mysite."
2.8 + echo "This should be the root of your Wiki installation and contain the wiki"
2.9 + echo "directory."
2.10 + exit
2.11 +fi
2.12 +
2.13 +cp macros/*.py $1/wiki/data/plugin/macro/
2.14 +chown www-data: $1/wiki/data/plugin/macro/*.py
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/insttheme Sat Nov 01 01:42:32 2008 +0100
3.3 @@ -0,0 +1,13 @@
3.4 +#!/bin/bash
3.5 +
3.6 +if [ ! $2 ] ; then
3.7 + echo "Please specify a directory such as ../mywiki or /tmp/mywiki along"
3.8 + echo "with the name of the theme into which the CategoryMenu styles will be"
3.9 + echo "copied."
3.10 + echo "The specified directory should be the root of your Wiki installation"
3.11 + echo "and contain the wiki directory."
3.12 + exit
3.13 +fi
3.14 +
3.15 +cp css/*.css $1/htdocs/$2/css/
3.16 +chown www-data: $1/htdocs/$2/css/
4.1 --- a/macros/CategoryMenu.py Sat Oct 25 02:09:43 2008 +0200
4.2 +++ b/macros/CategoryMenu.py Sat Nov 01 01:42:32 2008 +0100
4.3 @@ -12,9 +12,15 @@
4.4 from MoinMoin import wikiutil, search, version
4.5 import re
4.6
4.7 +__version__ = "0.1"
4.8 +
4.9 +Dependencies = ['pages']
4.10 +
4.11 +# Regular expressions where MoinMoin does not provide the required support.
4.12 +
4.13 category_regexp = None
4.14
4.15 -Dependencies = ['pages']
4.16 +# Utility functions.
4.17
4.18 def isMoin15():
4.19 return version.release.startswith("1.5.")
4.20 @@ -32,6 +38,8 @@
4.21 category_regexp = re.compile(u'^%s$' % ur'(?P<all>Category(?P<key>(?!Template)\S+))', re.UNICODE)
4.22 return category_regexp
4.23
4.24 +# The main activity functions.
4.25 +
4.26 def getCategories(request):
4.27
4.28 """
4.29 @@ -81,6 +89,12 @@
4.30 return pages
4.31
4.32 def execute(macro, args):
4.33 +
4.34 + """
4.35 + Execute the 'macro' with the given 'args': an optional list of selected
4.36 + category names (categories whose pages are to be shown).
4.37 + """
4.38 +
4.39 request = macro.request
4.40 fmt = macro.formatter
4.41 page = fmt.page
4.42 @@ -153,6 +167,8 @@
4.43 else:
4.44 break
4.45
4.46 + # Use an em-dash to indicate subpages.
4.47 +
4.48 prefix = u"\u2014" * common
4.49 suffix = "/".join(parts[common:])
4.50