Skip to content

Commit ec06ce5

Browse files
Chris1221claude
andcommitted
fix: strip list dash prefix from sub-entry keys and render ListElement as key with no value
- x: 123 was parsed with key "- x" due to missing lstrip("-") before the colon split. ListElement now renders as a key with empty value rather than an empty key with a value. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f7b908d commit ec06ce5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

yamldoc/entries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ class ListElement:
153153

154154
def to_markdown(self, schema=False):
155155
if schema:
156-
return f"| | `{self.entry}` | Unknown | |"
156+
return f"| `{self.entry}` | | Unknown | |"
157157
else:
158-
return f"| | `{self.entry}` | |"
158+
return f"| `{self.entry}` | | |"
159159

160160

161161
class Entry:

yamldoc/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def parse_yaml(file_path, char="#'", debug=False, exclude_char="#'!", override_e
6161
meta = meta + line.lstrip().rstrip()
6262
else:
6363
try:
64-
key, value = line.lstrip().rstrip().split(":", 1)
64+
key, value = line.lstrip().lstrip("-").lstrip().rstrip().split(":", 1)
6565

6666
if not value.lstrip():
6767
new_entry = yamldoc.entries.MetaEntry(

0 commit comments

Comments
 (0)