Use multipĺe tags
This commit is contained in:
parent
995f49ae14
commit
8c191041a8
|
@ -117,9 +117,17 @@ function generateHtml(word, data) {
|
||||||
data.forEach(entry => {
|
data.forEach(entry => {
|
||||||
html += `<h1>${entry.word} <span class="pos">(${entry.pos})</span></h1>`
|
html += `<h1>${entry.word} <span class="pos">(${entry.pos})</span></h1>`
|
||||||
if('senses' in entry) {
|
if('senses' in entry) {
|
||||||
if('tags' in entry.senses[0]) {
|
let tags = [];
|
||||||
html += '<div class="tags">'
|
entry.senses.forEach(sense => {
|
||||||
html += entry.senses[0].tags.map(tag => `<mark>${tag}</mark>`).join(', ');
|
if('tags' in sense) {
|
||||||
|
tags.push(...sense.tags);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(tags.length > 0) {
|
||||||
|
tags = [...new Set(tags)];
|
||||||
|
html += '<div class="tags">Tags: '
|
||||||
|
html += tags.map(tag => `<mark>${tag}</mark>`).join(', ')
|
||||||
html += '</div>'
|
html += '</div>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue