From fd050f75ca9adeddbf75e25ddecb3ab817caf446 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 2 May 2009 08:25:37 +0000 Subject: [PATCH] Some adjustments of the formatting for auto_help. Added some colours to the state_example menu. --- game/gamesrc/commands/examples/state_example.py | 11 +++++------ src/helpsys/management/commands/edit_helpfiles.py | 11 +++++------ src/statetable.py | 7 ++++--- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/game/gamesrc/commands/examples/state_example.py b/game/gamesrc/commands/examples/state_example.py index d3f8cc68b6..793d90ab19 100644 --- a/game/gamesrc/commands/examples/state_example.py +++ b/game/gamesrc/commands/examples/state_example.py @@ -72,8 +72,7 @@ def menu_cmd_option2(command): """ option2 This selects the second option. Duh. - - <> + <> This is an extra topic to test the auto_help functionality. """ source_object = command.source_object @@ -95,13 +94,13 @@ def print_menu(source_obj,choice=None): would happen here in a real menu. """ if choice==1: - ch = "> option1\n option2" + ch = "%s> option1\n %soption2" % ('%ch%cy','%cn%cy') #ansi colouring; see src.ansi elif choice==2: - ch = " option1\n> option2" + ch = " %soption1\n%s> option2" % ('%cn%cy','%ch%cy') else: - ch = " option1\n option2" + ch = " %soption1\n option2" % ('%cn%cy') - s ="Menu---------\n%s\n help - get help" % ch + s ="%sMenu---------\n%s\n %shelp - get help" % ('%ch%cr',ch,'%cn%cy') source_obj.emit_to(s) diff --git a/src/helpsys/management/commands/edit_helpfiles.py b/src/helpsys/management/commands/edit_helpfiles.py index 80411a47e3..e0163e7a79 100644 --- a/src/helpsys/management/commands/edit_helpfiles.py +++ b/src/helpsys/management/commands/edit_helpfiles.py @@ -78,10 +78,10 @@ def handle_help_markup(topicstr, entrytext, staff_only, identifier="<>'): topic, text = txt.split('>>',1) - text = text.strip() + text = text.rstrip() topic = topic.lower() if topic in topic_dict.keys(): @@ -99,7 +99,7 @@ def handle_help_markup(topicstr, entrytext, staff_only, identifier="<> and <> markup.""" if self.help_index.has_key(state): + text = text.rstrip() if self.identifier in text: topic_dict, staff_dict = edit_help.handle_help_markup(command, text, staff_only, identifier=self.identifier) @@ -210,10 +211,10 @@ def cmd_state_help(command): if not index: source_object.emit_to("There is no help available here.") return - s = "Help topics for %s:\n" % state + s = "Help topics for %s:\n\r" % state for i in index: - s += " %s\n" % i - s = s[:-1] + s += " %s\n\r" % i + s = s[:-2] source_object.emit_to(s) return else: