diff --git a/content/help.js b/content/help.js
index a1cfc734..0f39c2b1 100644
--- a/content/help.js
+++ b/content/help.js
@@ -47,64 +47,9 @@ vimperator.help = function (section, easter) //{{{
function makeHelpString(commands, beg, end, func)
{
var ret = "";
- var separator = '
|
\n';
for (var command in commands)
- {
- // the usage information for the command
- ret += '';
- for (var j=0; j < command.usage.length; j++)
- {
- var usage = command.usage[j];
+ ret += vimperator.util.generateHelp(command);
- // keep
- //usage = usage.replace(/<([^b][^r].*>)/g, "<$1");
- //usage = usage.replace(/[^b][^r][^\/]>/g, ">");
- usage = vimperator.util.escapeHTML(usage);
- usage = usage.replace(/\\n/g, " ");
- // color [count], [!], {arg} and [arg] in the usage, not nice and error prone but the regexp work (for now)
- usage = usage.replace(/({[^}]+})/g, "$1"); // required args
- usage = usage.replace(/(^|[^A-Za-z])(\[[^!\]]+\])/g, "$1$2"); // optional args
- usage = usage.replace(/\[!\]/, "[!]"); // special
- // and the 'option' in a different color
- usage = usage.replace(/^'(\w+)'/gm, "'$1'");
- ret += "" + beg + usage + end + ' ';
- }
- ret += ' | ';
-
- // the actual help text with the first line in bold
- if (command.shortHelp)
- {
- ret += '';
- ret += command.shortHelp; // the help description
- ret += " ";
- if (func) // for options we print default values here, e.g.
- {
- ret += func.call(this, command);
- ret += " ";
- }
- if (command.help)
- {
- ret += command.help; // the help description
- ret += " ";
- }
- }
- else
- ret += "Sorry, no help available";
- // the tags which are printed on the top right
- ret += ' | ';
- var names = command.names;
- for (var j=0; j < names.length; j++)
- {
- var cmdName = names[j];
- cmdName = vimperator.util.escapeHTML(cmdName);
- ret += '' + beg + cmdName + end + ' ';
- }
- ret += ' |
';
-
- // add more space between entries
- ret += separator;
- }
- ret = ret.replace(new RegExp(separator + "$"), ""); // FIXME: far too tasty!
return ret;
}
@@ -179,15 +124,15 @@ vimperator.help = function (section, easter) //{{{
var mappings = 'mappingsMappings
' +
'The denotion of modifier keys is like in Vim, so C- means the Control key, M- the Meta key, A- the Alt key and S- the Shift key.
' +
'';
- mappings += makeHelpString(vimperator.mappings, "", "", null);
- mappings += '
';
+ mappings = makeHelpString(vimperator.mappings, "", "", null);
+ //mappings += '';
if (section && section == "holy-grail")
mappings += '\n';
var commands = 'commandsCommands
' +
'\n';
- commands += makeHelpString(vimperator.commands, ":", "", null);
- commands += '
';
+ commands = makeHelpString(vimperator.commands, ":", "", null);
+ //commands += '';
if (section && section == "42")
commands += 'What is the meaning of life, the universe and everything?
' +
'Douglas Adams, the only person who knew what this question really was about is
' +
@@ -214,6 +159,8 @@ vimperator.help = function (section, easter) //{{{
options +
'\n
\n