Abstracted tag loading

Using the utility script.
This commit is contained in:
Angelos Chalaris
2018-02-04 19:44:43 +02:00
parent d69b055544
commit 06fbdf5898
4 changed files with 35 additions and 56 deletions

View File

@ -75,23 +75,7 @@ try {
process.exit(1);
}
// Load tag data from the database
try {
tagDbData = objectFromPairs(
fs
.readFileSync('tag_database', 'utf8')
.split('\n')
.slice(0, -1)
.map(v => {
let data = v.split(':').slice(0, 2);
data[1] = data[1].split(',').map(t => t.trim());
return data;
})
);
} catch (err) {
// Handle errors (hopefully not!)
console.log(`${chalk.red('ERROR!')} During tag database loading: ${err}`);
process.exit(1);
}
tagDbData = util.readTags();
// Create the output for the index.html file
try {
// Add the start static part