0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Add int to char functions

This commit is contained in:
G.Ambatte
2025-03-13 11:59:12 +13:00
parent b67eb59461
commit ee543b7090

View File

@@ -70,6 +70,20 @@ mathParser.functions.toRomansUpper = function (a) {
mathParser.functions.toRomansLower = function (a) {
return romanize(a).toLowerCase();
};
// Add character functions
mathParser.functions.toChar = function (a) {
if(a <= 0) return a;
const genChars = function (i) {
return (i > 26 ? genChars(Math.floor((i - 1) / 26)) : '') + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[(i - 1) % 26];
};
return genChars(a);
};
mathParser.functions.toCharUpper = function (a) {
return mathParser.functions.toChar(a).toUpperCase();
};
mathParser.functions.toCharLower = function (a) {
return mathParser.functions.toChar(a).toLowerCase();
};
//Processes the markdown within an HTML block if it's just a class-wrapper
renderer.html = function (token) {