mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-09 03:27:46 +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 {
|
abstract final class Em {
|
||||||
static final _exp = RegExp('<[^>]*>([^<]*)</[^>]*>');
|
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) {
|
static String regCate(String origin) {
|
||||||
Iterable<Match> matches = _exp.allMatches(origin);
|
Iterable<Match> matches = _exp.allMatches(origin);
|
||||||
@@ -29,6 +31,9 @@ abstract final class Em {
|
|||||||
'apos' => "'",
|
'apos' => "'",
|
||||||
'nbsp' => ' ',
|
'nbsp' => ' ',
|
||||||
'amp' => '&',
|
'amp' => '&',
|
||||||
|
var i? when (i.startsWith('#x')) => String.fromCharCode(
|
||||||
|
int.parse(i.substring(2), radix: 16),
|
||||||
|
),
|
||||||
_ => m.group(0)!,
|
_ => m.group(0)!,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user