Skip to content

Commit ed6ff13

Browse files
TMHSDigitalclaude
andcommitted
fix: write LF line endings on every platform
.gitattributes now normalizes all text files to LF (with binary overrides for images and fonts), and every write_text call in the scripts, scaffold and site builder passes newline="\n", so runs on Windows produce the same bytes as Linux CI. Closes #127 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com>
1 parent 3fb8b1d commit ed6ff13

6 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎.gitattributes‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
# Normalize every text file to LF in the repo and the working tree, so
2+
# scripts run on Windows produce byte-identical output to Linux CI.
3+
* text=auto eol=lf
4+
15
VERSION text eol=lf
26
*.sh text eol=lf
37
*.py text eol=lf
48
*.yml text eol=lf
59
*.yaml text eol=lf
10+
11+
# Binary assets
12+
*.png binary
13+
*.jpg binary
14+
*.jpeg binary
15+
*.gif binary
16+
*.ico binary
17+
*.webp binary
18+
*.woff binary
19+
*.woff2 binary

‎scaffold/generator.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def render_template(env: Environment, template_name: str, context: dict) -> str:
111111
def write_file(base: Path, rel_path: str, content: str, *, verbose: bool = True) -> None:
112112
full = base / rel_path
113113
full.parent.mkdir(parents=True, exist_ok=True)
114-
full.write_text(content, encoding="utf-8")
114+
full.write_text(content, encoding="utf-8", newline="\n")
115115
if verbose:
116116
print(f" created {rel_path}")
117117

@@ -361,7 +361,9 @@ def register_in_registry(
361361

362362
entries.append(entry)
363363
registry_path.write_text(
364-
json.dumps(entries, indent=2, ensure_ascii=False) + "\n", encoding="utf-8"
364+
json.dumps(entries, indent=2, ensure_ascii=False) + "\n",
365+
encoding="utf-8",
366+
newline="\n",
365367
)
366368
if verbose:
367369
print(f" registered {entry['slug']} in {registry_path}")

‎scripts/add_comment_marker.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def main(argv: list[str]) -> int:
4242
print(f"error: standards-version marker not found in {path}", file=sys.stderr)
4343
return 1
4444

45-
path.write_text(updated, encoding="utf-8")
45+
path.write_text(updated, encoding="utf-8", newline="\n")
4646
print(f"updated {path}")
4747
return 0
4848

‎scripts/add_frontmatter.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def main(argv: list[str]) -> int:
5656
print(f"error: standards-version not found in frontmatter of {path}", file=sys.stderr)
5757
return 1
5858

59-
path.write_text(updated, encoding="utf-8")
59+
path.write_text(updated, encoding="utf-8", newline="\n")
6060
print(f"updated {path}")
6161
return 0
6262

‎scripts/drift_check/cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
414414
if args.output == "-":
415415
sys.stdout.write(out_text)
416416
else:
417-
Path(args.output).write_text(out_text, encoding="utf-8")
417+
Path(args.output).write_text(out_text, encoding="utf-8", newline="\n")
418418

419419
if args.update_sticky_issue:
420420
if not gh_token:

‎site-template/build_site.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def main():
366366
html = template.render(**context)
367367

368368
out_dir.mkdir(parents=True, exist_ok=True)
369-
(out_dir / "index.html").write_text(html, encoding="utf-8")
369+
(out_dir / "index.html").write_text(html, encoding="utf-8", newline="\n")
370370
print(f"Wrote {out_dir / 'index.html'}")
371371

372372
fonts_src = template_dir / "fonts"

0 commit comments

Comments
 (0)