Use multipĺe tags

This commit is contained in:
Augusto Gunsch 2021-12-26 13:11:21 -03:00
parent 995f49ae14
commit 8c191041a8
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 13 additions and 5 deletions

View File

@ -72,7 +72,7 @@ function generateTable(schemas, pos, forms) {
if(!schema) if(!schema)
return generateList(forms); return generateList(forms);
let html = '<div class="table-responsive">'; let html = '<div class="table-responsive">';
html += '<table class="table table-sm table-bordered border-dark text-center align-middle">'; html += '<table class="table table-sm table-bordered border-dark text-center align-middle">';
schema.rows.forEach(row => { schema.rows.forEach(row => {
@ -90,7 +90,7 @@ function generateTable(schemas, pos, forms) {
}); });
html += '</table>'; html += '</table>';
html += '</div>'; html += '</div>';
let unusedCells = forms.filter(cell => !cell.used); let unusedCells = forms.filter(cell => !cell.used);
@ -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>'
} }