mirror of
https://github.com/tycrek/degoogle.git
synced 2025-08-07 07:26:28 +02:00
Added note parsing ability to _build.js
This commit is contained in:
13
_build.js
13
_build.js
@@ -99,12 +99,14 @@ function generateCategorySection(header, data) {
|
|||||||
function generateServiceSection(data) {
|
function generateServiceSection(data) {
|
||||||
// Start the section with an <h4> header and the start of a Markdown table
|
// 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 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
|
// Iterate over each alternative service and add it to the table
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
// If the object has length one, it's just the title
|
// If the object has length one, it's either title or note
|
||||||
if (Object.keys(item).length == 1) return;
|
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
|
// Build the cells for the table
|
||||||
let name = `[${item.name}](${item.url})`;
|
let name = `[${item.name}](${item.url})`;
|
||||||
let eyes = item.eyes ? `**${item.eyes}-eyes**` : '';
|
let eyes = item.eyes ? `**${item.eyes}-eyes**` : '';
|
||||||
@@ -115,9 +117,10 @@ function generateServiceSection(data) {
|
|||||||
|
|
||||||
// Add the row to the table
|
// Add the row to the table
|
||||||
serviceSection = serviceSection.concat(tableItem + os.EOL)
|
serviceSection = serviceSection.concat(tableItem + os.EOL)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return serviceSection;
|
return serviceSection + notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
__main__();
|
__main__();
|
Reference in New Issue
Block a user