Skip to content

Commit

Permalink
Normalize adding (and allowing missing) trailing newlines for READMEs.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSouther committed Nov 27, 2024
1 parent 74733d2 commit ab6a7d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions .tools/readmes/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def render(self) -> RenderStatus:
customs=customs,
unsupported=unsupported,
)
self.readme_text += "\n" # Jinja is the worst and strips trailing new lines
[text, errors] = expand_all_entities(self.readme_text, self.scanner.doc_gen.entities)
if errors:
raise errors
Expand Down
6 changes: 6 additions & 0 deletions .tools/readmes/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ def main():

def make_diff(renderer, id):
current = renderer.read_current().split("\n")
if current[-1] != "":
# Ensure final "last" line
current += [""]
expected = renderer.readme_text.split("\n")
if expected[-1] != "":
# Ensure final "last" line
expected += [""]
diff = unified_diff(current, expected, f"{id}/current", f"{id}/expected")
return "\n".join(diff)

0 comments on commit ab6a7d9

Please sign in to comment.