Skip to content

Commit bdf03ef

Browse files
chore: update changelog
1 parent 1eb3b74 commit bdf03ef

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@
66

77
- chechbox scope highlight [cb90caf](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/cb90caf64951b5b7515def7783b32e73883e374c)
88
- plus / minus metadata dash rendering [35c37ca](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/35c37ca9f7955f9fa57eaee1c16edb3c80c40462)
9+
- callouts override quote icon [#194](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/194)
10+
[1eb3b74](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/1eb3b74873d2dbb9d5a3635bf4a14e77e897d29f)
911

1012
### Bug Fixes
1113

1214
- only set option value if it changes [#186](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/186)
1315
[91ce0b5](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/91ce0b5a6314b091bcba1541f557f591c7ddfe06)
1416
- handle offset conceal nodes [0cab868](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/0cab868ce2b017ff9deccee87c289dc1915317be)
17+
- indented table border [#191](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/191)
18+
[efb4c48](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/efb4c48c3b4de7cc3d01ec54d794a2509ae0c1c8)
19+
- heading border at start & end virtual text [#187](https://github.com/MeanderingProgrammer/render-markdown.nvim/issues/187)
20+
[e91b042](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/e91b042b3865d2d040a0e21e0a3b13fb57f24094)
1521

1622
## 7.2.0 (2024-09-26)
1723

scripts/update.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@ class LuaClass:
99
name: str
1010
fields: list[str]
1111

12+
def is_it(self, name: str) -> bool:
13+
return name in self.name
14+
15+
def is_optional(self, field: str) -> bool:
16+
optional_fields: list[str] = ["extends", "scope_highlight", "quote_icon"]
17+
for optional_field in optional_fields:
18+
if optional_field in field:
19+
return True
20+
return False
21+
1222
def validate(self) -> None:
1323
for field in self.fields:
14-
if "User" in self.name:
24+
if self.is_it("User"):
1525
self.validate_user_field(field)
1626
else:
1727
self.validate_non_user_field(field)
@@ -22,23 +32,20 @@ def validate_user_field(self, field: str) -> None:
2232

2333
def validate_non_user_field(self, field: str) -> None:
2434
# Non user classes are expected to have mandatory fields with some exceptions
25-
optional: bool = False
26-
optional_fields: list[str] = ["extends"] if "Handler" in self.name else []
27-
for optional_field in optional_fields:
28-
if optional_field in field:
29-
optional = True
30-
if not optional:
35+
if not self.is_optional(field):
3136
assert "?" not in field, f"Field must be mandatory: {field}"
3237

3338
def to_public_lines(self) -> list[str]:
34-
if "User" not in self.name:
39+
if not self.is_it("User"):
3540
return []
36-
lines: list[str] = [self.name.replace("User", "")]
41+
42+
lines: list[str] = []
43+
lines.append(self.name.replace("User", ""))
3744
for field in self.fields:
38-
if "scope_highlight" in field or "quote_icon" in field:
39-
lines.append(field)
40-
elif "ConfigOverrides" in self.name:
45+
if self.is_it("ConfigOverrides"):
4146
lines.append(field.replace("?", ""))
47+
elif self.is_optional(field):
48+
lines.append(field)
4249
else:
4350
lines.append(field.replace("User", "").replace("?", ""))
4451
lines.append("")
@@ -98,14 +105,12 @@ def update_readme(init_file: Path, readme_file: Path) -> None:
98105
def update_custom_handlers(init_file: Path, handler_file: Path) -> None:
99106
class_name: str = "render.md.Handler"
100107
old = get_code_block(handler_file, class_name, 1)
101-
new = "\n".join(
102-
[
103-
get_class(init_file, "render.md.Mark").to_str(),
104-
"",
105-
get_class(init_file, class_name).to_str(),
106-
]
107-
)
108-
text = handler_file.read_text().replace(old, new)
108+
new = [
109+
get_class(init_file, "render.md.Mark").to_str(),
110+
"",
111+
get_class(init_file, class_name).to_str(),
112+
]
113+
text = handler_file.read_text().replace(old, "\n".join(new))
109114
handler_file.write_text(text)
110115

111116

0 commit comments

Comments
 (0)