emoticons
parent
c3c8cfb4d2
commit
0c90817db4
|
|
@ -68,12 +68,29 @@ class LeFormatter {
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param {string} input @returns {string} */
|
||||||
|
static #toExpression(input) {
|
||||||
|
return input
|
||||||
|
.replace(/[,\n]\s*> <\s*[,\n]/g, ", $SHY$,")
|
||||||
|
.replace(/[,\n]\s*:3\s*[,\n]/g, ", $CAT$,");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @param {string} input @returns {string} */
|
||||||
|
static #fromExpression(input) {
|
||||||
|
return input
|
||||||
|
.replace("$SHY$", "> <")
|
||||||
|
.replace("$CAT$", ":3");
|
||||||
|
}
|
||||||
|
|
||||||
/** @param {string} input @param {boolean} dedupe @param {boolean} removeUnderscore @returns {string} */
|
/** @param {string} input @param {boolean} dedupe @param {boolean} removeUnderscore @returns {string} */
|
||||||
static formatString(input, dedupe, removeUnderscore) {
|
static formatString(input, dedupe, removeUnderscore) {
|
||||||
|
|
||||||
// Remove Underscore
|
// Remove Underscore
|
||||||
input = removeUnderscore ? this.#removeUnderscore(input) : input;
|
input = removeUnderscore ? this.#removeUnderscore(input) : input;
|
||||||
|
|
||||||
|
// Special Tags
|
||||||
|
input = this.#toExpression(input);
|
||||||
|
|
||||||
// Fix Commas inside Brackets
|
// Fix Commas inside Brackets
|
||||||
input = input
|
input = input
|
||||||
.replace(/,+\s*\)/g, '),')
|
.replace(/,+\s*\)/g, '),')
|
||||||
|
|
@ -128,6 +145,8 @@ class LeFormatter {
|
||||||
// Remove empty before Colon
|
// Remove empty before Colon
|
||||||
input = input.replace(/\,\s*\:(\d)/g, ':$1');
|
input = input.replace(/\,\s*\:(\d)/g, ':$1');
|
||||||
|
|
||||||
|
input = this.#fromExpression(input);
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue