mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-06-11 09:24:44 +02:00
fix: nws area truncation — configurable word-boundary cap (default 80)
Replace hardcoded 50-char area cap with adapter_config key nws.area_max_chars (default 80). Truncation now appends ellipsis when cut, matching the locations_max_chars pattern from the prior commit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f5c1724567
commit
860d06c4a3
2 changed files with 11 additions and 2 deletions
|
|
@ -576,6 +576,11 @@ REGISTRY: dict[tuple[str, str], dict[str, Any]] = {
|
|||
"type": "int",
|
||||
"description": "Maximum characters for the locations field on line 4 of NWS wire. Truncates at word boundary.",
|
||||
},
|
||||
("nws", "area_max_chars"): {
|
||||
"default": 80,
|
||||
"type": "int",
|
||||
"description": "Maximum characters for the area field on line 2 of NWS wire. Truncates at last word boundary.",
|
||||
},
|
||||
|
||||
# =================================================================
|
||||
# AVALANCHE -- 1 setting (min danger level broadcast floor)
|
||||
|
|
|
|||
|
|
@ -324,8 +324,12 @@ def _render(*, event_type, area_desc, geocoder_city, county, state,
|
|||
else:
|
||||
time_seg = ""
|
||||
area = (area_desc or "").split(";")[0].strip()
|
||||
if len(area) > 50:
|
||||
area = area[:50].rsplit(" ", 1)[0]
|
||||
_area_limit = int(adapter_config.nws.area_max_chars)
|
||||
if len(area) > _area_limit:
|
||||
cut = area[:_area_limit].rsplit(" ", 1)[0]
|
||||
if not cut:
|
||||
cut = area[:_area_limit]
|
||||
area = cut + "\u2026"
|
||||
if time_seg and area:
|
||||
line2 = f"{time_seg} — {area}"
|
||||
elif time_seg:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue