From 18f31db2b01e692d11ce2505ac24d7018211da38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Mon, 29 Mar 2021 13:57:31 +0200 Subject: [PATCH] =?UTF-8?q?re=20meta#286=20bruker=20ekstern=20b=C3=B8yning?= =?UTF-8?q?stabell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + babel.config.js | 5 +- package.json | 34 ++++--- src/components/DictionaryView.vue | 1 - src/components/Header.vue | 90 ++++++++----------- src/components/inflection/Adjective.vue | 47 ---------- src/components/inflection/AdjectiveAdv.vue | 22 ----- src/components/inflection/AdjectiveMF.vue | 49 ---------- src/components/inflection/AdjectiveMF_F.vue | 18 ---- src/components/inflection/Determinative.vue | 34 ------- .../inflection/DeterminativeAdj.vue | 18 ---- src/components/inflection/Noun.vue | 35 -------- src/components/inflection/NounRegFem.vue | 18 ---- src/components/inflection/Pronoun.vue | 21 ----- src/components/inflection/Verb.vue | 51 ----------- src/components/inflection/VerbSPass.vue | 27 ------ 16 files changed, 61 insertions(+), 412 deletions(-) delete mode 100644 src/components/inflection/Adjective.vue delete mode 100644 src/components/inflection/AdjectiveAdv.vue delete mode 100644 src/components/inflection/AdjectiveMF.vue delete mode 100644 src/components/inflection/AdjectiveMF_F.vue delete mode 100644 src/components/inflection/Determinative.vue delete mode 100644 src/components/inflection/DeterminativeAdj.vue delete mode 100644 src/components/inflection/Noun.vue delete mode 100644 src/components/inflection/NounRegFem.vue delete mode 100644 src/components/inflection/Pronoun.vue delete mode 100644 src/components/inflection/Verb.vue delete mode 100644 src/components/inflection/VerbSPass.vue diff --git a/.gitignore b/.gitignore index a0dddc6f..da9593d5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ yarn-error.log* *.njsproj *.sln *.sw? + + +package-lock.json diff --git a/babel.config.js b/babel.config.js index ba179669..37e6619b 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,6 @@ module.exports = { presets: [ - '@vue/app' - ] + '@vue/cli-plugin-babel/preset' + ], + plugins: ["@babel/plugin-proposal-nullish-coalescing-operator", "@babel/plugin-proposal-optional-chaining"] } diff --git a/package.json b/package.json index 67312573..40fed025 100644 --- a/package.json +++ b/package.json @@ -9,28 +9,31 @@ }, "dependencies": { "axios": "^0.19.2", - "core-js": "^2.6.11", - "debounce": "^1.2.0", - "vue": "^2.6.11", + "core-js": "^3.6.5", + "debounce": "^1.2.1", + "inflection-table": "https://git.app.uib.no/api/v4/projects/16442/jobs/artifacts/0.2.14/raw/module.tar.gz?job=publish", + "vue": "^2.6.12", "vue-awesome": "^3.5.4", "vue-material-design-icons": "^4.11.0", - "vue-plausible": "^1.0.0", - "vue-router": "^3.4.1", - "vuetify": "^2.4.0" + "vue-plausible": "^1.1.4", + "vue-router": "^3.5.1", + "vuetify": "^2.4.8" }, "devDependencies": { - "@vue/cli-plugin-babel": "^3.12.1", - "@vue/cli-plugin-eslint": "^3.12.1", - "@vue/cli-service": "^3.12.1", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", + "@babel/plugin-proposal-optional-chaining": "^7.13.12", + "@vue/cli-plugin-babel": "^4.5.12", + "@vue/cli-plugin-eslint": "~4.5.0", + "@vue/cli-service": "~4.5.0", "babel-eslint": "^10.1.0", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", "material-design-icons-iconfont": "^6.1.0", - "sass": "^1.32.0", + "sass": "^1.32.8", "sass-loader": "^10.0.0", - "vue-cli-plugin-vuetify": "~2.1.0", - "vue-template-compiler": "^2.6.11", - "vuetify-loader": "^1.7.0" + "vue-cli-plugin-vuetify": "^2.1.1", + "vue-template-compiler": "^2.6.12", + "vuetify-loader": "^1.7.2" }, "eslintConfig": { "root": true, @@ -41,7 +44,10 @@ "plugin:vue/essential", "eslint:recommended" ], - "rules": {}, + "rules": { + "no-irregular-whitespace": "off", + "no-unused-vars": "off" + }, "parserOptions": { "parser": "babel-eslint" } diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index 9417f8b8..6aa470ff 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -93,7 +93,6 @@ function navigate_to_article(self, source) { self.error = "Vi har ingen artikkel med id " + self.$route.params.id } else { self.error = "Noe gikk galt..." - console.log(error) } }) .then(function(response){ diff --git a/src/components/Header.vue b/src/components/Header.vue index c6c85bf4..56c75fed 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -5,17 +5,8 @@ {{group_list}} <details :title="inflect_tooltip" @toggle="toggle()" v-if="group_list" :class="$vuetify.breakpoint.name"> <summary :class="dictionary" onclick="this.blur()">bøying</summary> - <div class="inflection-wrapper"> - <div class="inflection"> - <div v-for="(lemma, index) in inflection_groups_by_lemma" :key="index"> - <h4>{{lemma.lemma}}</h4> - <component v-for="grp in Object.keys(lemma.inflection_groups)" - :key="grp.replace('/', '_')" - :is="grp.replace('/', '_')" - :dictionary="dictionary" - :standardisations="lemma.inflection_groups[grp]"></component> - </div> - </div> + <div class="inflection-canvas"> + <inflectionTable :lemmaList="lemmas_with_word_class_and_lang" :mq="$vuetify.breakpoint.name" /> </div> </details> <span class="dict-label">{{dict_label}}</span> @@ -25,17 +16,8 @@ <script> /* eslint-disable */ import helpers from '../utils/helpers.js' -import ADJ from './inflection/Adjective.vue' -import ADJ_adv from './inflection/AdjectiveAdv.vue' -import ADJ_masc_fem from './inflection/AdjectiveMF.vue' -import ADJ_masc_fem_fem from './inflection/AdjectiveMF_F.vue' -import DET from './inflection/Determinative.vue' -import DET_adj from './inflection/DeterminativeAdj.vue' -import PRON from './inflection/Pronoun.vue' -import NOUN from './inflection/Noun.vue' -import NOUN_reg_fem from './inflection/NounRegFem.vue' -import VERB from './inflection/Verb.vue' -import VERB_sPass from './inflection/VerbSPass.vue' + +import inflectionTable from 'inflection-table' export default { name: 'Header', @@ -72,20 +54,14 @@ export default { } } ) + }, + lemmas_with_word_class_and_lang: function() { + return this.lemmas.map(lemma => Object.assign({language: this.dictionary == 'bob' ? 'nob' : 'nno', + word_class: lemma.paradigm_info[0].inflection_group.split('_')[0]}, lemma)) } }, components: { - ADJ, - ADJ_adv, - ADJ_masc_fem, - ADJ_masc_fem_fem, - DET, - DET_adj, - PRON, - NOUN, - NOUN_reg_fem, - VERB, - VERB_sPass + inflectionTable }, data: function() { return { @@ -201,46 +177,50 @@ details[open] summary ~ * { animation: open 0.3s ease-in-out; } -.inflection-wrapper { +.inflection-canvas { overflow-x: auto; position: absolute; z-index: 10; background-color: rgba(255, 255, 255, 0); max-width: 100vw; + padding-top: 10px; } - -.inflection table { - border-collapse: collapse; - margin: 10px; +details > summary::-webkit-details-marker { + display: none; } -.inflection td, .inflection th { - border: solid; - border-width: 1px; - margin: 0px 0px 0px 0px; - padding: 3px; +.infl-wrapper { + background-color: #ffffff; + border: solid 1px; + color: var(--v-primary-base); + border-color: var(--v-primary-base); + border-radius: 30px; + padding: 30px; + width: max-content; + margin: 5px; } +.context { + color: var(--v-primary-lighten4) !important; +} -details > summary::-webkit-details-marker { +div.lemma { display: none; } -.inflection { - color: var(--v-primary-base); +table { + border-collapse: collapse; margin-top: 5px; - background-color: #ffffff; - width: max-content; - border-radius: 30px; - padding: 10px; - margin: 10px; - border-style: solid; - border-width: 1px; - border-color: var(--primary-base) } -article:not(.righ_hand_column) .inflection-wrapper { +th, td { + border: solid 1px; + border-color: var(--v-primary-base); + padding: 5px; +} + +article:not(.righ_hand_column) .inflection-canvas { left: -35px; } diff --git a/src/components/inflection/Adjective.vue b/src/components/inflection/Adjective.vue deleted file mode 100644 index 88ace29c..00000000 --- a/src/components/inflection/Adjective.vue +++ /dev/null @@ -1,47 +0,0 @@ -<template> - <table> - <tr> - <th rowspan="2">Adjektiv</th> - <th colspan="3">{{i18n[0]}}</th> - <th>{{i18n[1]}}</th> - <th colspan="3">Gradbøying</th> - </tr> - <tr> - <th>Han/{{i18n[2]}}kjønn</th> - <th>{{i18n[3]}}kjønn</th> - <th>B{{i18n[4]}} form</th> - <th></th> - <th>Komparativ</th> - <th>Superlativ</th> - <th>Superlativ, b{{i18n[4]}} form</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <td></td> - <td>{{std.inflection[0].word_form}}</td> - <td>{{std.inflection[3].word_form}}</td> - <td>{{std.inflection[2].word_form}}</td> - <td>{{std.inflection[1].word_form}}</td> - <td>{{std.inflection[4].word_form}}</td> - <td>{{std.inflection[5].word_form}}</td> - <td>{{std.inflection[6].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "ADJ", - props: { - standardisations: Array, - dictionary: String - }, - computed: { - i18n: function() { - return { - bob: ['Entall', 'Flertall', 'Hun', 'Intet', 'estemt'], - nob: ['Eintal', 'Fleirtal', 'Ho', 'Inkje', 'unden'] - }[this.dictionary] - } - } -} -</script> diff --git a/src/components/inflection/AdjectiveAdv.vue b/src/components/inflection/AdjectiveAdv.vue deleted file mode 100644 index 37f60771..00000000 --- a/src/components/inflection/AdjectiveAdv.vue +++ /dev/null @@ -1,22 +0,0 @@ -<template> - <table> - <tr> - <th>Adjektiv, adverbtype</th><th>Positiv</th><th>Komparativ</th><th>Superlativ</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <td></td> - <td>{{std.inflection[0].word_form}}</td> - <td>{{std.inflection[1].word_form}}</td> - <td>{{std.inflection[2].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "ADJ_adv", - props: { - standardisations: Array - } -} -</script> diff --git a/src/components/inflection/AdjectiveMF.vue b/src/components/inflection/AdjectiveMF.vue deleted file mode 100644 index daea6517..00000000 --- a/src/components/inflection/AdjectiveMF.vue +++ /dev/null @@ -1,49 +0,0 @@ -<template> - <table> - <tr> - <th rowspan="2">Adjektiv</th> - <th colspan="4">{{i18n[0]}}</th> - <th>{{i18n[1]}}</th> - <th colspan="3">Gradbøying</th> - </tr> - <tr> - <th>Hankjønn</th> - <th>{{i18n[2]}}kjønn</th> - <th>{{i18n[3]}}kjønn</th> - <th>B{{i18n[4]}} form</th> - <th></th> - <th>Komparativ</th> - <th>Superlativ</th> - <th>Superlativ, b{{i18n[4]}} form</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <td></td> - <td>{{std.inflection[0].word_form}}</td> - <td>{{std.inflection[1].word_form}}</td> - <td>{{std.inflection[2].word_form}}</td> - <td>{{std.inflection[3].word_form}}</td> - <td>{{std.inflection[4].word_form}}</td> - <td>{{std.inflection[5].word_form}}</td> - <td>{{std.inflection[6].word_form}}</td> - <td>{{std.inflection[7].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "ADJ_masc_fem", - props: { - standardisations: Array, - dictionary: String - }, - computed: { - i18n: function() { - return { - bob: ['Entall', 'Flertall', 'Hun', 'Intet', 'estemt'], - nob: ['Eintal', 'Fleirtal', 'Ho', 'Inkje', 'unden'] - }[this.dictionary] - } - } -} -</script> diff --git a/src/components/inflection/AdjectiveMF_F.vue b/src/components/inflection/AdjectiveMF_F.vue deleted file mode 100644 index db155c94..00000000 --- a/src/components/inflection/AdjectiveMF_F.vue +++ /dev/null @@ -1,18 +0,0 @@ -<template> - <ADJ_masc_fem :standardisations="standardisations" :dictionary="dictionary"></ADJ_masc_fem> -</template> - -<script> -import ADJ_masc_fem from './AdjectiveMF.vue' - -export default { - name: "ADJ_masc_fem_fem", - props: { - standardisations: Array, - dictionary: String - }, - components: { - ADJ_masc_fem - } -} -</script> diff --git a/src/components/inflection/Determinative.vue b/src/components/inflection/Determinative.vue deleted file mode 100644 index f1ff082f..00000000 --- a/src/components/inflection/Determinative.vue +++ /dev/null @@ -1,34 +0,0 @@ -<template> - <table> - <tr> - <th rowspan="2">Determinativ</th><th colspan="3">{{i18n[0]}}</th><th rowspan="2">{{i18n[1]}}</th> - </tr> - <tr> - <th>Hankjønn</th><th>{{i18n[2]}}kjønn</th><th>{{i18n[3]}}kjønn</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <td></td> - <td>{{std.inflection[0].word_form}}</td> - <td>{{std.inflection[1].word_form}}</td> - <td>{{std.inflection[2].word_form}}</td> - <td>{{std.inflection[3].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "DET", - props: { - standardisations: Array - }, - computed: { - i18n: function() { - return { - bob: ['Entall', 'Flertall', 'Hun', 'Intet'], - nob: ['Eintal', 'Fleirtal', 'Ho', 'Inkje'] - }[this.$route.params.lang] - } - } -} -</script> diff --git a/src/components/inflection/DeterminativeAdj.vue b/src/components/inflection/DeterminativeAdj.vue deleted file mode 100644 index 1eebc748..00000000 --- a/src/components/inflection/DeterminativeAdj.vue +++ /dev/null @@ -1,18 +0,0 @@ -<template> - <DET :standardisations="standardisations" :dictionary="dictionary"></DET> -</template> - -<script> -import DET from './Determinative.vue' - -export default { - name: "DET_adj", - props: { - standardisations: Array, - dictionary: String - }, - components: { - DET - } -} -</script> diff --git a/src/components/inflection/Noun.vue b/src/components/inflection/Noun.vue deleted file mode 100644 index 78328bd0..00000000 --- a/src/components/inflection/Noun.vue +++ /dev/null @@ -1,35 +0,0 @@ -<template> - <table> - <tr> - <th rowspan="2">Substantiv</th><th colspan="2">{{i18n[0]}}</th><th colspan="2">{{i18n[1]}}</th> - </tr> - <tr> - <th>{{i18n[2]}}</th><th>{{i18n[3]}}</th><th>{{i18n[2]}}</th><th>{{i18n[3]}}</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <th>{{i18n[4][std.tags[1]][0]}}</th> - <td>{{i18n[4][std.tags[1]][1]}} {{std.inflection[0].word_form}}</td> - <td>{{std.inflection[1].word_form}}</td> - <td>{{std.inflection[2].word_form}}</td> - <td>{{std.inflection[3].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "NOUN", - props: { - standardisations: Array, - dictionary: String - }, - computed: { - i18n: function() { - return { - bob: ['Entall', 'Flertall', 'Ubestemt', 'Bestemt', {Masc: ['mask.', 'en'], Fem: ['fem.', 'ei'], Neuter: ['nøytr.', 'et']}], - nob: ['Eintal', 'Fleirtal', 'Ubunden', 'Bunden', {Masc: ['mask.', 'ein'], Fem: ['fem.', 'ei'], Neuter: ['nøytr.', 'eit']}] - }[this.dictionary] - } - } -} -</script> diff --git a/src/components/inflection/NounRegFem.vue b/src/components/inflection/NounRegFem.vue deleted file mode 100644 index d825fe1c..00000000 --- a/src/components/inflection/NounRegFem.vue +++ /dev/null @@ -1,18 +0,0 @@ -<template> - <NOUN :standardisations="standardisations" :dictionary="dictionary"></NOUN> -</template> - -<script> -import NOUN from './Noun.vue' - -export default { - name: "NOUN_reg_fem", - props: { - standardisations: Array, - dictionary: String - }, - components: { - NOUN - } -} -</script> diff --git a/src/components/inflection/Pronoun.vue b/src/components/inflection/Pronoun.vue deleted file mode 100644 index 6e7a9ac6..00000000 --- a/src/components/inflection/Pronoun.vue +++ /dev/null @@ -1,21 +0,0 @@ -<template> - <table> - <tr> - <th>Pronomen</th><th>Subjektsform</th><th>Objektsform</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <td></td> - <td>{{std.inflection[0].word_form}}</td> - <td>{{std.inflection[1].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "PRON", - props: { - standardisations: Array - } -} -</script> diff --git a/src/components/inflection/Verb.vue b/src/components/inflection/Verb.vue deleted file mode 100644 index c14cb634..00000000 --- a/src/components/inflection/Verb.vue +++ /dev/null @@ -1,51 +0,0 @@ -<template> - <table> - <tr> - <th rowspan="2">Verb</th> - <th rowspan="2">Infinitiv</th> - <th rowspan="2">Presens</th> - <th rowspan="2">Preteritum</th> - <th rowspan="2">Presens perfektum</th> - <th rowspan="2">Imperativ</th> - <th colspan="4">Perfektum partisipp</th> - <th rowspan="2">Presens partisipp</th> - </tr> - <tr> - <th>Han/{{i18n[0]}}kjønn</th> - <th>{{i18n[1]}}kjønn</th> - <th>{{i18n[2]}} form</th> - <th>{{i18n[3]}}</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <th></th> - <td>å<span v-html="' '"></span>{{std.inflection[0].word_form + (std.inflection[1].word_form ? '/' + std.inflection[1].word_form : '')}}</td> - <td>{{std.inflection[2].word_form}}</td> - <td>{{std.inflection[5].word_form}}</td> - <td>har {{std.inflection[6].word_form}}</td> - <td>{{std.inflection[13].word_form}}!</td> - <td>{{std.inflection[8].word_form}}</td> - <td>{{std.inflection[7].word_form}}</td> - <td>{{std.inflection[10].word_form}}</td> - <td>{{std.inflection[11].word_form}}</td> - <td>{{std.inflection[12].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "VERB", - props: { - standardisations: Array, - dictionary: String - }, - computed: { - i18n: function() { - return { - bob: ['hun', 'Intet', 'Bestemt', 'Flertall'], - nob: ['ho', 'Inkje', 'Bunden', 'Fleirtal'] - }[this.dictionary] - } - } -} -</script> diff --git a/src/components/inflection/VerbSPass.vue b/src/components/inflection/VerbSPass.vue deleted file mode 100644 index d0b96e32..00000000 --- a/src/components/inflection/VerbSPass.vue +++ /dev/null @@ -1,27 +0,0 @@ -<template> - <table> - <tr> - <th>Verb</th> - <th>Infinitiv</th> - <th>Presens</th> - <th>Preteritum</th> - <th>Presens perfektum</th> - </tr> - <tr v-for="(std, index) in standardisations" :key="index"> - <td></td> - <td>å {{std.inflection[0].word_form}}</td> - <td>{{std.inflection[1].word_form}}</td> - <td>{{std.inflection[2].word_form}}</td> - <td>{{std.inflection[3].word_form}}</td> - </tr> - </table> -</template> - -<script> -export default { - name: "VERB_sPass", - props: { - standardisations: Array - } -} -</script> -- GitLab