Refactor block scalar handling in config parser

Simplifies the logic for handling block scalar content by restructuring the conditional checks for blockScalarParentIndent. This improves readability and ensures correct processing of indented lines.
This commit is contained in:
Sergey Krashevich
2025-12-27 09:56:52 +03:00
parent 3bd433c950
commit 76bdc7e065
+6 -6
View File
@@ -595,13 +595,13 @@
if (!line.trim()) continue;
const indent = countIndent(line);
if (blockScalarParentIndent !== null && indent <= blockScalarParentIndent) {
blockScalarParentIndent = null;
if (blockScalarParentIndent !== null) {
if (indent <= blockScalarParentIndent) {
blockScalarParentIndent = null;
} else {
continue; // treat as block scalar content
}
}
if (blockScalarParentIndent !== null && indent > blockScalarParentIndent) {
continue; // treat as block scalar content
}
if (indent === 0 && (hasTopLevelKey || hasTopLevelList)) {
const trimmed = line.trim();
if (trimmed !== '---' && trimmed !== '...' && !trimmed.startsWith('#')) {