macro/Title Index Kr.py

FrontPage|FindPage|TitleIndex|RecentChanges| UserPreferences U P RSS
""" MoinMoin - TitleIndex KR Macro Copyright (c) 2001 by Chong-Dae Park (cdpark@jupiter.kaist.ac.kr) All rights reserved, see COPYING for details. """ # Imports import cgi, string from MoinMoin import config, user, wikiutil from MoinMoin.Page import Page def _make_index_key(index_letters, additional_html=""): index_letters.sort() s = '<p><center>' links = map(lambda ch: '<a href="#%s">%s</a>' % (wikiutil.quoteWikiname(ch), string.replace(ch, '~', 'Others')), index_letters) s = s + string.join(links, ' | ') s = s + additional_html + '</center><p>' return s def _index_letter(name): letter = name[0] if letter < '\x80' : if letter not in (string.letters + string.digits): letter = "~" else: letter = "~" letter2 = name[0:2] for ganada in ['~@', '~B~X', '~K', '~]', '~H', '~T', '~B', '~U~D', '~^~P', '차', '카', '~C~@', '~L~L', '~U~X'] : if letter2 >= ganada: letter = ganada return letter def execute(macro, args): pages = list(wikiutil.getPageList(config.text_dir)) pages.sort() result = '' index_letters = [] current_letter = None for name in pages: if not name: continue letter = _index_letter(name) if letter not in index_letters: index_letters.append(letter) if letter <> current_letter: result = result + '<h3><a name="%s">%s</a></h3>\n' % ( wikiutil.quoteWikiname(letter), string.replace(letter, '~', 'Others')) current_letter = letter else: result = result + macro.formatter.linebreak(0) result = result + Page(name).link_to() + '\n' return _make_index_key(index_letters, """<br> <a href="?action=titleindex">%s</a>&nbsp;| <a href="?action=titleindex&mimetype=text/xml">%s</a> """ % (user.current.text('Plain title index'), user.current.text('XML title index')) ) + result

"; if (isset($options[timer])) print $menu.$banner."
".$options[timer]->Write()."
"; else print $menu.$banner."
".$timer; ?> # # ?>