Add guards against trailing empty spaces

This commit is contained in:
relhamdi
2026-05-25 11:13:20 +02:00
parent 1e41d37ef5
commit d6f5be3bb4
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -32,6 +32,10 @@ def parse_options(raw: str) -> list[str]:
current_block: list[list[str]] = []
current_list: list[str] = []
# Remove trailing empty line from paste artifacts
if lines and lines[-1].strip() == "" and len(lines) > 1:
lines = lines[:-1]
for i, line in enumerate(lines, 1):
stripped = line.strip()
+5
View File
@@ -50,6 +50,11 @@ const parseOptions = (raw) => {
let currentBlock = [];
let currentList = [];
// Remove trailing empty line from paste artifacts
if (lines.length > 1 && lines[lines.length - 1].trim() === "") {
lines.pop();
}
for (const line of lines) {
const stripped = line.trim();