From ce5c24b19f945f3227d87fabfbaeba30ea69b80b Mon Sep 17 00:00:00 2001 From: 08volt Date: Wed, 22 Jan 2025 12:04:34 +0000 Subject: [PATCH] Improve feature name readability in conformance reports Add feature name processing to remove redundant prefixes and improve readability in conformance comparison tables. Changes include: - Remove "HTTPRoute" and "Gateway" prefixes from feature names - Split camelCase words into space-separated words - Add process_feature_name() function for consistent text processing - Update generate_profiles_report() to use processed feature names This makes the conformance reports easier to read --- hack/mkdocs-generate-conformance.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/hack/mkdocs-generate-conformance.py b/hack/mkdocs-generate-conformance.py index 34f2fe8418..8be0a7d8b2 100644 --- a/hack/mkdocs-generate-conformance.py +++ b/hack/mkdocs-generate-conformance.py @@ -19,10 +19,27 @@ from fnmatch import fnmatch import glob import os +import re log = logging.getLogger('mkdocs') +def process_feature_name(feature): + """ + Process feature names by: + 1. Removing HTTPRoute and Gateway prefixes + 2. Splitting camelCase into space-separated words + """ + # Remove prefixes + feature = re.sub(r'^(HTTPRoute|Gateway)', '', feature) + + # Split camelCase + words = re.findall(r'[A-Z][a-z]*(?=[A-Z][a-z]*|$)|[A-Z]{2,}(?=[A-Z][a-z]|\d|\W|$)|[A-Z][a-z]+|\d+', feature) + + # Join words with spaces and title case each word + return ' '.join(word.title() for word in words) + + @plugins.event_priority(100) def on_pre_build(config, **kwargs): log.info("generating conformance") @@ -114,7 +131,9 @@ def generate_profiles_report(reports, route,version): for row in http_table.itertuples(): if type(row._4) is list: for feat in row._4: - http_table.loc[row.Index, feat] = ':white_check_mark:' + # Process feature name before using it as a column + processed_feat = process_feature_name(feat) + http_table.loc[row.Index, processed_feat] = ':white_check_mark:' http_table = http_table.fillna(':x:') http_table = http_table.drop(['extended.supportedFeatures'], axis=1)