Global autoformat

This commit is contained in:
Ian Renton
2026-06-19 21:36:11 +01:00
parent edb2641f76
commit 07d0d98f3d
65 changed files with 1250 additions and 844 deletions

View File

@@ -11,13 +11,20 @@ function escapeHtml(str) {
const escapeCharacter = (match) => {
switch (match) {
case '&': return '&';
case '<': return '&lt;';
case '>': return '&gt;';
case '"': return '&quot;';
case '\'': return '&#039;';
case '`': return '&#096;';
default: return match;
case '&':
return '&amp;';
case '<':
return '&lt;';
case '>':
return '&gt;';
case '"':
return '&quot;';
case '\'':
return '&#039;';
case '`':
return '&#096;';
default:
return match;
}
};
@@ -27,7 +34,7 @@ function escapeHtml(str) {
// Converts an HTML hex colour to an array of [R, G, B] where each is 0-255.
function hexToRGB(hex) {
return hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i
,(m, r, g, b) => '#' + r + r + g + g + b + b)
.substring(1).match(/.{2}/g)
.map(x => parseInt(x, 16));
, (m, r, g, b) => '#' + r + r + g + g + b + b)
.substring(1).match(/.{2}/g)
.map(x => parseInt(x, 16));
}