# HG changeset patch # User Paul Boddie # Date 1224893623 -7200 # Node ID ad360e4e0197371f3f1cec9aa1137b05c6cc15c2 # Parent c4bb1bf2b9d7b60dd6428a0110d07137c2c0b1ed Introduced abbreviation of repeated page name prefixes. Made the menu float left with some corrective measures. diff -r c4bb1bf2b9d7 -r ad360e4e0197 macros/CategoryMenu.py --- a/macros/CategoryMenu.py Sat Oct 25 01:17:33 2008 +0200 +++ b/macros/CategoryMenu.py Sat Oct 25 02:13:43 2008 +0200 @@ -132,6 +132,8 @@ # Visit each page in the category. + last_parts = [] + for page_in_category in pages_in_category: pagename = page_in_category.page_name @@ -140,10 +142,26 @@ else: output.append(fmt.listitem(on=1)) output.append(fmt.pagelink(on=1, pagename=pagename)) - output.append(fmt.text(pagename)) + + # Abbreviate long hierarchical names. + + parts = pagename.split("/") + common = 0 + for last, current in map(None, last_parts, parts): + if last == current: + common += 1 + else: + break + + prefix = u"\u2014" * common + suffix = "/".join(parts[common:]) + + output.append(fmt.text("%s %s" % (prefix, suffix))) output.append(fmt.pagelink(on=0, pagename=pagename)) output.append(fmt.listitem(on=0)) + last_parts = parts + output.append(fmt.bullet_list(on=0)) output.append(fmt.listitem(on=0)) diff -r c4bb1bf2b9d7 -r ad360e4e0197 themes/ep2008/css/category.css --- a/themes/ep2008/css/category.css Sat Oct 25 01:17:33 2008 +0200 +++ b/themes/ep2008/css/category.css Sat Oct 25 02:13:43 2008 +0200 @@ -1,7 +1,10 @@ /* category.css - some additional styles for the CategoryMenu macro - which can be included in the screen.css using + which can be included in screen.css using... + @import "category.css"; + ...before any rules. + Copyright (c) 2008 by Paul Boddie Licensed under the GNU GPL (v2 or later), see COPYING.txt for details. */ @@ -13,6 +16,14 @@ margin-left: 0; padding-left: 0; width: 20em; + float: left; + margin-right: 2em; +} + +/* Prevent issues with the above float. */ + +hr { + clear: left; } ul.category-submenu {