mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-26 01:03:35 +05:00
Merge commit '681e5d8d05d035905e6fc694af93ee27ac87dbf2' into fix/section-adding
This commit is contained in:
@@ -197,18 +197,18 @@ class SimpleConfigParser:
|
|||||||
last_option_name: str = list(prev_section_content.keys())[-1]
|
last_option_name: str = list(prev_section_content.keys())[-1]
|
||||||
|
|
||||||
if last_option_name.startswith("#_"):
|
if last_option_name.startswith("#_"):
|
||||||
last_elem: str = prev_section_content[last_option_name][-1]
|
last_elem_value: str = prev_section_content[last_option_name][-1]
|
||||||
|
|
||||||
# if the last section is a collector, we first check if the last element
|
# if the last section is a collector, we first check if the last element
|
||||||
# in the collector ends with a newline. if it does not, we append a newline.
|
# in the collector ends with a newline. if it does not, we append a newline.
|
||||||
# this can happen if the config file does not end with a newline.
|
# this can happen if the config file does not end with a newline.
|
||||||
if not last_elem.endswith("\n"):
|
if not last_elem_value.endswith("\n"):
|
||||||
last_elem = f"{last_elem}\n"
|
prev_section_content[last_option_name][-1] = f"{last_elem_value}\n"
|
||||||
|
|
||||||
# if the last item in a collector is not a newline, we append a newline, so
|
# if the last item in a collector is not a newline, we append a newline, so
|
||||||
# that the new section is seperated from the options of the previous section
|
# that the new section is seperated from the options of the previous section
|
||||||
# by a newline
|
# by a newline
|
||||||
if last_elem != "\n":
|
if last_elem_value != "\n":
|
||||||
prev_section_content[last_option_name].append("\n")
|
prev_section_content[last_option_name].append("\n")
|
||||||
else:
|
else:
|
||||||
prev_section_content[self._generate_rand_id()] = ["\n"]
|
prev_section_content[self._generate_rand_id()] = ["\n"]
|
||||||
|
|||||||
Reference in New Issue
Block a user