mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:17:58 +01:00
make sure [!] is highlighted properly in the help page for all command usage
synopses
This commit is contained in:
@@ -62,11 +62,13 @@ Vimperator.prototype.help = function(section, easter) //{{{
|
||||
usage = usage.replace(/</g, "<");
|
||||
usage = usage.replace(/>/g, ">");
|
||||
usage = usage.replace(/\\n/g, "<br/>");
|
||||
// color {count} and [url] arguments in the usage, not nice and error prone but the regexp work (for now)
|
||||
usage = usage.replace(/(^|;|\n|\s|\]|\}|=|<br\/?>)({.*?}|\[.*?\])/gm, "$1<span class=\"argument\">$2</span>");
|
||||
// color {count}, [!], {arg} and [arg] in the usage, not nice and error prone but the regexp work (for now)
|
||||
usage = usage.replace(/({[^}]+})/g, "<span class=\"argument\">$1</span>"); // required args
|
||||
usage = usage.replace(/([^A-Za-z])(\[[^!\]]+\])/g, "$1<span class=\"argument\">$2</span>"); // optional args
|
||||
usage = usage.replace(/\[!\]/, "<span class=\"argument\">[!]</span>"); // special
|
||||
// and the 'option' in a different color
|
||||
usage = usage.replace(/^'(\w+)'/gm, "'<span class=\"option\">$1</span>'");
|
||||
ret += "<code>" +beg+ usage +end+ '</code><br/>';
|
||||
ret += "<code>" + beg + usage + end + '</code><br/>';
|
||||
}
|
||||
ret += '</td><td valign="top">';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user