Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Feb 1, 2025
1 parent 41278bc commit 04a84bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/public/.hooks/inject_variables.py
Original file line number Diff line number Diff line change
@@ -7,18 +7,18 @@
@cache
def variable_replacements():
return {
"<<<GO_VERSION>>>": get_go_version(),
"GO_VERSION": get_go_version(),
}


def get_go_version():
return Path('.go-version').read_text(encoding="utf-8")
return Path(".go-version").read_text(encoding="utf-8")


class VariableInjectionPreprocessor(Preprocessor):
def run(self, lines): # noqa: PLR6301
markdown = '\n'.join(lines)
markdown = "\n".join(lines)
for variable, replacement in variable_replacements().items():
markdown = markdown.replace(variable, replacement)
markdown = markdown.replace(f"<<<{variable}>>>", replacement)

return markdown.splitlines()

0 comments on commit 04a84bd

Please sign in to comment.