1.1 --- a/README.txt Tue Feb 10 01:19:49 2009 +0100
1.2 +++ b/README.txt Sat Mar 07 19:43:52 2009 +0100
1.3 @@ -54,6 +54,13 @@
1.4 Recommended Software
1.5 --------------------
1.6
1.7 +The Xapian search software is highly recommended, if not technically
1.8 +essential, for the acceptable performance of the CategoryMenu macro since the
1.9 +macro makes use of search routines in MoinMoin that can dominate the time
1.10 +spent processing requests.
1.11 +
1.12 +See the following page for information on Xapian and MoinMoin:
1.13 +
1.14 http://moinmo.in/HelpOnXapian
1.15
1.16 Troubleshooting
1.17 @@ -69,14 +76,29 @@
1.18 Contact, Copyright and Licence Information
1.19 ------------------------------------------
1.20
1.21 -No Web page has yet been made available for this work, but the author can be
1.22 -contacted at the following e-mail address:
1.23 +See the following Web page for more information about this work:
1.24 +
1.25 +http://moinmo.in/MacroMarket/CategoryMenu
1.26 +
1.27 +The author can be contacted at the following e-mail address:
1.28
1.29 paul@boddie.org.uk
1.30
1.31 Copyright and licence information can be found in the docs directory - see
1.32 docs/COPYING.txt and docs/LICENCE.txt for more information.
1.33
1.34 +New in CategoryMenu 0.2 (Changes since CategoryMenu 0.1)
1.35 +--------------------------------------------------------
1.36 +
1.37 + * Improved category and page discovery, preventing needless inspection of
1.38 + all categories, and using the category search method when searching for
1.39 + categories.
1.40 + * Removed unnecessary page name sorting.
1.41 + * Fixed and improved the scripts.
1.42 + * Added MoinMoin 1.8.x compatibility.
1.43 + * Made displayed page names prettier.
1.44 + * Added recommended software and troubleshooting documentation.
1.45 +
1.46 Release Procedures
1.47 ------------------
1.48
1.49 @@ -85,4 +107,4 @@
1.50 Update the release notes (see above).
1.51 Tag, export.
1.52 Archive, upload.
1.53 -Update the MacroMarket (http://moinmo.in/MacroMarket).
1.54 +Update the MacroMarket (see above for the URL).
2.1 --- a/docs/COPYING.txt Tue Feb 10 01:19:49 2009 +0100
2.2 +++ b/docs/COPYING.txt Sat Mar 07 19:43:52 2009 +0100
2.3 @@ -1,7 +1,7 @@
2.4 Licence Agreement
2.5 -----------------
2.6
2.7 -Copyright (C) 2008 Paul Boddie <paul@boddie.org.uk>
2.8 +Copyright (C) 2008, 2009 Paul Boddie <paul@boddie.org.uk>
2.9
2.10 Some pieces of MoinMoin code were used in this work -
2.11 specifically the category regular expression code from
3.1 --- a/instmacros Tue Feb 10 01:19:49 2009 +0100
3.2 +++ b/instmacros Sat Mar 07 19:43:52 2009 +0100
3.3 @@ -1,7 +1,7 @@
3.4 #!/bin/bash
3.5
3.6 if [[ ! $1 ]] ; then
3.7 - echo "Please specify a directory such as ../mysite or /tmp/mysite."
3.8 + echo "Please specify a directory such as ../mysite/wiki or /tmp/mysite/wiki."
3.9 echo "This should be the root of your Wiki installation and contain the data"
3.10 echo "directory."
3.11 echo
4.1 --- a/insttheme Tue Feb 10 01:19:49 2009 +0100
4.2 +++ b/insttheme Sat Mar 07 19:43:52 2009 +0100
4.3 @@ -12,9 +12,18 @@
4.4 echo "The specified directory may be called htdocs, but sometimes it is called"
4.5 echo "something like moin_static160."
4.6 echo
4.7 + echo "In more recent versions of MoinMoin, the htdocs directory is found within"
4.8 + echo "a shared directory such as ../moin/share/moin or /tmp/moin/share/moin,"
4.9 + echo "and you should specify the htdocs directory in this location instead."
4.10 + echo "For example: ../moin/share/moin/htdocs"
4.11 + echo
4.12 echo "You may wish to uncomment and modify the chown command in this script."
4.13 exit
4.14 fi
4.15
4.16 -cp css/*.css $1/$2/css/
4.17 -#chown www-data: $1/htdocs/$2/css/
4.18 +cp -i css/*.css $1/$2/css/
4.19 +#chown www-data: $1/$2/css/
4.20 +echo "Don't forget to update the screen.css file:"
4.21 +echo $1/$2/css/screen.css
4.22 +echo
4.23 +echo "See the README.txt file for details."
5.1 --- a/macros/CategoryMenu.py Tue Feb 10 01:19:49 2009 +0100
5.2 +++ b/macros/CategoryMenu.py Sat Mar 07 19:43:52 2009 +0100
5.3 @@ -2,7 +2,7 @@
5.4 """
5.5 MoinMoin - CategoryMenu Macro
5.6
5.7 - @copyright: 2008 by Paul Boddie <paul@boddie.org.uk>
5.8 + @copyright: 2008, 2009 by Paul Boddie <paul@boddie.org.uk>
5.9 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
5.10 2005-2008 MoinMoin:ThomasWaldmann.
5.11 @license: GNU GPL (v2 or later), see COPYING.txt for details.
5.12 @@ -12,7 +12,7 @@
5.13 from MoinMoin import wikiutil, search, version
5.14 import re
5.15
5.16 -__version__ = "0.1"
5.17 +__version__ = "0.2"
5.18
5.19 Dependencies = ['pages']
5.20
5.21 @@ -90,6 +90,12 @@
5.22 pages.append(page)
5.23 return pages
5.24
5.25 +def getPrettyPageName(page):
5.26 +
5.27 + "Return a nicely formatted title/name for the given 'page'."
5.28 +
5.29 + return page.split_title(force=1).replace("_", " ").replace("/", u" » ")
5.30 +
5.31 def execute(macro, args):
5.32
5.33 """
5.34 @@ -104,7 +110,7 @@
5.35 # Interpret the arguments.
5.36
5.37 try:
5.38 - selected_category_names = wikiutil.parse_quoted_separated(args, name_value=False)
5.39 + selected_category_names = args and wikiutil.parse_quoted_separated(args, name_value=False) or []
5.40 except AttributeError:
5.41 selected_category_names = args.split(",")
5.42
5.43 @@ -125,14 +131,16 @@
5.44 for category in categories:
5.45 category_name, category_pagename = category
5.46
5.47 + # Work out whether the current page belongs to this category.
5.48 +
5.49 page_is_category = page.page_name == category_pagename
5.50 category_membership_regexp = re.compile(category_membership_regexp_str % category_pagename)
5.51 - page_in_category = category_membership_regexp.search(page.get_raw_body())
5.52 + page_is_in_category = category_membership_regexp.search(page.get_raw_body())
5.53
5.54 # Generate the submenu where appropriate.
5.55
5.56 if selected_category_names and category_name in selected_category_names or \
5.57 - not selected_category_names and (page_is_category or page_in_category):
5.58 + not selected_category_names and (page_is_category or page_is_in_category):
5.59
5.60 if page_is_category:
5.61 output.append(fmt.listitem(on=1, attr={"class" : "selected current"}))
5.62 @@ -148,7 +156,6 @@
5.63 # Get the pages and page names in the category.
5.64
5.65 pages_in_category = getPages(category_pagename, request)
5.66 - pagenames_in_category = [p.page_name for p in pages_in_category]
5.67
5.68 # Visit each page in the category.
5.69
5.70 @@ -157,11 +164,18 @@
5.71 for page_in_category in pages_in_category:
5.72 pagename = page_in_category.page_name
5.73
5.74 + # Get a real page, not a result page.
5.75 +
5.76 + real_page_in_category = Page(request, pagename)
5.77 +
5.78 + # Get a pretty version of the page name.
5.79 +
5.80 + pretty_pagename = getPrettyPageName(real_page_in_category)
5.81 +
5.82 if page.page_name == pagename:
5.83 output.append(fmt.listitem(on=1, attr={"class" : "selected"}))
5.84 else:
5.85 output.append(fmt.listitem(on=1))
5.86 - output.append(fmt.pagelink(on=1, pagename=pagename))
5.87
5.88 # Abbreviate long hierarchical names.
5.89
5.90 @@ -178,8 +192,11 @@
5.91 prefix = u"\u2014" * common
5.92 suffix = "/".join(parts[common:])
5.93
5.94 - output.append(fmt.text("%s %s" % (prefix, suffix)))
5.95 - output.append(fmt.pagelink(on=0, pagename=pagename))
5.96 + output.append(fmt.text(prefix))
5.97 +
5.98 + # Link to the page using the pretty name.
5.99 +
5.100 + output.append(real_page_in_category.link_to_raw(request, wikiutil.escape(pretty_pagename)))
5.101 output.append(fmt.listitem(on=0))
5.102
5.103 last_parts = parts