diff options
Diffstat (limited to 'lib/completion.js')
| -rw-r--r-- | lib/completion.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/completion.js b/lib/completion.js index 2b29258f..6e8ea803 100644 --- a/lib/completion.js +++ b/lib/completion.js @@ -246,10 +246,17 @@ var completion = (function() { var term = query.slice(key.length, query.length); var command = commands[key]; var desc = command[0]; - var urlPattern = command[1]; + var pattern = command[1]; + var url; + + if (typeof pattern === 'function') + url = pattern(term); + else + url = pattern.replace(/%s/g, term); + suggestions.push({ render: createConstantFunction('<em>' + desc + '</em> ' + term), - action: createActionOpenUrl(utils.createFullUrl(urlPattern.replace(/%s/g, term))), + action: createActionOpenUrl(utils.createFullUrl(url)), }); } } |
