mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update update-readme.js
This commit is contained in:
parent
61dbd2a1b3
commit
cf0f2472d1
11 changed files with 653 additions and 461 deletions
|
@ -4,3 +4,4 @@ exports.file = require('./file')
|
|||
exports.parser = require('./parser')
|
||||
exports.timer = require('./timer')
|
||||
exports.xml = require('./xml')
|
||||
exports.markdown = require('./markdown')
|
||||
|
|
39
scripts/core/markdown.js
Normal file
39
scripts/core/markdown.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
const markdownInclude = require('markdown-include')
|
||||
const file = require('./file')
|
||||
|
||||
const markdown = {}
|
||||
|
||||
markdown.createTable = function (data, cols) {
|
||||
let output = '<table>\n'
|
||||
|
||||
output += ' <thead>\n <tr>'
|
||||
for (let column of cols) {
|
||||
output += `<th align="left">${column}</th>`
|
||||
}
|
||||
output += '</tr>\n </thead>\n'
|
||||
|
||||
output += ' <tbody>\n'
|
||||
for (let groupId in data) {
|
||||
const group = data[groupId]
|
||||
for (let [i, item] of group.entries()) {
|
||||
const rowspan = group.length > 1 ? ` rowspan="${group.length}"` : ''
|
||||
output += ' <tr>'
|
||||
if (i === 0) output += `<td align="left" valign="top" nowrap${rowspan}>${item.name}</td>`
|
||||
output += `<td align="right">${item.channels}</td>`
|
||||
output += `<td align="left" nowrap>${item.epg}</td>`
|
||||
output += `<td align="center">${item.status}</td>`
|
||||
output += '</tr>\n'
|
||||
}
|
||||
}
|
||||
output += ' </tbody>\n'
|
||||
|
||||
output += '</table>'
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
markdown.compile = function (filepath) {
|
||||
markdownInclude.compileFiles(file.resolve(filepath))
|
||||
}
|
||||
|
||||
module.exports = markdown
|
Loading…
Add table
Add a link
Reference in a new issue