mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2024-12-04 08:41:29 -08:00
fix min_ver in multiple locations in themes.toml https://github.com/TrentSPalmer/hugo_themes_report/issues/1
This commit is contained in:
parent
8414ef5d42
commit
c42a2f9927
@ -583,8 +583,10 @@ def parse_themes_toml_for_each_hugo_themes():
|
||||
else:
|
||||
if theme.theme_license is not None:
|
||||
theme.theme_license = None
|
||||
if "min_version" in theme_toml:
|
||||
corrected_mv = get_corrected_min_ver(theme_toml["min_version"])
|
||||
if theme_toml_has_min_ver(theme_toml):
|
||||
corrected_mv = get_corrected_min_ver(
|
||||
get_min_ver_from_theme_toml(theme_toml)
|
||||
)
|
||||
if theme.min_ver != corrected_mv:
|
||||
theme.min_ver = corrected_mv
|
||||
else:
|
||||
@ -622,6 +624,29 @@ def parse_themes_toml_for_each_hugo_themes():
|
||||
session.commit()
|
||||
|
||||
|
||||
def get_min_ver_from_theme_toml(theme_toml):
|
||||
if "min_version" in theme_toml:
|
||||
return theme_toml["min_version"]
|
||||
if "module" in theme_toml:
|
||||
if "hugoVersion" in theme_toml["module"]:
|
||||
if "min" in theme_toml["module"]["hugoVersion"]:
|
||||
return theme_toml["module"]["hugoVersion"]["min"]
|
||||
if "min_version" in theme_toml["module"]["hugoVersion"]:
|
||||
return theme_toml["module"]["hugoVersion"]["min_version"]
|
||||
|
||||
|
||||
def theme_toml_has_min_ver(theme_toml):
|
||||
if "min_version" in theme_toml:
|
||||
return True
|
||||
if "module" in theme_toml:
|
||||
if "hugoVersion" in theme_toml["module"]:
|
||||
if "min" in theme_toml["module"]["hugoVersion"]:
|
||||
return True
|
||||
if "min_version" in theme_toml["module"]["hugoVersion"]:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_corrected_min_ver(x):
|
||||
if "o" in str(x):
|
||||
return x.replace("o", "0")
|
||||
|
Loading…
Reference in New Issue
Block a user