feat(dashboard): implement flexible parsing for any date/weather format
Implemented Smart Hybrid Parser to handle virtually any fantasy or real-world scenario while maintaining backward compatibility with existing comma-separated formats. **Date Parsing Enhancement (infoBoxWidgets.js, lines 43-62):** - Added conditional parsing: structured (comma-separated) vs unstructured - Structured: "Tuesday, 15 January, 2024" → weekday/month/year split - Unstructured: "3rd Day of Ninth Moon Year of Dragon" → full text in month field - Handles: Fantasy calendars, ISO dates (2024-01-15), prose, stardates **Weather Parsing Enhancement (infoBoxWidgets.js, lines 84-120):** - JOIN remaining comma parts instead of taking only 2nd part - Fixes: "🌧️, Heavy rain, flooding, winds" → preserves full forecast - Added emoji prefix detection for non-comma formats - Handles prose weather: "The air crackles with magical energy" - Graceful fallback: no emoji → text-only display **formatWeather Enhancement (sceneInfoWidget.js, lines 65-102):** - Added no-emoji handling (display forecast only) - Expanded symbol validation: custom symbols (+++, ***, ##) - Symbol regex: /^[+*#~\-=_]+$/ for weather symbols - Text-as-emoji handling: combines text with forecast gracefully **formatLocation Enhancement (sceneInfoWidget.js, lines 126-148):** - Changed to split on FIRST comma only (using indexOf) - Preserves all remaining text after first comma as label - Fixes: "The Winding Stair, Third Floor, East Wing, Palace" → keeps full context - Still preserves hyphens in names (Seol Yi-hwan) **CSS Text Wrapping (style.css, lines 2716-2745):** - Removed white-space: nowrap restriction - Added -webkit-line-clamp: 3 for values (2-3 line wrap) - Added -webkit-line-clamp: 2 for labels - Added word-wrap and overflow-wrap for long words - Text now wraps gracefully instead of truncating prematurely **Backward Compatibility:** ✅ Existing formats continue to work perfectly ✅ "Tuesday, 15 January, 2024" still parses as structured ✅ "🌤️, Partly cloudy" still displays with emoji ✅ "Location, City" still splits correctly **New Format Support:** ✅ Fantasy: "3rd Day of the Ninth Moon Year of the Azure Dragon" ✅ ISO: "2024-01-15" ✅ Prose: "The third day after the full moon" ✅ Stardates: "Stardate 47634.44" ✅ Weather prose: "The air crackles with magical energy" ✅ Weather symbols: "+++, Heavy rainfall" ✅ Complex locations: "Building A, Floor 3, Room 101, Campus" ✅ Hyphenated names: "Seol Yi-hwan's Private Quarters" **Testing Scenarios Covered:** - Standard comma-separated formats (backward compat) - Fantasy calendars without commas - ISO date formats - Prose descriptions for date/weather - Stardates and custom time systems - Weather symbols instead of emoji - Multi-part weather forecasts - Long multi-part locations - Hyphenated character names Result: Widget now handles ANY user-defined format while maintaining visual polish and backward compatibility.
This commit is contained in:
@@ -2718,9 +2718,14 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
color: var(--rpg-text);
|
||||
white-space: nowrap;
|
||||
/* Allow wrapping to 2-3 lines for long text (fantasy dates, prose) */
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
/* Secondary label (small, subdued) */
|
||||
@@ -2729,9 +2734,14 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
line-height: 1.2;
|
||||
color: var(--rpg-text);
|
||||
opacity: 0.7;
|
||||
white-space: nowrap;
|
||||
/* Allow wrapping to 2 lines for long labels */
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
/* Location-specific styling */
|
||||
|
||||
Reference in New Issue
Block a user