Improve regex to avoid slicing
This commit is contained in:
parent
2470192cf0
commit
94ad3b8b51
@ -239,9 +239,9 @@ weechat.filter('prefixlimit', function() {
|
|||||||
|
|
||||||
weechat.filter('codify', function() {
|
weechat.filter('codify', function() {
|
||||||
return function(text) {
|
return function(text) {
|
||||||
var re = /(`.+?`)/g;
|
var re = /`(.+?)`/g;
|
||||||
return text.replace(re, function(z) {
|
return text.replace(re, function(match, code) {
|
||||||
var rr = '<span class="hidden-bracket">`</span><code>' + z.slice(1, z.length-1) + '</code><span class="hidden-bracket">`</span>';
|
var rr = '<span class="hidden-bracket">`</span><code>' + code + '</code><span class="hidden-bracket">`</span>';
|
||||||
return rr;
|
return rr;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user