comment cleanup
This commit is contained in:
parent
bd3f9bf8d2
commit
4f9d1a0442
3 changed files with 4 additions and 6 deletions
|
|
@ -72,8 +72,8 @@ class IniHandler(BaseHandler):
|
|||
|
||||
def _generate_ini_template_from_text(self, role_prefix: str, text: str) -> str:
|
||||
"""
|
||||
Generate a Jinja2 template for an INI/php.ini-style file, preserving
|
||||
comments, blank lines, and section headers by patching values in-place.
|
||||
Generate a Jinja2 template for an INI-style file, preserving comments,
|
||||
blank lines, and section headers by patching values in-place.
|
||||
"""
|
||||
lines = text.splitlines(keepends=True)
|
||||
current_section: str | None = None
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class JsonHandler(DictLikeHandler):
|
|||
) -> str:
|
||||
if not isinstance(parsed, (dict, list)):
|
||||
raise TypeError("JSON parser result must be a dict or list")
|
||||
# As before: ignore original_text and rebuild structurally
|
||||
# Rebuild structurally
|
||||
return self._generate_json_template(role_prefix, parsed)
|
||||
|
||||
def _generate_json_template(self, role_prefix: str, data: Any) -> str:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from . import DictLikeHandler
|
|||
|
||||
class YamlHandler(DictLikeHandler):
|
||||
fmt = "yaml"
|
||||
flatten_lists = True # you flatten YAML lists
|
||||
flatten_lists = True
|
||||
|
||||
def parse(self, path: Path) -> Any:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
|
|
@ -97,8 +97,6 @@ class YamlHandler(DictLikeHandler):
|
|||
out_lines.append(raw_line)
|
||||
continue
|
||||
|
||||
# We have an inline scalar value on this same line.
|
||||
|
||||
# Separate value from inline comment
|
||||
value_part, comment_part = self._split_inline_comment(
|
||||
rest_stripped, {"#"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue