1.1 --- a/convert.py Sat Apr 13 19:51:00 2013 +0200
1.2 +++ b/convert.py Sun Apr 14 00:42:30 2013 +0200
1.3 @@ -402,8 +402,9 @@
1.4
1.5 if exists(pagetitle):
1.6 title = read(pagetitle)
1.7 + space, _page_name = get_space_and_name(title)
1.8 else:
1.9 - title = None
1.10 + title = space = None
1.11
1.12 # Sort the revision manifest.
1.13
1.14 @@ -418,8 +419,16 @@
1.15 child_page_names = [x for x in read(children).split("\n") if x]
1.16 child_page_names.sort()
1.17
1.18 + # Produce links which hide the space prefix.
1.19 +
1.20 for child_page_name in child_page_names:
1.21 - child_pages.append(" * [[%s]]" % child_page_name)
1.22 + child_space, page_name = get_space_and_name(child_page_name)
1.23 + if child_space == space:
1.24 + child_page_label = page_name
1.25 + else:
1.26 + child_page_label = child_page_name
1.27 +
1.28 + child_pages.append(" * [[%s|%s]]" % (child_page_name, child_page_label))
1.29
1.30 append(filename, child_page_section % "\n".join(child_pages))
1.31
1.32 @@ -442,6 +451,12 @@
1.33 else:
1.34 append(output, s)
1.35
1.36 +def get_space_and_name(page_name):
1.37 + try:
1.38 + return page_name.split("/", 1)
1.39 + except IndexError:
1.40 + return None, page_name
1.41 +
1.42 # Template for child page information.
1.43
1.44 child_page_section = """