mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 12:43:48 -04:00
(refactor) factor out generation of example parts
This commit is contained in:
parent
a68a4bad62
commit
89e8ec4576
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<span>
|
||||
<span v-for="part in example[(example.isHonorific ? pronoun.isPluralHonorific(counter) : pronoun.isPlural(counter)) ? 'pluralParts' : 'singularParts']">
|
||||
<span v-for="part in example.parts(pronoun, counter)">
|
||||
<strong v-if="part.variable"><Spelling escape :text="pronoun.getMorpheme(part.str, counter)"/></strong>
|
||||
<span v-else><Spelling :text="part.str"/></span>
|
||||
</span>
|
||||
|
@ -85,7 +85,7 @@
|
||||
<template v-for="isHonorific in [false, true]" v-if="examples.filter(e => e.isHonorific === isHonorific).length">
|
||||
<ul>
|
||||
<li v-for="example in examples" v-if="example.isHonorific === isHonorific">
|
||||
<span v-for="part in clearExampleParts(example[(isHonorific ? selectedPronoun.isPluralHonorific() : selectedPronoun.isPlural()) ? 'pluralParts' : 'singularParts'])">
|
||||
<span v-for="part in clearExampleParts(example.parts(selectedPronoun))">
|
||||
<input v-if="part.variable" v-model="selectedPronoun.morphemes[part.str]"
|
||||
:class="['form-control form-input p-0', {'active': selectedMorpheme === part.str}]"
|
||||
:size="selectedPronoun.morphemes[part.str] ? selectedPronoun.morphemes[part.str].length : 0"
|
||||
|
@ -38,17 +38,18 @@ export class Example {
|
||||
return parts;
|
||||
}
|
||||
|
||||
format(pronoun) {
|
||||
const plural = this.isHonorific ? pronoun.pluralHonorific[0] : pronoun.plural[0];
|
||||
parts(pronoun, counter = 0) {
|
||||
const plural = this.isHonorific ? pronoun.pluralHonorific[counter] : pronoun.plural[counter];
|
||||
return this[plural ? 'pluralParts' : 'singularParts'];
|
||||
}
|
||||
|
||||
return capitalise(this[plural ? 'pluralParts' : 'singularParts'].map(part => {
|
||||
format(pronoun) {
|
||||
return capitalise(this.parts(pronoun).map(part => {
|
||||
return part.variable ? pronoun.getMorpheme(part.str) : part.str;
|
||||
}).join(''));
|
||||
}
|
||||
|
||||
pronounce(pronoun) {
|
||||
const plural = this.isHonorific ? pronoun.pluralHonorific[0] : pronoun.plural[0];
|
||||
|
||||
let interchangable = false;
|
||||
|
||||
const buildPronunciation = m => {
|
||||
@ -73,7 +74,7 @@ export class Example {
|
||||
);
|
||||
}
|
||||
|
||||
const ssml = '<speak>' + this[plural ? 'pluralParts' : 'singularParts'].map(part => {
|
||||
const ssml = '<speak>' + this.parts(pronoun).map(part => {
|
||||
return part.variable
|
||||
? buildPronunciation(part.str)
|
||||
: part.str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user