1
0
mirror of https://github.com/tycrek/degoogle.git synced 2025-07-31 04:00:14 +02:00

Added note parsing ability to _build.js

This commit is contained in:
tycrek
2020-05-25 08:00:51 -06:00
parent 9066dbc24f
commit 09a6b0c520

View File

@@ -99,12 +99,14 @@ function generateCategorySection(header, data) {
function generateServiceSection(data) {
// Start the section with an <h4> header and the start of a Markdown table
let serviceSection = `#### ${data[0].title + os.EOL + os.EOL}| Name | Eyes | Description |${os.EOL}| ---- | ---- | ----------- |${os.EOL}`;
let notes = os.EOL + '';
// Iterate over each alternative service and add it to the table
data.forEach(item => {
// If the object has length one, it's just the title
if (Object.keys(item).length == 1) return;
// If the object has length one, it's either title or note
if (Object.keys(item).length == 1) {
if (!item.notes) return;
else item.notes.forEach((note) => notes = notes.concat(`- *${note.trim()}*${os.EOL}`))
} else {
// Build the cells for the table
let name = `[${item.name}](${item.url})`;
let eyes = item.eyes ? `**${item.eyes}-eyes**` : '';
@@ -115,9 +117,10 @@ function generateServiceSection(data) {
// Add the row to the table
serviceSection = serviceSection.concat(tableItem + os.EOL)
}
});
return serviceSection;
return serviceSection + notes;
}
__main__();