Fix 3-col calculator labelling and add lint

This commit is contained in:
Codex Agent
2026-03-08 03:20:08 +00:00
parent c7dda1f142
commit c68ad9704e
4 changed files with 56 additions and 7 deletions

View File

@@ -187,6 +187,11 @@ def process():
except:
pass
# Give 3-col calculators honest display names instead of "A to B"
if c_type in ['3col', '3col-mul'] and split_conversion_name(display_name):
op = '*' if c_type == '3col-mul' else '/'
display_name = f"{in1} {op} {in2}"
# Avoid escaping single quotes by using JSON or dict
entry = {
'slug': slug,
@@ -200,11 +205,16 @@ def process():
# Determine labels
labels = {'in1': in1, 'in2': in2}
if c_type in ['3col', '3col-mul']:
# generic 3rd label
if 'watts' in slug and 'amps' in slug: labels['in3'] = 'Volts'
elif 'lumens' in slug: labels['in3'] = 'Area (sq m)'
elif 'moles' in slug: labels['in3'] = 'Molar Mass'
else: labels['in3'] = 'Result'
# generic 3rd label; make it descriptive instead of the vague "Result"
if 'watts' in slug and 'amps' in slug:
labels['in3'] = 'Volts'
elif 'lumens' in slug:
labels['in3'] = 'Area (sq m)'
elif 'moles' in slug:
labels['in3'] = 'Molar Mass'
else:
op = '*' if c_type == '3col-mul' else '/'
labels['in3'] = f"{in1} {op} {in2}"
if custom_labels:
labels = custom_labels