mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-22 03:57:47 -04:00
save canonical name of templates, use for multiple sources
This commit is contained in:
parent
cad1ec4c61
commit
513720f214
@ -47,6 +47,7 @@ export const parseTemplates = (templatesRaw) => {
|
||||
yield [
|
||||
aliases[0],
|
||||
new Template(
|
||||
aliases[0],
|
||||
t.description,
|
||||
buildDict(function* () {
|
||||
for (let morpheme of MORPHEMES) {
|
||||
|
@ -126,7 +126,8 @@ const escape = s => {
|
||||
}
|
||||
|
||||
export class Template {
|
||||
constructor (description, morphemes, plural, pluralHonorific, sources = [], aliases = [], history = null) {
|
||||
constructor (canonicalName, description, morphemes, plural, pluralHonorific, sources = [], aliases = [], history = null) {
|
||||
this.canonicalName = canonicalName;
|
||||
this.description = description;
|
||||
this.morphemes = morphemes
|
||||
this.plural = plural;
|
||||
@ -156,7 +157,7 @@ export class Template {
|
||||
}
|
||||
|
||||
clone() {
|
||||
return new Template(this.description, clone(this.morphemes), this.plural, this.pluralHonorific);
|
||||
return new Template(this.canonicalName, this.description, clone(this.morphemes), this.plural, this.pluralHonorific);
|
||||
}
|
||||
|
||||
equals(other) {
|
||||
@ -170,6 +171,7 @@ export class Template {
|
||||
}
|
||||
|
||||
return new Template(
|
||||
this.canonicalName + '&' + other.canonicalName,
|
||||
Array.isArray(this.description) ? [...this.description, other.description] : [this.description, other.description],
|
||||
buildDict(function* (that, other) {
|
||||
for (let morpheme of MORPHEMES) {
|
||||
@ -224,7 +226,7 @@ export class Template {
|
||||
m[MORPHEMES[parseInt(i)]] = data[parseInt(i)];
|
||||
}
|
||||
|
||||
return new Template(data[data.length - 1], m, parseInt(data[MORPHEMES.length]) === 1, parseInt(data[MORPHEMES.length + 1]) === 1)
|
||||
return new Template(m.pronoun_n, data[data.length - 1], m, parseInt(data[MORPHEMES.length]) === 1, parseInt(data[MORPHEMES.length + 1]) === 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ export const getSources = (selectedTemplate) => {
|
||||
let sources = {};
|
||||
for (let multiple in sourcesForMultipleForms) {
|
||||
if (sourcesForMultipleForms.hasOwnProperty(multiple)) {
|
||||
if (multiple === selectedTemplate.morphemes.pronoun_n) {
|
||||
if (multiple === selectedTemplate.canonicalName) {
|
||||
sources[multiple] = sourcesForMultipleForms[multiple];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user