12 url =
"https://api.github.com/orgs/BlossomTheme/repos?type=all&sort=created&direction=desc&per_page=100"
13 resp = requests.get(url)
16 init_date = dt(2024, 7, 22)
18 with open(
"./builder.conf",
"r")
as file:
21 init_date = dt.fromisoformat(line)
26 date_created = dt.fromisoformat(entry[
"created_at"].split(
"T")[0])
27 if date_created >= init_date:
28 to_be_updated.append(entry[
"name"])
30 print(
"Fetching to be updated list")
35 img_pattern =
r'(<div id="images-go-here">\s*)(</div>)'
37 installation_instructions = markdown.markdown(installation_instructions)
39 os.system(f
"cp ./pages/SAMPLE.html ./pages/{name.lower()}.html")
41 with open(rf
'./pages/{name.lower()}.html',
'r')
as file:
44 data = data.replace(
"-TITLE-", name)
45 data = data.replace(
"-DESCRIPTION-", description)
46 data = data.replace(
"-INSTALLATION-", installation_instructions)
49 for image
in image_locations:
50 img_tags = f
"<img src=\"https://raw.githubusercontent.com/BlossomTheme/{name}/main/{image}\" width=\"75%\">"
51 replacement = replacement +
r'\1' + img_tags +
r'\2' +
'\n'
53 data = re.sub(img_pattern, replacement, data)
56 with open(rf
'./pages/{name.lower()}.html',
'w')
as file:
59 print(f
"Created project page for {name}")
63 url = f
"https://api.github.com/repos/BlossomTheme/{name}"
65 pattern =
r'!\[\]\((.*?)\)'
66 extracted_image_paths = []
67 read_me_file = urllib.request.urlopen(f
"https://raw.githubusercontent.com/BlossomTheme/{name}/main/README.md")
68 installation_instructions =
""
69 installation_header_found =
False
71 resp = requests.get(url)
74 description = data[
"description"]
76 for line
in read_me_file:
77 if "![]" in line.decode(
'utf-8'):
78 images.append(line.decode(
'utf-8').replace(
"\n",
""))
80 elif "## Installation" in line.decode(
'utf-8'):
81 installation_header_found =
True
84 elif installation_header_found:
85 installation_instructions = installation_instructions + (line.decode(
'utf-8')).strip() +
'\n'
91 match = re.search(pattern, item)
94 if path.startswith(
'./'):
96 extracted_image_paths.append(f
"{path}")
98 print(f
"Fetched details for {name}")
99 return description, extracted_image_paths, installation_instructions