mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-06-10 17:04:45 +02:00
nws: sentence-case NWSheadline instead of title-case
Replace .title() with manual sentence-casing: capitalize first char, lowercase the rest, then re-uppercase timezone abbreviations (MDT, MST, PDT, PST, CDT, CST, EDT, EST, UTC) via regex. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e27d60ca49
commit
d312f10ff8
1 changed files with 4 additions and 1 deletions
|
|
@ -317,7 +317,10 @@ def _render(*, event_type, area_desc, geocoder_city, county, state,
|
|||
# Line 2: NWSheadline (title-cased, 80 chars) or fallback
|
||||
nws_hl = (params.get("NWSheadline") or [""])[0].strip()
|
||||
if nws_hl:
|
||||
nws_hl = nws_hl.title()
|
||||
# Sentence-case: capitalize first char, lowercase rest, re-uppercase TZ abbrevs
|
||||
nws_hl = nws_hl[0].upper() + nws_hl[1:].lower() if nws_hl else ""
|
||||
nws_hl = re.sub(r'\b(mdt|mst|pdt|pst|cdt|cst|edt|est|utc)\b',
|
||||
lambda m: m.group().upper(), nws_hl, flags=re.IGNORECASE)
|
||||
if len(nws_hl.encode("utf-8")) > 80:
|
||||
while len(nws_hl.encode("utf-8")) > 80:
|
||||
nws_hl = nws_hl.rsplit(" ", 1)[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue