update rank_hugo_themes.py to deduplicate tags_lists and

features_lists
This commit is contained in:
Trent Palmer 2021-08-26 23:13:14 -07:00
parent 4b9c11db76
commit f9c0d929ff

View File

@ -481,8 +481,10 @@ def parse_themes_toml_for_each_hugo_themes():
if 'tags' in theme_toml: if 'tags' in theme_toml:
if len(theme_toml['tags']) > 0: if len(theme_toml['tags']) > 0:
corrected_tags = get_corrected_tags(theme_toml['tags']) corrected_tags = get_corrected_tags(theme_toml['tags'])
theme_tags = [ tt = [
tag.lower() for tag in corrected_tags if len(tag) > 1] tag.lower() for tag in corrected_tags if len(tag) > 1
]
theme_tags = list(set(tt))
if theme.num_tags != len(theme_tags): if theme.num_tags != len(theme_tags):
theme.num_tags = len(theme_tags) theme.num_tags = len(theme_tags)
if theme.num_tags > 0: if theme.num_tags > 0:
@ -498,9 +500,11 @@ def parse_themes_toml_for_each_hugo_themes():
if theme.num_tags != 0: theme.num_tags = 0 if theme.num_tags != 0: theme.num_tags = 0
if 'features' in theme_toml: if 'features' in theme_toml:
if len(theme_toml['features']) > 0: if len(theme_toml['features']) > 0:
theme_features = [ tf = [
feature.lower() for feature in theme_toml[ feature.lower() for feature in
'features'] if len(feature) > 1] theme_toml['features'] if len(feature) > 1
]
theme_features = list(set(tf))
if theme.num_features != len(theme_features): if theme.num_features != len(theme_features):
theme.num_features = len(theme_features) theme.num_features = len(theme_features)
if theme.num_features > 0: if theme.num_features > 0: