From c5bed35048f4d272b832907b6907e0c3dc01edad Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Sat, 6 Jun 2026 07:12:18 +0200 Subject: [PATCH] keep regexp --- .../presentation/widgets/web_search_infobox_card.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/weblibre/lib/features/web_search/presentation/widgets/web_search_infobox_card.dart b/apps/weblibre/lib/features/web_search/presentation/widgets/web_search_infobox_card.dart index 53ff2585..79ea3fd2 100644 --- a/apps/weblibre/lib/features/web_search/presentation/widgets/web_search_infobox_card.dart +++ b/apps/weblibre/lib/features/web_search/presentation/widgets/web_search_infobox_card.dart @@ -167,6 +167,8 @@ class WebSearchInfoboxCard extends HookConsumerWidget { return info.infobox.trim(); } + static final RegExp _trailingColon = RegExp(r':+\s*$'); + /// Attributes worth rendering in the factsheet: those with a non-empty value, /// minus low-signal entries. We always drop a "type"/"kind" attribute: it is /// Brave's weakest classifier (emitted only as a fallback when no `category` @@ -176,7 +178,7 @@ class WebSearchInfoboxCard extends HookConsumerWidget { return (info.attributes ?? const []) .where((attr) => attr.value?.trim().isNotEmpty ?? false) .where((attr) { - final label = attr.label.replaceAll(RegExp(r':+\s*$'), '').toLowerCase(); + final label = attr.label.replaceAll(_trailingColon, '').toLowerCase(); return label != 'type' && label != 'kind'; }) .toList();