();
for (const r of rows) {
if (r.tradition && !seen.has(r.tradition))
seen.set(r.tradition, r.source);
}
if (seen.size === 0) return nothing;
return html`
${this.t('Tradition')}
${[...seen].map(
([tradition, source], i) =>
html`${i > 0 ? ' · ' : ''}${humanize(tradition)}${
source
? html`${this.t('Source')}`
: nothing
}`,
)}
`;
}
/**
* Every Hebrew spelling the input can be written as.
*
* @remarks
* Rendered only when there is a choice to show. One spelling is not a set of candidates, and a
* heading over a single row that repeats the word already at the top of the card reads as a bug.
*/
private renderForms(locale: string | undefined, d: Gematria) {
const forms = d.hebrewForms ?? [];
if (forms.length < 2) return nothing;
return html``;
}
/** The standard reading of one candidate spelling, which is what a reader compares the spellings on. */
private renderFormTotals(
locale: string | undefined,
form: HebrewForm,
): unknown {
const first = (form.values ?? []).find((v) => typeof v.value === 'number');
if (!first) return nothing;
return html`
${humanize(first.id ?? '')}
${formatInteger(locale, first.value)}
`;
}
/** AtBash and Albam: the substituted word and what it scores. */
private renderTransformations(
locale: string | undefined,
rows: Gematria['transformations'] | undefined,
) {
const table = rows ?? [];
if (table.length === 0) return nothing;
return html`
${this.t('Substitutions')}
`;
}
/**
* The Latin alphabet ciphers.
*
* @remarks
* Each carries its own lineage sentence and it is kept: it says where the cipher comes from, which
* is what stops a Renaissance Christian or modern cipher being read as a rabbinic one. That is a
* fact about the column rather than a claim about the word, so it is data.
*/
private renderLatin(
locale: string | undefined,
rows: Gematria['latinValues'] | undefined,
) {
const table = rows ?? [];
if (table.length === 0) return nothing;
return html`
${this.t('Latin ciphers')}
`;
}
/** Curated words whose standard value equals the chosen spelling. */
private renderMatches(
locale: string | undefined,
rows: Gematria['matches'] | undefined,
) {
const table = rows ?? [];
if (table.length === 0) return nothing;
return html`
${this.t('Equal values')}
`;
}
/**
* The switches this answer was computed under.
*
* @remarks
* Provenance rather than decoration, the same reason a Vedic chart names its frame: the name
* mispar gadol is used for two different methods, and a total printed without saying which one
* produced it cannot be reconciled against any other calculator.
*/
private renderConventions(conventions: Gematria['conventions'] | undefined) {
const locale = this.effectiveLang();
// Both switches are REQUEST fields, so the published field-label payload
// already names each one and each of its options in the reader's language.
// Reading it is what stops a second translation of the same choice.
const pairs: Array<[string, string]> = [];
for (const key of ['transliteration', 'misparGadol'] as const) {
const value = conventions?.[key];
if (!value) continue;
pairs.push([
displayField(locale, key),
displayOption(locale, key, value),
]);
}
if (pairs.length === 0) return nothing;
return html`
${pairs.map(
([label, value], i) =>
html`${i > 0 ? ' · ' : ''}${label}${value}`,
)}
`;
}
}
declare global {
interface HTMLElementTagNameMap {
'roxy-gematria': RoxyGematria;
}
}