diff --git a/docs/tariffs.mdx b/docs/tariffs.mdx index 760824c1a6..9aa3139ed9 100644 --- a/docs/tariffs.mdx +++ b/docs/tariffs.mdx @@ -650,24 +650,24 @@ Daher musst du ggf. das Update-Intervall (`interval`) erhöhen. + - type: template + template: forecast-solar + lat: 55.7351 + lon: 9.1275 + dec: 25 # 0 = horizontal, 90 = vertikal + kwp: 9.8 + az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden + horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simuliert Verschattung durch Gelände, [mehr Informationen](https://doc.forecast.solar/horizon) (optional) + apikey: # optional + interval: 1h # optional`} /> @@ -681,28 +681,28 @@ Freie Wetter API [open-meteo.com](https://open-meteo.com) Open-Meteo ist eine Op + - type: template + template: open-meteo + lat: 55.7351 + lon: 9.1275 + dec: 25 # 0 = horizontal, 90 = vertikal + kwp: 9.8 + az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden + ac: 1000 # optional + dm: 0 # optional + de: 0 # optional + efficiency: 100 # optional + alphatemp: -0.004 # optional + rossmodel: 0.0342 # Gut Gekühlt (0.0200), Freistehend (0.0208), Flach auf Dach (0.0260), Nicht So Gut Gekühlt (0.0342), Transparentes PV (0.0455), Fassadenintegriert (0.0538), Auf Schrägdach (0.0563) [Paper](https://www.sciencedirect.com/science/article/pii/S0038092X20309107) (optional) + interval: 1h # optional`} /> @@ -716,16 +716,16 @@ Benötigt einen [solcast.com](https://solcast.com/free-rooftop-solar-forecasting + - type: template + template: solcast + site: # Ressource ID deiner Anlage + token: # Solcast API Token + interval: 3h # optional`} /> diff --git a/i18n/en/docusaurus-plugin-content-docs/current/tariffs.mdx b/i18n/en/docusaurus-plugin-content-docs/current/tariffs.mdx index d48dfb7a7e..6f356975f0 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/tariffs.mdx +++ b/i18n/en/docusaurus-plugin-content-docs/current/tariffs.mdx @@ -658,24 +658,24 @@ Therefore, you may need to increase the update `interval`. + - type: template + template: forecast-solar + lat: 55.7351 + lon: 9.1275 + dec: 25 # 0 = horizontal, 90 = vertical + kwp: 9.8 + az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north + horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simulates terrain shadows, [more information](https://doc.forecast.solar/horizon) (optional) + apikey: # optional + interval: 1h # optional`} /> @@ -689,28 +689,28 @@ Free Weather API [open-meteo.com](https://open-meteo.com) Open-Meteo is an open- + - type: template + template: open-meteo + lat: 55.7351 + lon: 9.1275 + dec: 25 # 0 = horizontal, 90 = vertical + kwp: 9.8 + az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north + ac: 1000 # optional + dm: 0 # optional + de: 0 # optional + efficiency: 100 # optional + alphatemp: -0.004 # optional + rossmodel: 0.0342 # Well Cooled (0.0200), Free Standing (0.0208), Flat on Roof (0.0260), Not So Well Cooled (0.0342), Transparent PV (0.0455), Facade Integrated (0.0538), On Sloped Roof (0.0563) [Paper](https://www.sciencedirect.com/science/article/pii/S0038092X20309107) (optional) + interval: 1h # optional`} /> @@ -724,16 +724,16 @@ Requires a [solcast.com](https://solcast.com/free-rooftop-solar-forecasting) acc + - type: template + template: solcast + site: # ressource ID of your site + token: # Solcast API Token + interval: 3h # optional`} /> diff --git a/src/generateFromTemplate.js b/src/generateFromTemplate.js index fd9dd31f78..77e45c1b59 100644 --- a/src/generateFromTemplate.js +++ b/src/generateFromTemplate.js @@ -97,11 +97,21 @@ function readTemplates(path) { .map((file) => yaml.load(fs.readFileSync(`${path}/${file}`, "utf8"))); } -function indent(code) { +function indent(code, list = false) { // escape backticks - result = code.replace(/`/g, "\\`"); - // indent - return result.replace(/^/gm, " "); + let result = code.replace(/`/g, "\\`"); + + if (list) { + // indent first line with 6 spaces and dash + result = result.replace(/^/, " - "); + // indent remaining lines 8 spaces + return result.replace(/\n/gm, "\n "); + } else { + // indent all lines 6 spaces + result = result.replace(/^/gm, " "); + } + + return result; } function templateContent(entry, type, translate) { @@ -109,13 +119,17 @@ function templateContent(entry, type, translate) { const codeBlocks = entry.render.map((render) => { let preamble = render.usage || type; + let list = false; if (type === "tariff") { preamble = TARIFF_GROUPS[entry.product.group]; + if (preamble === "solar") { + list = true; + } } - const code = `${CODE_PREAMBLES[preamble]}\n${indent(render.default).trimEnd()}`; + const code = `${CODE_PREAMBLES[preamble]}\n${indent(render.default, list).trimEnd()}`; const advanced = render.advanced && render.advanced !== render.default - ? `${CODE_PREAMBLES[preamble]}\n${indent(render.advanced).trimEnd()}` + ? `${CODE_PREAMBLES[preamble]}\n${indent(render.advanced, list).trimEnd()}` : null; return { usage: render.usage,