mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
* opt: cache * opt: MediaListPanel * feat: nested replyreply panel * tweaks * opt: abstract class * opt: PageStorageKey * opt: contextExt * opt: EpisodePanel * opt * opt: context instead GlobalKey * feat: jump to reply * refa: reply_reply * fix: jump * fix: index * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt: keepalive * reapply: nested replyreply * mod: spacing * opt: CommonSlidePageState * fix drag bottomsheet Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt reply jump Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt reply2reply Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * reapply: jumpToReply * fix: padding * fix: anim * fix some panels Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt: implements Scaffold * opt: remove keepalive * revert: GlobalKey * tweaks Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
35 lines
892 B
Dart
35 lines
892 B
Dart
import 'package:html/parser.dart' show parse;
|
|
|
|
abstract class Em {
|
|
static final _exp = RegExp('<[^>]*>([^<]*)</[^>]*>');
|
|
|
|
static String regCate(String origin) {
|
|
Iterable<Match> matches = _exp.allMatches(origin);
|
|
return matches.lastOrNull?.group(1) ?? origin;
|
|
}
|
|
|
|
static List<({bool isEm, String text})> regTitle(String origin) {
|
|
List<({bool isEm, String text})> res = [];
|
|
origin.splitMapJoin(
|
|
_exp,
|
|
onMatch: (Match match) {
|
|
String matchStr = match[0]!;
|
|
res.add((isEm: true, text: regCate(matchStr)));
|
|
return '';
|
|
},
|
|
onNonMatch: (String str) {
|
|
if (str != '') {
|
|
str = decodeHtmlEntities(str);
|
|
res.add((isEm: false, text: str));
|
|
}
|
|
return '';
|
|
},
|
|
);
|
|
return res;
|
|
}
|
|
|
|
static String decodeHtmlEntities(String title) {
|
|
return parse(title).body?.text ?? title;
|
|
}
|
|
}
|