Newer
Older
<Header :lemmas="article.lemmas" :dictionary="dictionary" :article_id="article.article_id" />

Ole Voldsæter
committed
<div class="article_content" :class="$vuetify.breakpoint.name">
<section v-if="article.body.pronunciation && article.body.pronunciation.length" class="pronunciation">
<h3>Uttale</h3>
<ul>
<DefElement v-for="(element, index) in article.body.pronunciation" :dictionary="dictionary" :key="index" :body='element' @article-click="article_link_click" />
</ul>
</section>
<section v-if="article.body.etymology && article.body.etymology.length" class="etymology">
<ul>
<DefElement v-for="(element, index) in article.body.etymology" :dictionary="dictionary" :key="index" :body='element' @article-click="article_link_click" />
</ul>
</section>
<section class="definitions" v-if="has_content">
<h3>{{def_label}}</h3>
<ol>
<Definition v-for="definition in article.body.definitions" :dictionary="dictionary" :level="1" :key="definition.id" :body='definition' @article-click="article_link_click" />
</ol>
</section>

Ole Voldsæter
committed
<section v-if="sub_articles.length" class="expressions">
<h3>Faste uttrykk</h3>

Ole Voldsæter
committed
<SubArticle :body="subart" v-for="(subart, index) in sub_articles" :dictionary="dictionary" :key="index" @article-click="article_link_click" />

Ole Voldsæter
committed
</section>
<div class="fade">
<router-link :to="link_to_self.ref" @click.native="details_click(link_to_self)">
Velg <img class="nav_arrow" src="../assets/arrow_right.svg">

Ole Voldsæter
committed
</router-link>
</div>
</div>
<script src="/dist/vue-social-sharing.js"></script>
import Definition from './Definition.vue'
function find_sub_articles(definition) {
let sub_art_list = []
let sub_definitions = definition.elements.filter(el => el.type_ == 'definition')
sub_definitions.forEach((subdef, i) => {
sub_art_list = sub_art_list.concat(find_sub_articles(subdef))
})
let sub_articles = definition.elements.filter(el => el.type_ == 'sub_article')
sub_art_list = sub_art_list.concat(sub_articles)
return sub_art_list
}
function find_content(definition) {
let content_list = []
let sub_definitions = definition.elements.filter(el => el.type_ == 'definition')
sub_definitions.forEach((subdef, i) => {
content_list = content_list.concat(find_content(subdef))
})
let content_nodes = definition.elements.filter(el => ['explanation', 'example', 'compound_list'].includes(el.type_))
content_list = content_list.concat(content_nodes)
return content_list
}

Ole Voldsæter
committed
link_to_self: function() {

Ole Voldsæter
committed
ref: '/' + this.dictionary + '/' + this.article.article_id + '/' + encodeURIComponent(this.article.lemmas[0].lemma),
article: this.article

Ole Voldsæter
committed
}
},

Ole Voldsæter
committed
},
def_label: function() {
return this.dictionary == 'bob' ? 'Betydning og bruk' : 'Tyding og bruk'
},
example_label: function() {
return this.dictionary == 'bob' ? 'Eksempel' : 'Døme'
},
sub_articles: function() {
return this.article.body.definitions.reduce((acc, val) => acc.concat(find_sub_articles(val)), []).sort((s1, s2) => s1.lemmas[0].localeCompare(s2.lemmas[0]))
},
has_content: function() {
return this.article.body.definitions.reduce((acc, val) => acc.concat(find_content(val)), []).length > 0

Ole Voldsæter
committed
},
methods: {
article_link_click: function(item) {
this.$emit('article-click', item)
},
details_click: function(item) {
this.$emit('details-click', item)
border-radius: 30px;
border: solid 1px var(--v-primary-base);
background-color: var(--v-tertiary-base);
#single_article_container article {
border-style: none;
}

Ole Voldsæter
committed
.fade {
display: none;
}
section.etymology > h3, section.pronunciation > h3 {
display: inline;
font-size: 14px;
}
section.etymology ul, section.pronunciation ul, section.etymology li, section.pronunciation li {
display: inline;
}
section.etymology li:not(:first-child):not(:last-child):before, section.pronunciation li:not(:first-child):not(:last-child):before {
}
section.etymology li:not(:first-child):last-child:before, section.pronunciation li:not(:first-child):last-child:before {
content: " eller ";
font-style: italic;
font-size: smaller;
}
li {
padding-bottom: 4px;
}
li.level1.definition {
list-style: upper-alpha;
}
li.level2.definition {
list-style: decimal;
}
li.level3.definition {
/* Norsk ordbok skal ha "lower.alpha" her */
list-style: disc;
}
li.sub_article > ul {
padding-left: 0px;
}
::marker {
font-weight: bold;
}
ol > li:only-child.level1, li:only-child.level2 {
/* level3 a.k.a. underdefinisjoner skal vises med bullet selv om de står alene */
list-style: none;
}
li:only-child.level1 > ol {
padding-left: 0px;
}
}
ul li.definition {
list-style: disc;
.fade .nav_arrow {
vertical-align: sub;
}