Author: georg.brandl Date: Fri Aug 31 08:56:18 2007 New Revision: 57819 Modified: doctools/trunk/sphinx/directives.py Log: Add a shorthand notation for single index entries. Modified: doctools/trunk/sphinx/directives.py ============================================================================== --- doctools/trunk/sphinx/directives.py (original) +++ doctools/trunk/sphinx/directives.py Fri Aug 31 08:56:18 2007 @@ -38,12 +38,16 @@ indexnode = addnodes.index() indexnode['entries'] = arguments for entry in arguments: - try: - type, string = entry.split(':', 1) - env.note_index_entry(type.strip(), string.strip(), - targetid, string.strip()) - except ValueError: - continue + entry = entry.strip() + for type in entrytypes: + if entry.startswith(type+':'): + value = entry[len(type)+1:].strip() + env.note_index_entry(type, value, targetid, value) + break + # shorthand notation for single entries + else: + for value in entry.split(','): + env.note_index_entry('single', value.strip(), targetid, value.strip()) return [indexnode, targetnode] index_directive.arguments = (1, 0, 1)