Skip to content

Commit

Permalink
fix order of prism and xml formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed May 5, 2024
1 parent 27ec7af commit 2f5c1d5
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 24 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
## 2.41.2
### Bugfix
* fix commands in pipe operator with non string arguments
* fix text selection of raw HTML [#939](https://github.com/jcubic/jquery.terminal/issues/939)
* fix order of prism and xml formatters

## 2.41.1
### Bugfix
* fix paused terminal when echo broken image
* fix returning String instance from interpreter
* fix commands in pipe operator with non string arguments

## 2.41.0
### Features
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=devel&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=devel&8f2e58e2cbb0889679fb75085e7c7a4b)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&ec80eca7a05f23108ae67f32d7cfda8d)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
![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
25 changes: 25 additions & 0 deletions __tests__/terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2135,13 +2135,38 @@ 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();
});
afterEach(function() {
$.terminal.defaults.formatters = formatters;
});
it('should add new formatters before nested_formatting', function() {
const formatter_1 = function() {};
const formatter_2 = [/xxx/, 'xxx'];
const nested = $.terminal.nested_formatting;
$.terminal.new_formatter(formatter_1, nested);
const formatters = $.terminal.defaults.formatters;
let n = nested_index();
expect(n !== -1).toBeTruthy();
expect(formatters[n]).toBe(nested);
expect(formatters[n - 1]).toBe(formatter_1);
$.terminal.new_formatter(formatter_2, nested);
n = nested_index();
expect(formatters[n]).toBe(nested);
expect(formatters[n - 1]).toBe(formatter_2);
expect(formatters[n - 2]).toBe(formatter_1);
});
it('should add new formatters', function() {
var formatter_1 = function() {};
var formatter_2 = [/xxx/, 'xxx'];
Expand Down
21 changes: 15 additions & 6 deletions js/jquery.terminal-2.41.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.41.1
* \/ /____/ version DEV
*
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
*
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 29 Apr 2024 16:20:55 +0000
* Date: Sun, 05 May 2024 15:36:30 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5311,8 +5311,8 @@
}
// -------------------------------------------------------------------------
$.terminal = {
version: '2.41.1',
date: 'Mon, 29 Apr 2024 16:20:55 +0000',
version: 'DEV',
date: 'Sun, 05 May 2024 15:36:30 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6759,8 +6759,17 @@
// ---------------------------------------------------------------------
// :: helper function that add new formatter
// ---------------------------------------------------------------------
new_formatter: function(formatter) {
$.terminal.defaults.formatters.unshift(formatter);
new_formatter: function(formatter, before) {
var formatters = $.terminal.defaults.formatters;
if (typeof before !== 'undefined') {
for (var i = 0; i < formatters.length; ++i) {
if (formatters[i] === $.terminal.nested_formatting) {
formatters.splice(i, 0, formatter);
return;
}
}
}
formatters.unshift(formatter);
}
};
(function() {
Expand Down
6 changes: 3 additions & 3 deletions js/jquery.terminal-2.41.1.min.js

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -6759,8 +6759,17 @@
// ---------------------------------------------------------------------
// :: helper function that add new formatter
// ---------------------------------------------------------------------
new_formatter: function(formatter) {
$.terminal.defaults.formatters.unshift(formatter);
new_formatter: function(formatter, before) {
var formatters = $.terminal.defaults.formatters;
if (typeof before !== 'undefined') {
for (var i = 0; i < formatters.length; ++i) {
if (formatters[i] === $.terminal.nested_formatting) {
formatters.splice(i, 0, formatter);
return;
}
}
}
formatters.unshift(formatter);
}
};
(function() {
Expand Down
21 changes: 15 additions & 6 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.41.1
* \/ /____/ version DEV
*
* This file is part of jQuery Terminal. https://terminal.jcubic.pl
*
Expand Down Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 29 Apr 2024 16:20:55 +0000
* Date: Sun, 05 May 2024 15:36:30 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5311,8 +5311,8 @@
}
// -------------------------------------------------------------------------
$.terminal = {
version: '2.41.1',
date: 'Mon, 29 Apr 2024 16:20:55 +0000',
version: 'DEV',
date: 'Sun, 05 May 2024 15:36:30 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6759,8 +6759,17 @@
// ---------------------------------------------------------------------
// :: helper function that add new formatter
// ---------------------------------------------------------------------
new_formatter: function(formatter) {
$.terminal.defaults.formatters.unshift(formatter);
new_formatter: function(formatter, before) {
var formatters = $.terminal.defaults.formatters;
if (typeof before !== 'undefined') {
for (var i = 0; i < formatters.length; ++i) {
if (formatters[i] === $.terminal.nested_formatting) {
formatters.splice(i, 0, formatter);
return;
}
}
}
formatters.unshift(formatter);
}
};
(function() {
Expand Down
6 changes: 3 additions & 3 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.

2 changes: 1 addition & 1 deletion js/prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@
return formatter.name !== name;
});
// disable warning because it may create nested formatting
$.terminal.new_formatter(fn);
$.terminal.new_formatter(fn, $.terminal.nested_formatting);
};
});

0 comments on commit 2f5c1d5

Please sign in to comment.