chore: reformat with 2 spaces

This commit is contained in:
Johannes Loher 2023-07-10 22:23:13 +02:00
parent d659e4bed9
commit 7670d7f808
No known key found for this signature in database
GPG key ID: 7CB0A9FB553DA045
1577 changed files with 70010 additions and 70042 deletions

View file

@ -3,68 +3,68 @@
// SPDX-License-Identifier: MIT
export function registerHandlebarsHelpers(): void {
Handlebars.registerHelper(helpers);
Handlebars.registerHelper(helpers);
}
const helpers = {
htmlToPlainText: (input: string | null | undefined): string | null | undefined => {
if (!input) return;
return $(input).text();
},
htmlToPlainText: (input: string | null | undefined): string | null | undefined => {
if (!input) return;
return $(input).text();
},
isEmpty: (input: Array<unknown> | null | undefined): boolean => (input?.length ?? 0) === 0,
isEmpty: (input: Array<unknown> | null | undefined): boolean => (input?.length ?? 0) === 0,
toRomanNumerals,
toRomanNumerals,
};
function toRomanNumerals(number: number): string {
return [...generateRomanNumerals(number, 0)].join("");
return [...generateRomanNumerals(number, 0)].join("");
}
function* generateRomanNumerals(number: number, numeralIndex: number): Generator<string> {
if (number === 0) return;
const currentNumeral = numerals[numeralIndex];
if (currentNumeral === undefined) return;
if (number === 0) return;
const currentNumeral = numerals[numeralIndex];
if (currentNumeral === undefined) return;
const quotient = number / currentNumeral;
const remainder = number % currentNumeral;
const numberAsNumerals = numeralLookup[currentNumeral].repeat(quotient);
const quotient = number / currentNumeral;
const remainder = number % currentNumeral;
const numberAsNumerals = numeralLookup[currentNumeral].repeat(quotient);
yield numberAsNumerals;
yield* generateRomanNumerals(remainder, numeralIndex + 1);
yield numberAsNumerals;
yield* generateRomanNumerals(remainder, numeralIndex + 1);
}
const numeralLookup = {
1: "I",
2: "II",
3: "III",
4: "IV",
5: "V",
6: "VI",
7: "VII",
8: "VIII",
9: "IX",
10: "X",
20: "XX",
30: "XXX",
40: "XL",
50: "L",
60: "LX",
70: "LXX",
80: "LXXX",
90: "XC",
100: "C",
200: "CC",
300: "CCC",
400: "CD",
500: "D",
600: "DC",
700: "DCC",
800: "DCCC",
900: "CM",
1000: "M",
1: "I",
2: "II",
3: "III",
4: "IV",
5: "V",
6: "VI",
7: "VII",
8: "VIII",
9: "IX",
10: "X",
20: "XX",
30: "XXX",
40: "XL",
50: "L",
60: "LX",
70: "LXX",
80: "LXXX",
90: "XC",
100: "C",
200: "CC",
300: "CCC",
400: "CD",
500: "D",
600: "DC",
700: "DCC",
800: "DCCC",
900: "CM",
1000: "M",
};
const numerals = [
1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
] as const;

View file

@ -9,52 +9,52 @@
* @returns {Promise<void>} A promise that resolves once all partials have been registered
*/
export async function registerHandlebarsPartials() {
const templatePaths = [
"systems/ds4/templates/sheets/actor/components/actor-header.hbs",
"systems/ds4/templates/sheets/actor/components/actor-progression.hbs",
"systems/ds4/templates/sheets/actor/components/biography.hbs",
"systems/ds4/templates/sheets/actor/components/character-properties.hbs",
"systems/ds4/templates/sheets/actor/components/check.hbs",
"systems/ds4/templates/sheets/actor/components/checks.hbs",
"systems/ds4/templates/sheets/actor/components/combat-value.hbs",
"systems/ds4/templates/sheets/actor/components/combat-values.hbs",
"systems/ds4/templates/sheets/actor/components/core-value.hbs",
"systems/ds4/templates/sheets/actor/components/core-values.hbs",
"systems/ds4/templates/sheets/actor/components/creature-properties.hbs",
"systems/ds4/templates/sheets/actor/components/currency.hbs",
"systems/ds4/templates/sheets/actor/components/description.hbs",
"systems/ds4/templates/sheets/actor/components/effect-list-entry.hbs",
"systems/ds4/templates/sheets/actor/components/effect-list-header.hbs",
"systems/ds4/templates/sheets/actor/components/item-list-entry.hbs",
"systems/ds4/templates/sheets/actor/components/item-list-header.hbs",
"systems/ds4/templates/sheets/actor/components/items-overview.hbs",
"systems/ds4/templates/sheets/actor/components/profile.hbs",
"systems/ds4/templates/sheets/actor/tabs/biography.hbs",
"systems/ds4/templates/sheets/actor/tabs/character-abilities.hbs",
"systems/ds4/templates/sheets/actor/tabs/character-inventory.hbs",
"systems/ds4/templates/sheets/actor/tabs/creature-abilities.hbs",
"systems/ds4/templates/sheets/actor/tabs/creature-inventory.hbs",
"systems/ds4/templates/sheets/actor/tabs/description.hbs",
"systems/ds4/templates/sheets/actor/tabs/effects.hbs",
"systems/ds4/templates/sheets/actor/tabs/spells.hbs",
"systems/ds4/templates/sheets/actor/tabs/values.hbs",
"systems/ds4/templates/sheets/item/components/effect-list-entry.hbs",
"systems/ds4/templates/sheets/item/components/effect-list-header.hbs",
"systems/ds4/templates/sheets/item/components/item-header.hbs",
"systems/ds4/templates/sheets/item/components/properties/armor.hbs",
"systems/ds4/templates/sheets/item/components/properties/equipable.hbs",
"systems/ds4/templates/sheets/item/components/properties/physical.hbs",
"systems/ds4/templates/sheets/item/components/properties/protective.hbs",
"systems/ds4/templates/sheets/item/components/properties/talent.hbs",
"systems/ds4/templates/sheets/item/components/properties/special-creature-ability.hbs",
"systems/ds4/templates/sheets/item/components/properties/spell.hbs",
"systems/ds4/templates/sheets/item/components/properties/weapon.hbs",
"systems/ds4/templates/sheets/item/tabs/description.hbs",
"systems/ds4/templates/sheets/item/tabs/effects.hbs",
"systems/ds4/templates/sheets/item/tabs/properties.hbs",
"systems/ds4/templates/sheets/shared/components/add-button.hbs",
"systems/ds4/templates/sheets/shared/components/control-button-group.hbs",
"systems/ds4/templates/sheets/shared/components/rollable-image.hbs",
];
await loadTemplates(templatePaths);
const templatePaths = [
"systems/ds4/templates/sheets/actor/components/actor-header.hbs",
"systems/ds4/templates/sheets/actor/components/actor-progression.hbs",
"systems/ds4/templates/sheets/actor/components/biography.hbs",
"systems/ds4/templates/sheets/actor/components/character-properties.hbs",
"systems/ds4/templates/sheets/actor/components/check.hbs",
"systems/ds4/templates/sheets/actor/components/checks.hbs",
"systems/ds4/templates/sheets/actor/components/combat-value.hbs",
"systems/ds4/templates/sheets/actor/components/combat-values.hbs",
"systems/ds4/templates/sheets/actor/components/core-value.hbs",
"systems/ds4/templates/sheets/actor/components/core-values.hbs",
"systems/ds4/templates/sheets/actor/components/creature-properties.hbs",
"systems/ds4/templates/sheets/actor/components/currency.hbs",
"systems/ds4/templates/sheets/actor/components/description.hbs",
"systems/ds4/templates/sheets/actor/components/effect-list-entry.hbs",
"systems/ds4/templates/sheets/actor/components/effect-list-header.hbs",
"systems/ds4/templates/sheets/actor/components/item-list-entry.hbs",
"systems/ds4/templates/sheets/actor/components/item-list-header.hbs",
"systems/ds4/templates/sheets/actor/components/items-overview.hbs",
"systems/ds4/templates/sheets/actor/components/profile.hbs",
"systems/ds4/templates/sheets/actor/tabs/biography.hbs",
"systems/ds4/templates/sheets/actor/tabs/character-abilities.hbs",
"systems/ds4/templates/sheets/actor/tabs/character-inventory.hbs",
"systems/ds4/templates/sheets/actor/tabs/creature-abilities.hbs",
"systems/ds4/templates/sheets/actor/tabs/creature-inventory.hbs",
"systems/ds4/templates/sheets/actor/tabs/description.hbs",
"systems/ds4/templates/sheets/actor/tabs/effects.hbs",
"systems/ds4/templates/sheets/actor/tabs/spells.hbs",
"systems/ds4/templates/sheets/actor/tabs/values.hbs",
"systems/ds4/templates/sheets/item/components/effect-list-entry.hbs",
"systems/ds4/templates/sheets/item/components/effect-list-header.hbs",
"systems/ds4/templates/sheets/item/components/item-header.hbs",
"systems/ds4/templates/sheets/item/components/properties/armor.hbs",
"systems/ds4/templates/sheets/item/components/properties/equipable.hbs",
"systems/ds4/templates/sheets/item/components/properties/physical.hbs",
"systems/ds4/templates/sheets/item/components/properties/protective.hbs",
"systems/ds4/templates/sheets/item/components/properties/talent.hbs",
"systems/ds4/templates/sheets/item/components/properties/special-creature-ability.hbs",
"systems/ds4/templates/sheets/item/components/properties/spell.hbs",
"systems/ds4/templates/sheets/item/components/properties/weapon.hbs",
"systems/ds4/templates/sheets/item/tabs/description.hbs",
"systems/ds4/templates/sheets/item/tabs/effects.hbs",
"systems/ds4/templates/sheets/item/tabs/properties.hbs",
"systems/ds4/templates/sheets/shared/components/add-button.hbs",
"systems/ds4/templates/sheets/shared/components/control-button-group.hbs",
"systems/ds4/templates/sheets/shared/components/rollable-image.hbs",
];
await loadTemplates(templatePaths);
}