Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
giswqs
GitHub Repository: giswqs/geemap
Path: blob/master/docs/changelog_update.py
2313 views
1
import re
2
3
# Copy the release notes from the GitHub release page
4
markdown_text = """
5
## What's Changed
6
* Add installation CI by @giswqs in https://github.com/gee-community/geemap/pull/1656
7
* Fix vis control error by @giswqs in https://github.com/gee-community/geemap/pull/1660
8
9
## New Contributors
10
* @bengalin made their first contribution in https://github.com/gee-community/geemap/pull/1664
11
* @sufyanAbbasi made their first contribution in https://github.com/gee-community/geemap/pull/1666
12
* @kirimaru-jp made their first contribution in https://github.com/gee-community/geemap/pull/1669
13
* @schwehr made their first contribution in https://github.com/gee-community/geemap/pull/1673
14
15
**Full Changelog**: https://github.com/gee-community/geemap/compare/v0.25.0...v0.26.0
16
"""
17
18
# Regular expression pattern to match the Markdown hyperlinks
19
pattern = r"https://github\.com/gee-community/geemap/pull/(\d+)"
20
21
22
# Function to replace matched URLs with the desired format
23
def replace_url(match):
24
pr_number = match.group(1)
25
return f"[#{pr_number}](https://github.com/gee-community/geemap/pull/{pr_number})"
26
27
28
# Use re.sub to replace URLs with the desired format
29
formatted_text = re.sub(pattern, replace_url, markdown_text)
30
31
for line in formatted_text.splitlines():
32
if "Full Changelog" in line:
33
prefix = line.split(": ")[0]
34
link = line.split(": ")[1]
35
version = line.split("/")[-1]
36
formatted_text = (
37
formatted_text.replace(line, f"{prefix}: [{version}]({link})")
38
.replace("## What's Changed", "**What's Changed**")
39
.replace("## New Contributors", "**New Contributors**")
40
)
41
42
43
with open("docs/changelog_update.md", "w") as f:
44
f.write(formatted_text)
45
46
# Print the formatted text
47
print(formatted_text)
48
49
# Copy the formatted text and paste it to the CHANGELOG.md file
50
51