Initial commit for Greenlens
This commit is contained in:
23
format_md.js
Normal file
23
format_md.js
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
function formatPlants(plants) {
|
||||
let md = '# Alle Pflanzen in der Datenbank\n\n';
|
||||
md += '| Name | Botanischer Name | Kategorie | Gießintervall (Tage) | Licht | Temperatur |\n';
|
||||
md += '| :--- | :--- | :--- | :--- | :--- | :--- |\n';
|
||||
|
||||
for (const plant of plants) {
|
||||
const categories = plant.categories.join(', ');
|
||||
const water = plant.careInfo.waterIntervalDays || '-';
|
||||
const light = plant.careInfo.light || '-';
|
||||
const temp = plant.careInfo.temp || '-';
|
||||
md += `| ${plant.name} | *${plant.botanicalName}* | ${categories} | ${water} | ${light} | ${temp} |\n`;
|
||||
}
|
||||
|
||||
return md;
|
||||
}
|
||||
|
||||
const plants = JSON.parse(fs.readFileSync('plants_dump_utf8.json', 'utf8'));
|
||||
const markdown = formatPlants(plants);
|
||||
fs.writeFileSync('ALLE_PFLANZEN.md', markdown);
|
||||
console.log('ALLE_PFLANZEN.md created.');
|
||||
Reference in New Issue
Block a user