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