mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 21:46:22 -04:00
(it)(pronouns) improved grammar table
This commit is contained in:
parent
5117614a2f
commit
b4165ccc92
@ -97,9 +97,14 @@ const rowHeaderCount = computed(() => {
|
||||
:pronoun="pronoun"
|
||||
:morpheme="morphemeCell.morpheme"
|
||||
:highlights-morphemes="morphemeCell.highlightsMorphemes"
|
||||
:prepend="morphemeCell.prepend"
|
||||
:counter="counter"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
v-if="grammarTable.columnHeader.length > variant.morphemeCells.length"
|
||||
:colspan="grammarTable.columnHeader.length - variant.morphemeCells.length"
|
||||
></td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
|
@ -1,3 +1,199 @@
|
||||
<script setup lang="ts">
|
||||
import type { Pronoun } from '~/src/classes.ts';
|
||||
import type { GrammarTable, PronounVariant, SectionDefinition } from '~/src/pronouns/grammarTables.ts';
|
||||
|
||||
defineProps<{
|
||||
selectedPronoun: Pronoun;
|
||||
counter: number;
|
||||
}>();
|
||||
|
||||
const grammarTables: GrammarTable[] = [
|
||||
{
|
||||
columnHeader: [
|
||||
{
|
||||
name: 'Nominativo',
|
||||
short: 'N',
|
||||
},
|
||||
{
|
||||
name: 'Dativo',
|
||||
short: 'D',
|
||||
},
|
||||
{
|
||||
name: 'Accusativo',
|
||||
short: 'A',
|
||||
},
|
||||
],
|
||||
sections: [
|
||||
{
|
||||
variants: [
|
||||
{
|
||||
morphemeCells: [
|
||||
'pronoun_n',
|
||||
'pronoun_d',
|
||||
'pronoun_a',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
columnHeader: [
|
||||
{
|
||||
name: 'Singolare',
|
||||
short: 'Sing.',
|
||||
},
|
||||
{
|
||||
name: 'Plurale',
|
||||
short: 'Plur.',
|
||||
},
|
||||
],
|
||||
sections: [
|
||||
{
|
||||
header: {
|
||||
name: 'Accordi finali',
|
||||
short: 'Accordi finali',
|
||||
},
|
||||
variants: [
|
||||
{
|
||||
morphemeCells: [
|
||||
{ morpheme: 'inflection', prepend: '-' },
|
||||
{ morpheme: 'plural_inflection', prepend: '-' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: {
|
||||
name: 'Possessivo',
|
||||
short: 'Possessivo',
|
||||
},
|
||||
variants: [
|
||||
{
|
||||
name: '1a persona',
|
||||
morphemeCells: [
|
||||
{ morpheme: 'possessive_m', prepend: 'm' },
|
||||
{ morpheme: 'plural_possessive_m', prepend: 'm' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '2a persona',
|
||||
morphemeCells: [
|
||||
{ morpheme: 'possessive', prepend: 't' },
|
||||
{ morpheme: 'plural_possessive', prepend: 't' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '3a persona',
|
||||
morphemeCells: [
|
||||
{ morpheme: 'possessive', prepend: 's' },
|
||||
{ morpheme: 'plural_possessive', prepend: 's' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: {
|
||||
name: 'Articolo determinativo',
|
||||
short: 'Articolo determinativo',
|
||||
},
|
||||
variants: [
|
||||
{
|
||||
name: 'come “il”',
|
||||
morphemeCells: [
|
||||
'article',
|
||||
'plural_article',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'come “lo”',
|
||||
morphemeCells: [
|
||||
'article_v',
|
||||
'plural_article_v',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: {
|
||||
name: 'Articolo indeterminativo',
|
||||
short: 'Articolo indeterminativo',
|
||||
},
|
||||
variants: [
|
||||
{
|
||||
name: 'seguito da consonante',
|
||||
morphemeCells: [
|
||||
'indefinite_article',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'seguito da vocale o h muta',
|
||||
morphemeCells: [
|
||||
'indefinite_article_v',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
header: {
|
||||
name: 'Preposizione',
|
||||
short: 'Preposizione',
|
||||
},
|
||||
variants: [
|
||||
{
|
||||
name: 'come “del”',
|
||||
morphemeCells: [
|
||||
{ morpheme: 'articled_preposition', prepend: 'de' },
|
||||
{ morpheme: 'plural_articled_prep', prepend: 'de' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'come “dello”',
|
||||
morphemeCells: [
|
||||
{ morpheme: 'articled_preposition_v', prepend: 'de' },
|
||||
{ morpheme: 'plural_articled_prep_v', prepend: 'de' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'come “al”',
|
||||
morphemeCells: [
|
||||
{ morpheme: 'articled_preposition', prepend: 'a' },
|
||||
{ morpheme: 'plural_articled_prep', prepend: 'a' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'come “allo”',
|
||||
morphemeCells: [
|
||||
{ morpheme: 'articled_preposition_v', prepend: 'a' },
|
||||
{ morpheme: 'plural_articled_prep_v', prepend: 'a' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const expandVariantsForSection = (sectionVariants: SectionDefinition['variants']): PronounVariant[] => {
|
||||
if (Array.isArray(sectionVariants)) {
|
||||
return sectionVariants.map((sectionVariant) => {
|
||||
const morphemeCells = sectionVariant.morphemeCells.map((morphemeCell) => {
|
||||
if (typeof morphemeCell === 'string') {
|
||||
return { morpheme: morphemeCell };
|
||||
}
|
||||
return {
|
||||
...morphemeCell,
|
||||
highlightsMorphemes: morphemeCell.highlightsMorphemes ? new Set(morphemeCell.highlightsMorphemes) : undefined,
|
||||
};
|
||||
});
|
||||
return { ...sectionVariant, morphemeCells };
|
||||
});
|
||||
} else {
|
||||
throw new Error(`variant type ${sectionVariants.type} is unknown`);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section>
|
||||
<h2 class="h4">
|
||||
@ -5,98 +201,13 @@
|
||||
<T>pronouns.grammarTable</T><T>quotation.colon</T>
|
||||
</h2>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nominativo</th>
|
||||
<th>Dativo</th>
|
||||
<th>Accusativo</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="pronoun_n" :counter="counter" /></td>
|
||||
<td><MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="pronoun_d" :counter="counter" /></td>
|
||||
<td><MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="pronoun_a" :counter="counter" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Accordi finali (sing. / plur.)</th>
|
||||
<th>Accordi per i possessivi di 1a pers. (sing. / plur.)</th>
|
||||
<th>Accordi per i possessivi di 2a/3a pers. (sing. / plur.)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="inflection" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_inflection" :counter="counter" />
|
||||
</td>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="possessive_m" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_possessive_m" :counter="counter" />
|
||||
</td>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="possessive" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_possessive" :counter="counter" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Articolo determinativo sing. (come "il" / come "lo")</th>
|
||||
<th>Articolo determinativo plur. (come "i" / come "gli")</th>
|
||||
<th>Articolo indeterminativo (seguito da consonante / seguito da vocale o h muta)</th>
|
||||
<th>Preposizioni articolate sing. (come "del" / come "dello")</th>
|
||||
<th>Preposizioni articolate plur. (come "dei" / come "degli")</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="article" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="article_v" :counter="counter" />
|
||||
</td>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_article" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_article_v" :counter="counter" />
|
||||
</td>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="indefinite_article" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="indefinite_article_v" :counter="counter" />
|
||||
</td>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="articled_preposition" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="articled_preposition_v" :counter="counter" />
|
||||
</td>
|
||||
<td>
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_articled_prep" :counter="counter" /> /
|
||||
<MorphemeWithPronunciation :pronoun="selectedPronoun" morpheme="plural_articled_prep_v" :counter="counter" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<PronounsGrammarTable
|
||||
v-for="(grammarTable, t) in grammarTables"
|
||||
:key="t"
|
||||
:grammar-table="grammarTable"
|
||||
:expand-variants-for-section="expandVariantsForSection"
|
||||
:pronoun="selectedPronoun"
|
||||
:counter="counter"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
selectedPronoun: { required: true },
|
||||
counter: { required: true },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -25,7 +25,8 @@ export interface PronounVariantsFromDeclensionDefinition {
|
||||
|
||||
export interface MorphemeCellDefinition {
|
||||
morpheme: string;
|
||||
highlightsMorphemes: string[];
|
||||
highlightsMorphemes?: string[];
|
||||
prepend?: string;
|
||||
}
|
||||
|
||||
export interface PronounVariant {
|
||||
@ -38,4 +39,5 @@ export interface PronounVariant {
|
||||
export interface MorphemeCell {
|
||||
morpheme: string;
|
||||
highlightsMorphemes?: Set<string>;
|
||||
prepend?: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user