Skip to content

Commit

Permalink
fix new_formatter to allow usage of XML tags in formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Apr 26, 2024
1 parent 359ada8 commit 7f6e044
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 67 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 2.40.3
### Bugfix
* fix `new_formatter` to allow usage of XML tags in formatter

## 2.40.2
### Bugfix
* fix usage with libraries that invoke fake click events [#931](https://github.com/jcubic/jquery.terminal/issues/931)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -8,7 +8,7 @@
[![npm](https://img.shields.io/badge/npm-2.40.2-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-2.40.2-yellow.svg)
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=master&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=master&b68a7df0dd0c8bfd4f7e9bbbc513838b)](https://coveralls.io/github/jcubic/jquery.terminal?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=master&de53a76e58fa938d09d172e6ddf1bb8c)](https://coveralls.io/github/jcubic/jquery.terminal?branch=master)
![NPM Downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded&n=1)](https://www.jsdelivr.com/package/npm/jquery.terminal)
[![Paid Support](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)
Expand Down
32 changes: 2 additions & 30 deletions __tests__/terminal.spec.js
Expand Up @@ -2051,15 +2051,6 @@ describe('Terminal utils', function() {
});
});
describe('$.terminal.new_formatter', function() {
function nested_index() {
var formatters = $.terminal.defaults.formatters;
for (let i in formatters) {
if (formatters[i] === $.terminal.nested_formatting) {
return i;
}
}
return -1;
}
var formatters;
beforeEach(function() {
formatters = $.terminal.defaults.formatters.slice();
Expand All @@ -2068,32 +2059,13 @@ describe('Terminal utils', function() {
$.terminal.defaults.formatters = formatters;
});
it('should add new formatters', function() {
var formatter_1 = function() {};
var formatter_2 = [/xxx/, 'xxx'];
$.terminal.new_formatter(formatter_1);
var formatters = $.terminal.defaults.formatters;
var n = nested_index();
expect(n !== -1).toBeTruthy();
expect(formatters[n]).toBe($.terminal.nested_formatting);
expect(formatters[n - 1]).toBe(formatter_1);
$.terminal.new_formatter(formatter_2);
n = nested_index();
expect(formatters[n]).toBe($.terminal.nested_formatting);
expect(formatters[n - 1]).toBe(formatter_2);
expect(formatters[n - 2]).toBe(formatter_1);
});
it('should add formatter when no nested_formatting', function() {
var formatter_1 = function() {};
var formatter_2 = [/xxx/, 'xxx'];
var formatters = $.terminal.defaults.formatters;
var n = nested_index();
expect(n !== -1).toBeTruthy();
formatters.splice(n, 1);
expect(nested_index()).toEqual(-1);
$.terminal.new_formatter(formatter_1);
$.terminal.new_formatter(formatter_2);
expect(formatters[formatters.length - 2]).toBe(formatter_1);
expect(formatters[formatters.length - 1]).toBe(formatter_2);
expect(formatters.includes(formatter_1)).toBeTruthy();
expect(formatters.includes(formatter_2)).toBeTruthy();
});
});
describe('$.terminal.less', function() {
Expand Down
15 changes: 4 additions & 11 deletions js/jquery.terminal-2.40.2.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 22 Apr 2024 19:31:20 +0000
* Date: Fri, 26 Apr 2024 20:59:39 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5310,7 +5310,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: '2.40.2',
date: 'Mon, 22 Apr 2024 19:31:20 +0000',
date: 'Fri, 26 Apr 2024 20:59:39 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6755,17 +6755,10 @@
});
},
// ---------------------------------------------------------------------
// :: helper function that add formatter before nested_formatting
// :: helper function that add new formatter
// ---------------------------------------------------------------------
new_formatter: function(formatter) {
var formatters = $.terminal.defaults.formatters;
for (var i = 0; i < formatters.length; ++i) {
if (formatters[i] === $.terminal.nested_formatting) {
formatters.splice(i, 0, formatter);
return;
}
}
formatters.push(formatter);
$.terminal.defaults.formatters.unshift(formatter);
}
};
(function() {
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.40.2.min.js

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions js/jquery.terminal-src.js
Expand Up @@ -6755,17 +6755,10 @@
});
},
// ---------------------------------------------------------------------
// :: helper function that add formatter before nested_formatting
// :: helper function that add new formatter
// ---------------------------------------------------------------------
new_formatter: function(formatter) {
var formatters = $.terminal.defaults.formatters;
for (var i = 0; i < formatters.length; ++i) {
if (formatters[i] === $.terminal.nested_formatting) {
formatters.splice(i, 0, formatter);
return;
}
}
formatters.push(formatter);
$.terminal.defaults.formatters.unshift(formatter);
}
};
(function() {
Expand Down
15 changes: 4 additions & 11 deletions js/jquery.terminal.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 22 Apr 2024 19:31:20 +0000
* Date: Fri, 26 Apr 2024 20:59:39 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5310,7 +5310,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: '2.40.2',
date: 'Mon, 22 Apr 2024 19:31:20 +0000',
date: 'Fri, 26 Apr 2024 20:59:39 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6755,17 +6755,10 @@
});
},
// ---------------------------------------------------------------------
// :: helper function that add formatter before nested_formatting
// :: helper function that add new formatter
// ---------------------------------------------------------------------
new_formatter: function(formatter) {
var formatters = $.terminal.defaults.formatters;
for (var i = 0; i < formatters.length; ++i) {
if (formatters[i] === $.terminal.nested_formatting) {
formatters.splice(i, 0, formatter);
return;
}
}
formatters.push(formatter);
$.terminal.defaults.formatters.unshift(formatter);
}
};
(function() {
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit 7f6e044

Please sign in to comment.