mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-22 12:03:25 -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 [
|
yield [
|
||||||
aliases[0],
|
aliases[0],
|
||||||
new Template(
|
new Template(
|
||||||
|
aliases[0],
|
||||||
t.description,
|
t.description,
|
||||||
buildDict(function* () {
|
buildDict(function* () {
|
||||||
for (let morpheme of MORPHEMES) {
|
for (let morpheme of MORPHEMES) {
|
||||||
|
@ -126,7 +126,8 @@ const escape = s => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Template {
|
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.description = description;
|
||||||
this.morphemes = morphemes
|
this.morphemes = morphemes
|
||||||
this.plural = plural;
|
this.plural = plural;
|
||||||
@ -156,7 +157,7 @@ export class Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clone() {
|
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) {
|
equals(other) {
|
||||||
@ -170,6 +171,7 @@ export class Template {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Template(
|
return new Template(
|
||||||
|
this.canonicalName + '&' + other.canonicalName,
|
||||||
Array.isArray(this.description) ? [...this.description, other.description] : [this.description, other.description],
|
Array.isArray(this.description) ? [...this.description, other.description] : [this.description, other.description],
|
||||||
buildDict(function* (that, other) {
|
buildDict(function* (that, other) {
|
||||||
for (let morpheme of MORPHEMES) {
|
for (let morpheme of MORPHEMES) {
|
||||||
@ -224,7 +226,7 @@ export class Template {
|
|||||||
m[MORPHEMES[parseInt(i)]] = data[parseInt(i)];
|
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 = {};
|
let sources = {};
|
||||||
for (let multiple in sourcesForMultipleForms) {
|
for (let multiple in sourcesForMultipleForms) {
|
||||||
if (sourcesForMultipleForms.hasOwnProperty(multiple)) {
|
if (sourcesForMultipleForms.hasOwnProperty(multiple)) {
|
||||||
if (multiple === selectedTemplate.morphemes.pronoun_n) {
|
if (multiple === selectedTemplate.canonicalName) {
|
||||||
sources[multiple] = sourcesForMultipleForms[multiple];
|
sources[multiple] = sourcesForMultipleForms[multiple];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user