commit
6ab4ef7d88
|
@ -929,4 +929,6 @@ img.emojione {
|
|||
|
||||
code {
|
||||
padding: 0px 2px;
|
||||
color: #444;
|
||||
border: 1pt solid #444;
|
||||
}
|
|
@ -239,9 +239,9 @@ weechat.filter('prefixlimit', function() {
|
|||
|
||||
weechat.filter('codify', function() {
|
||||
return function(text) {
|
||||
var re = /(`.+?`)/g;
|
||||
return text.replace(re, function(z) {
|
||||
var rr = '<code>' + z.slice(1, z.length-1) + '</code>';
|
||||
var re = /`(.+?)`/g;
|
||||
return text.replace(re, function(match, code) {
|
||||
var rr = '<span class="hidden-bracket">`</span><code>' + code + '</code><span class="hidden-bracket">`</span>';
|
||||
return rr;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -99,11 +99,11 @@ describe('Filters', function() {
|
|||
}));
|
||||
|
||||
it('should codify single snippets', inject(function(codifyFilter) {
|
||||
expect(codifyFilter('z `foo` z')).toEqual('z <code>foo</code> z');
|
||||
expect(codifyFilter('z `foo` z')).toEqual('z <span class="hidden-bracket">`</span><code>foo</code><span class="hidden-bracket">`</span> z');
|
||||
}));
|
||||
|
||||
it('should codify multiple snippets', inject(function(codifyFilter) {
|
||||
expect(codifyFilter('z `foo` z `bar` `baz`')).toEqual('z <code>foo</code> z <code>bar</code> <code>baz</code>');
|
||||
expect(codifyFilter('z `foo` z `bar` `baz`')).toEqual('z <span class="hidden-bracket">`</span><code>foo</code><span class="hidden-bracket">`</span> z <span class="hidden-bracket">`</span><code>bar</code><span class="hidden-bracket">`</span> <span class="hidden-bracket">`</span><code>baz</code><span class="hidden-bracket">`</span>');
|
||||
}));
|
||||
|
||||
it('should not codify empty snippets', inject(function(codifyFilter) {
|
||||
|
|
Loading…
Reference in New Issue