generated from dellevin/template
优化epub功能和清除缓存功能
This commit is contained in:
@@ -112,9 +112,17 @@ class FootnotePopupOverlayState extends State<FootnotePopupOverlay>
|
||||
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
// Strip HTML tags for simple text display
|
||||
// Strip HTML tags and decode entities for simple text display
|
||||
final plainText = widget.rawHtml
|
||||
.replaceAll(RegExp(r'<[^>]*>'), '')
|
||||
.replaceAll(' ', ' ')
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAllMapped(RegExp(r'&#(\d+);'), (m) => String.fromCharCode(int.parse(m[1]!)))
|
||||
.replaceAllMapped(RegExp(r'&#x([0-9a-fA-F]+);'), (m) => String.fromCharCode(int.parse(m[1]!, radix: 16)))
|
||||
.replaceAll(RegExp(r'\s+'), ' ')
|
||||
.trim();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user