Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit da39b44

Browse files
committed
render_search_terms beginnings
1 parent b3de61f commit da39b44

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

render-configs.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
import re
66

77
WORKER_SENTINEL = "\n\n// CONFIGS\n\n"
8+
LIST_ITEM_REGEX = re.compile(r"^- ")
9+
10+
11+
def render_search_terms(search_terms):
12+
rv = []
13+
for term in search_terms:
14+
term = re.compile(LIST_ITEM_REGEX).sub("", term)
15+
rv.append(term)
16+
return rv
817

918

1019
def parse_config(dirname, markdown_contents):
@@ -28,9 +37,7 @@ def parse_config(dirname, markdown_contents):
2837
for key in flat_keys:
2938
config[key] = " ".join(config[key])
3039
if "searchTerms" in config:
31-
config["searchTerms"] = [
32-
re.compile(r"^- ").sub("", term) for term in config["searchTerms"]
33-
]
40+
config["searchTerms"] = render_search_terms(config["searchTerms"])
3441
if "avatar" in config:
3542
matches = re.compile("^.*\((.+)\)$").match(config["avatar"])
3643
if matches:
@@ -46,7 +53,7 @@ def parse_config(dirname, markdown_contents):
4653
config["displayName"] = display_name
4754

4855
if "isEnabled" in config:
49-
config["isEnabled"] = (config["isEnabled"].lower() == "true")
56+
config["isEnabled"] = config["isEnabled"].lower() == "true"
5057
else:
5158
# for legacy support, if the section is missing, set to True
5259
config["isEnabled"] = True
@@ -91,4 +98,5 @@ def main():
9198
save_json_configs("feed-generator/configs.json", configs)
9299
replace_json_configs("cloudflare-worker/worker.js", configs)
93100

101+
94102
main()

0 commit comments

Comments
 (0)