From c00a1e827d5dcb25c586406ea1f06a96cf03466b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Tue, 10 Mar 2020 13:39:38 +0100 Subject: [PATCH] sub- og sup-tagger --- src/components/DefElement.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/DefElement.vue b/src/components/DefElement.vue index 37a445c2..03d2e232 100644 --- a/src/components/DefElement.vue +++ b/src/components/DefElement.vue @@ -1,12 +1,14 @@ <template> <li :class="body.type_"><!-- - --><span v-for="(item, index) in assemble_text" + --><span :is="item.tag || 'span'" v-for="(item, index) in assemble_text" :class="item.type" :key="index"><!-- -->{{item.html}}<!-- --><router-link v-if="item.type == 'article_ref'" :to="item.ref" @click.native="article_link_click(item)"><!-- --><span class="homograph" :key="index">{{item.lemmas[0].hgno ? String.fromCharCode(0x215f + item.lemmas[0].hgno) + ' ' : ''}}</span>{{item.lemmas[0].lemma}} {{item.definition_order ? ` (${item.definition_order})` : ''}}<!-- --></router-link><!-- + --><sup v-if="item.type == 'subscript'">{{item.text}}</sup><!-- + --><sup v-if="item.type == 'superscript'">{{item.text}}</sup><!-- --></span></li> </template> @@ -34,6 +36,8 @@ export default { definition_order: item.definition_order } else if (item.type_ == 'pronunciation') return {type: item.type_, html: item.string} + else if (item.type_ == 'superscript') return {type: item.type_, html: item.text, tag: 'sup'} + else if (item.type_ == 'subscript') return {type: item.type_, html: item.text, 'tag': 'sub'} else if (item.id) return {type: item.type_, html: entities[item.id] || languages[item.id] || item.id} else return {type: item.type_ || 'plain', html: item} } -- GitLab