diff --git a/gh-data.py b/gh-data.py index a0ded6c..bb96948 100644 --- a/gh-data.py +++ b/gh-data.py @@ -66,6 +66,16 @@ def process_labels(labels): } +def get_url(text): + # get the first url (maybe in markdown link) and remove trailing comma + m = re.search(r"\b(https?://[^\)\s]+)", text) + if m: + url = m.group() + if url.endswith(','): + url = url[:-1] + return url + return "" + def process_body(issue): lines = issue["body"].splitlines() @@ -100,6 +110,8 @@ def process_body(issue): if line.lower().startswith(text_title): value = line[len(text_title) :].strip() value = re.sub(r"\[[^\]]+\]\(([^\)]+)\)", r"\1", value) + if key in ("url", "explainer", "caniuse", "bug", "webkit"): + value = get_url(value) if value != "" and value.lower() != "n/a": body[key] = value break