mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 03:15:14 +08:00
@@ -1,5 +1,3 @@
|
||||
import 'package:html/parser.dart' show parse;
|
||||
|
||||
abstract class Em {
|
||||
static final _exp = RegExp('<[^>]*>([^<]*)</[^>]*>');
|
||||
|
||||
@@ -19,7 +17,13 @@ abstract class Em {
|
||||
},
|
||||
onNonMatch: (String str) {
|
||||
if (str != '') {
|
||||
str = decodeHtmlEntities(str);
|
||||
str = str
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll(' ', " ")
|
||||
.replaceAll('&', "&");
|
||||
res.add((isEm: false, text: str));
|
||||
}
|
||||
return '';
|
||||
@@ -27,8 +31,4 @@ abstract class Em {
|
||||
);
|
||||
return res;
|
||||
}
|
||||
|
||||
static String decodeHtmlEntities(String title) {
|
||||
return parse(title).body?.text ?? title;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user