From 90585e0315928ee37ccd2dbaebb9c07385bb36e8 Mon Sep 17 00:00:00 2001 From: Marc Wrobel Date: Sun, 11 Feb 2024 22:20:05 +0100 Subject: [PATCH] =?UTF-8?q?[release=5Ftable]=C2=A0Add=20support=20for=20re?= =?UTF-8?q?gex,=20regex=5Fexclude=20and=20template=20parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just like versions, release_table now supports regex, regex_exclude and template parameters. --- src/release_table.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/release_table.py b/src/release_table.py index 21fa38c6..f51e5c7f 100644 --- a/src/release_table.py +++ b/src/release_table.py @@ -8,6 +8,12 @@ from common import dates, endoflife, http, releasedata This script works based on a definition provided in the product's frontmatter to locate the table and extract the necessary information. Available configuration options are: +- regex: A regular expression used to match release based on their names (aka releaseCycle). + Releases not matching this expression are ignored. Default value is defined in endoflife.py (DEFAULT_VERSION_REGEX). +- regex_exclude: A regular expression used to exclude matching releases based on their names (aka releaseCycle). + Releases matching this expression are ignored, even if they match the above regex. This is empty by default. +- template: A liquid template used to render the release name. The template is rendered using the matched groups from + the regex. Default value is defined in endoflife.py (DEFAULT_VERSION_TEMPLATE). - selector: A CSS selector used to locate one or more tables in the page. - headers_selector: A CSS selector used to locate the table's headers (column names). - rows_selector: A CSS selector used to locate the table's rows. @@ -42,7 +48,11 @@ for config in endoflife.list_configs(p_filter, METHOD, m_filter): continue release_cycle = cells[index_by_target["releaseCycle"]].get_text().strip() - release = product_data.get_release(release_cycle) + release_cycle_match = config.first_match(release_cycle) + if not release_cycle_match: + continue + + release = product_data.get_release(config.render(release_cycle_match)) for target, index in index_by_target.items(): value_str = cells[index].get_text().strip()