mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 评论区搜索词正则符号未转义导致匹配词断开(如A|an)
This commit is contained in:
@@ -571,7 +571,7 @@ InlineSpan buildContent(
|
|||||||
...content.topicsMeta?.keys?.map((e) => '#$e#') ?? [],
|
...content.topicsMeta?.keys?.map((e) => '#$e#') ?? [],
|
||||||
...content.atNameToMid.keys.map((e) => '@$e'),
|
...content.atNameToMid.keys.map((e) => '@$e'),
|
||||||
];
|
];
|
||||||
List<dynamic> jumpUrlKeysList = content.jumpUrl.keys.map((e) {
|
List<String> jumpUrlKeysList = content.jumpUrl.keys.map<String>((String e) {
|
||||||
return e.replaceAllMapped(
|
return e.replaceAllMapped(
|
||||||
RegExp(r'[?+*]'), (match) => '\\${match.group(0)}');
|
RegExp(r'[?+*]'), (match) => '\\${match.group(0)}');
|
||||||
}).toList();
|
}).toList();
|
||||||
@@ -582,7 +582,7 @@ InlineSpan buildContent(
|
|||||||
}
|
}
|
||||||
patternStr += r'(\b(?:\d+[::])?[0-5]?[0-9][::][0-5]?[0-9]\b)';
|
patternStr += r'(\b(?:\d+[::])?[0-5]?[0-9][::][0-5]?[0-9]\b)';
|
||||||
if (jumpUrlKeysList.isNotEmpty) {
|
if (jumpUrlKeysList.isNotEmpty) {
|
||||||
patternStr += '|${jumpUrlKeysList.join('|')}';
|
patternStr += '|${jumpUrlKeysList.map(RegExp.escape).join('|')}';
|
||||||
}
|
}
|
||||||
final RegExp pattern = RegExp(patternStr);
|
final RegExp pattern = RegExp(patternStr);
|
||||||
List<String> matchedStrs = [];
|
List<String> matchedStrs = [];
|
||||||
@@ -703,7 +703,8 @@ InlineSpan buildContent(
|
|||||||
title,
|
title,
|
||||||
'',
|
'',
|
||||||
);
|
);
|
||||||
} else if (RegExp(r'^[Cc][Vv][0-9]+$').hasMatch(matchStr)) {
|
} else if (RegExp(r'^[Cc][Vv][0-9]+$')
|
||||||
|
.hasMatch(matchStr)) {
|
||||||
Get.toNamed('/htmlRender', parameters: {
|
Get.toNamed('/htmlRender', parameters: {
|
||||||
'url': 'https://www.bilibili.com/read/$matchStr',
|
'url': 'https://www.bilibili.com/read/$matchStr',
|
||||||
'title': title,
|
'title': title,
|
||||||
@@ -792,8 +793,8 @@ InlineSpan buildContent(
|
|||||||
);
|
);
|
||||||
// 只显示一次
|
// 只显示一次
|
||||||
matchedStrs.add(matchStr);
|
matchedStrs.add(matchStr);
|
||||||
} else if (content
|
} else if (matchStr.length > 1 &&
|
||||||
.topicsMeta[matchStr.substring(1, matchStr.length - 1)] !=
|
content.topicsMeta[matchStr.substring(1, matchStr.length - 1)] !=
|
||||||
null) {
|
null) {
|
||||||
spanChildren.add(
|
spanChildren.add(
|
||||||
TextSpan(
|
TextSpan(
|
||||||
|
|||||||
Reference in New Issue
Block a user