Skip to content

Commit

Permalink
Better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
drudru committed Aug 15, 2023
1 parent 64a8a82 commit 4f80666
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Readme.md
Expand Up @@ -130,10 +130,10 @@ By default, HTML's reserved characters `& < > " '` are replaced with <a href="ht
This causes the SPAN tags to use classes to style the SPAN tags instead
of specified RGB values.

#### url_acceptlist
#### url_allowlist
(default: { 'http':1, 'https':1 })

This mapping is an 'accept' list of URI schemes that will be allowed to render HTML anchor tags.
This mapping is an 'allow' list of URI schemes that will be allowed to render HTML anchor tags.

#### boldStyle
(default: 'font-weight:bold')
Expand Down
6 changes: 3 additions & 3 deletions ansi_up.d.ts
Expand Up @@ -12,7 +12,7 @@ export declare class AnsiUp {
private _csi_regex;
private _osc_st;
private _osc_regex;
private _url_acceptlist;
private _url_allowlist;
private _escape_html;
private _buffer;
private _boldStyle;
Expand All @@ -22,8 +22,8 @@ export declare class AnsiUp {
constructor();
set use_classes(arg: boolean);
get use_classes(): boolean;
set url_acceptlist(arg: {});
get url_acceptlist(): {};
set url_allowlist(arg: {});
get url_allowlist(): {};
set escape_html(arg: boolean);
get escape_html(): boolean;
set boldStyle(arg: string);
Expand Down
12 changes: 6 additions & 6 deletions ansi_up.js
Expand Up @@ -24,7 +24,7 @@ export class AnsiUp {
this.underline = false;
this.fg = this.bg = null;
this._buffer = '';
this._url_acceptlist = { 'http': 1, 'https': 1 };
this._url_allowlist = { 'http': 1, 'https': 1 };
this._escape_html = true;
this.boldStyle = 'font-weight:bold';
this.faintStyle = 'opacity:0.7';
Expand All @@ -37,11 +37,11 @@ export class AnsiUp {
get use_classes() {
return this._use_classes;
}
set url_acceptlist(arg) {
this._url_acceptlist = arg;
set url_allowlist(arg) {
this._url_allowlist = arg;
}
get url_acceptlist() {
return this._url_acceptlist;
get url_allowlist() {
return this._url_allowlist;
}
set escape_html(arg) {
this._escape_html = arg;
Expand Down Expand Up @@ -409,7 +409,7 @@ export class AnsiUp {
let parts = pkt.url.split(':');
if (parts.length < 1)
return '';
if (!this._url_acceptlist[parts[0]])
if (!this._url_allowlist[parts[0]])
return '';
let result = `<a href="${this.escape_txt_for_html(pkt.url)}">${this.escape_txt_for_html(pkt.text)}</a>`;
return result;
Expand Down
14 changes: 7 additions & 7 deletions ansi_up.ts
Expand Up @@ -77,7 +77,7 @@ export class AnsiUp
private _osc_st:RegExp;
private _osc_regex:RegExp;

private _url_acceptlist:{};
private _url_allowlist:{};
private _escape_html:boolean;

private _buffer:string;
Expand All @@ -102,7 +102,7 @@ export class AnsiUp

this._buffer = '';

this._url_acceptlist = { 'http':1, 'https':1 };
this._url_allowlist = { 'http':1, 'https':1 };
this._escape_html = true;

this.boldStyle = 'font-weight:bold';
Expand All @@ -121,14 +121,14 @@ export class AnsiUp
return this._use_classes;
}

set url_acceptlist(arg:{})
set url_allowlist(arg:{})
{
this._url_acceptlist = arg;
this._url_allowlist = arg;
}

get url_acceptlist():{}
get url_allowlist():{}
{
return this._url_acceptlist;
return this._url_allowlist;
}

set escape_html(arg:boolean)
Expand Down Expand Up @@ -746,7 +746,7 @@ export class AnsiUp
if (parts.length < 1)
return '';

if (! this._url_acceptlist[parts[0]])
if (! this._url_allowlist[parts[0]])
return '';

let result = `<a href="${this.escape_txt_for_html(pkt.url)}">${this.escape_txt_for_html(pkt.text)}</a>`;
Expand Down

0 comments on commit 4f80666

Please sign in to comment.