From 0f3ad8bb69b5b2d48b61a9122d584efd61804479 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sun, 16 May 2021 23:00:37 +0100 Subject: [PATCH] fix generate_ini for multiline descriptions --- scripts/generate_ini.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/generate_ini.py b/scripts/generate_ini.py index a801b8b..edfb6ca 100644 --- a/scripts/generate_ini.py +++ b/scripts/generate_ini.py @@ -4,6 +4,8 @@ import json import argparse from pathlib import Path +def fix_description(desc): + return "; " + desc.replace("\n", "\n; ") def generate_ini(base_file, ini_file): """ @@ -17,10 +19,10 @@ def generate_ini(base_file, ini_file): for section in config_base["sections"]: ini.add_section(section) if "meta" in config_base["sections"][section]: - ini.set(section, "; " + config_base["sections"][section]["meta"]["description"]) + ini.set(section, fix_description(config_base["sections"][section]["meta"]["description"])) for entry in config_base["sections"][section]["settings"]: if "description" in config_base["sections"][section]["settings"][entry]: - ini.set(section, "; " + config_base["sections"][section]["settings"][entry]["description"]) + ini.set(section, fix_description(config_base["sections"][section]["settings"][entry]["description"])) value = config_base["sections"][section]["settings"][entry]["value"] if isinstance(value, bool): value = str(value).lower()