docs: improve freeleech detection in parsing (#1934)

fix(ci): improve freeleech detection in parsing
This commit is contained in:
soup 2025-01-08 08:38:46 +01:00 committed by GitHub
parent 25574446f7
commit 79d0d6e572
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,10 +27,18 @@ def parse_yaml_file(file_path: str) -> Dict:
if supports_match: if supports_match:
supports = re.findall(r'-\s*(\w+)', supports_match.group(1)) supports = re.findall(r'-\s*(\w+)', supports_match.group(1))
# Look for freeleech in vars section # Look for freeleech in multiple places:
# 1. In vars section
has_freeleech = bool(re.search(r'vars:.*?-\s*freeleech\s*$', content, re.MULTILINE | re.DOTALL)) has_freeleech = bool(re.search(r'vars:.*?-\s*freeleech\s*$', content, re.MULTILINE | re.DOTALL))
has_freeleech_percent = bool(re.search(r'vars:.*?-\s*freeleechPercent\s*$', content, re.MULTILINE | re.DOTALL)) has_freeleech_percent = bool(re.search(r'vars:.*?-\s*freeleechPercent\s*$', content, re.MULTILINE | re.DOTALL))
# 2. In mappings section - check what the fields map to
mappings_freeleech = bool(re.search(r'mappings:.*?(?:freeleech|freeleechPercent):\s*(?!.*?percent|.*?\d+%)', content, re.MULTILINE | re.DOTALL))
mappings_freeleech_percent = bool(re.search(r'mappings:.*?(?:freeleech|freeleechPercent):\s*(?:.*?percent|.*?\d+%)', content, re.MULTILINE | re.DOTALL))
has_freeleech = has_freeleech or mappings_freeleech
has_freeleech_percent = has_freeleech_percent or mappings_freeleech_percent
result = { result = {
'name': name_match.group(1).strip() if name_match else '', 'name': name_match.group(1).strip() if name_match else '',
'description': desc_match.group(1).strip() if desc_match else '', 'description': desc_match.group(1).strip() if desc_match else '',