mirror of
https://github.com/astral-sh/ty.git
synced 2025-12-23 05:36:53 +00:00
Add repair of the benchmark images to the PyPI readme transform
This commit is contained in:
parent
65c80b8b78
commit
080ffcbf24
1 changed files with 7 additions and 0 deletions
|
|
@ -25,6 +25,13 @@ def main() -> None:
|
|||
|
||||
content = Path("README.md").read_text(encoding="utf8")
|
||||
|
||||
# Replace relative src="./..." attributes with absolute GitHub raw URLs.
|
||||
def replace_src(match: re.Match) -> str:
|
||||
path = match.group(1).lstrip("./")
|
||||
return f'src="https://raw.githubusercontent.com/astral-sh/ty/{version}/{path}"'
|
||||
|
||||
content = re.sub(r'src="(\./[^"]+)"', replace_src, content)
|
||||
|
||||
# Replace any relative URLs (e.g., `[CONTRIBUTING.md`) with absolute URLs.
|
||||
def replace(match: re.Match) -> str:
|
||||
url = match.group(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue