mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-07 18:47:50 +08:00
fix: html numeric character (#1972)
This commit is contained in:
committed by
GitHub
parent
0f07dccc4b
commit
4228f918d7
@@ -1,6 +1,8 @@
|
||||
abstract final class Em {
|
||||
static final _exp = RegExp('<[^>]*>([^<]*)</[^>]*>');
|
||||
static final _htmlRegExp = RegExp(r'&(lt|gt|quot|apos|nbsp|amp);');
|
||||
static final _htmlRegExp = RegExp(
|
||||
r'&(lt|gt|quot|apos|nbsp|amp|#x[a-fA-F\d]{2,4});',
|
||||
);
|
||||
|
||||
static String regCate(String origin) {
|
||||
Iterable<Match> matches = _exp.allMatches(origin);
|
||||
@@ -29,6 +31,9 @@ abstract final class Em {
|
||||
'apos' => "'",
|
||||
'nbsp' => ' ',
|
||||
'amp' => '&',
|
||||
var i? when (i.startsWith('#x')) => String.fromCharCode(
|
||||
int.parse(i.substring(2), radix: 16),
|
||||
),
|
||||
_ => m.group(0)!,
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user