Fix apv2, WIP
This commit is contained in:
@@ -90,22 +90,9 @@ export const registerHandlebarsHelpers = function () {
|
||||
return str.toLowerCase();
|
||||
});
|
||||
Handlebars.registerHelper('romanNumber', function (numb) {
|
||||
switch (numb) {
|
||||
case 0:
|
||||
return '';
|
||||
case 1:
|
||||
return 'I';
|
||||
case 2:
|
||||
return 'II';
|
||||
case 3:
|
||||
return 'III';
|
||||
case 4:
|
||||
return 'IV';
|
||||
case 5:
|
||||
return 'V';
|
||||
default:
|
||||
throw new Error('Le handicap rareté doit être comprise entre 0 et 5');
|
||||
}
|
||||
const n = Number(numb);
|
||||
if ( !Number.isFinite(n) || n < 0 ) return '';
|
||||
return ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'][n] ?? '';
|
||||
});
|
||||
|
||||
// search translation with variables
|
||||
@@ -386,7 +373,9 @@ export const registerHandlebarsHelpers = function () {
|
||||
Handlebars.registerHelper('repeat', function (times, start, indexLabel, block) {
|
||||
var accum = '';
|
||||
if (!indexLabel) { indexLabel = "index" }
|
||||
if (!start) { start = 0; }
|
||||
times = Number(times);
|
||||
start = Number(start ?? 0);
|
||||
if ( !Number.isFinite(times) || !Number.isFinite(start) || times < 0 ) return '';
|
||||
for (var i = start; i < times + start; ++i) {
|
||||
block.data[indexLabel] = i;
|
||||
block.data.first = i === start;
|
||||
|
||||
Reference in New Issue
Block a user