Added an indentation to generated tables

This commit is contained in:
freearhey 2019-11-03 20:07:43 +03:00
parent 0ba0582fcf
commit 39a12432d7
1 changed files with 7 additions and 7 deletions

View File

@ -151,17 +151,17 @@ helper.skipPlaylist = function(filename) {
} }
helper.generateTable = function(data, options) { helper.generateTable = function(data, options) {
let output = '<table>' let output = '<table>\n'
output += '<thead><tr>' output += '\t<thead>\n\t\t<tr>'
for (let column of options.columns) { for (let column of options.columns) {
output += `<th align="${column.align}">${column.name}</th>` output += `<th align="${column.align}">${column.name}</th>`
} }
output += '</tr></thead>' output += '</tr>\n\t</thead>\n'
output += '<tbody>' output += '\t<tbody>\n'
for (let item of data) { for (let item of data) {
output += '<tr>' output += '\t\t<tr>'
let i = 0 let i = 0
for (let prop in item) { for (let prop in item) {
const column = options.columns[i] const column = options.columns[i]
@ -170,9 +170,9 @@ helper.generateTable = function(data, options) {
output += `<td align="${align}"${nowrap ? ' nowrap' : ''}>${item[prop]}</td>` output += `<td align="${align}"${nowrap ? ' nowrap' : ''}>${item[prop]}</td>`
i++ i++
} }
output += '</tr>' output += '</tr>\n'
} }
output += '</tbody>' output += '\t</tbody>\n'
output += '</table>' output += '</table>'