forked from devol/degooglizzazione
Only add Markdown table headers if there is data to be displayed
This commit is contained in:
parent
4d94944e49
commit
d27b9885b7
@ -100,9 +100,12 @@ function generateCategorySection(header, data) {
|
||||
* @param {Array} 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}`;
|
||||
// Start the section with an <h4> header
|
||||
let serviceSection = `#### ${data[0].title + os.EOL + os.EOL}`;
|
||||
let notes = os.EOL + '';
|
||||
// If there is data to be displayed, add the start of a Markdown table
|
||||
let tableHeader = `| Name | Eyes | Description |${os.EOL}| ---- | ---- | ----------- |${os.EOL}`;
|
||||
if (data.filter(d => "name" in d).length > 0) serviceSection = serviceSection.concat(tableHeader);
|
||||
// Iterate over each alternative service and add it to the table
|
||||
data.forEach(item => {
|
||||
// If the object has length one, it's either title or note
|
||||
|
Loading…
x
Reference in New Issue
Block a user