Changelog update
In [ ]:
Copied!
import re
import re
In [ ]:
Copied!
# Copy the release notes from the GitHub release page
markdown_text = """
## What's Changed
**Full Changelog**: https://github.com/opengeoshub/vgridpandas/compare/v1.0.9...v1.0.0
"""
# Copy the release notes from the GitHub release page
markdown_text = """
## What's Changed
**Full Changelog**: https://github.com/opengeoshub/vgridpandas/compare/v1.0.9...v1.0.0
"""
In [ ]:
Copied!
# Regular expression pattern to match the Markdown hyperlinks
pattern = r"https://github\.com/opengeoshub/vgridpandas/pull/(\d+)"
# Regular expression pattern to match the Markdown hyperlinks
pattern = r"https://github\.com/opengeoshub/vgridpandas/pull/(\d+)"
In [ ]:
Copied!
# Function to replace matched URLs with the desired format
def replace_url(match):
pr_number = match.group(1)
return f"[#{pr_number}](https://github.com/opengeoshub/vgridpandas/pull/{pr_number})"
# Function to replace matched URLs with the desired format
def replace_url(match):
pr_number = match.group(1)
return f"[#{pr_number}](https://github.com/opengeoshub/vgridpandas/pull/{pr_number})"
In [ ]:
Copied!
# Use re.sub to replace URLs with the desired format
formatted_text = re.sub(pattern, replace_url, markdown_text)
# Use re.sub to replace URLs with the desired format
formatted_text = re.sub(pattern, replace_url, markdown_text)
In [ ]:
Copied!
for line in formatted_text.splitlines():
if "Full Changelog" in line:
prefix = line.split(": ")[0]
link = line.split(": ")[1]
version = line.split("/")[-1]
formatted_text = (
formatted_text.replace(line, f"{prefix}: [{version}]({link})")
.replace("## What's Changed", "**What's Changed**")
.replace("## New Contributors", "**New Contributors**")
)
for line in formatted_text.splitlines():
if "Full Changelog" in line:
prefix = line.split(": ")[0]
link = line.split(": ")[1]
version = line.split("/")[-1]
formatted_text = (
formatted_text.replace(line, f"{prefix}: [{version}]({link})")
.replace("## What's Changed", "**What's Changed**")
.replace("## New Contributors", "**New Contributors**")
)
In [ ]:
Copied!
with open("docs/changelog_update.md", "w") as f:
f.write(formatted_text)
with open("docs/changelog_update.md", "w") as f:
f.write(formatted_text)
In [ ]:
Copied!
# Print the formatted text
print(formatted_text)
# Print the formatted text
print(formatted_text)
Copy the formatted text and paste it to the CHANGELOG.md file