diff options
| author | BigCoke233 <hi@guhub.cn> | 2020-05-30 14:30:38 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2020-05-30 14:30:38 +0800 |
| commit | bd0a23b052dc750db72d2b98349044a56ede2419 (patch) | |
| tree | e9b1b5540f639e438bd461bec1e8bf9e9a3f0038 /libs | |
| parent | 33811859eb3438db65958e9a612918643786cdeb (diff) | |
✨ Add: 支持解析 details 短代码,并使用 js 垫片优化兼容性
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/Contents.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libs/Contents.php b/libs/Contents.php index 9547e95..055d4ce 100644 --- a/libs/Contents.php +++ b/libs/Contents.php @@ -13,7 +13,7 @@ class Contents $text = empty($last) ? $data : $last; if ($widget instanceof Widget_Archive) { //ParseOther - $text = Contents::parsePicShadow(Contents::parseNotice(Contents::parseKbd(Contents::parseCode(Contents::parseImages(Contents::parseHeadings(Contents::parseTextColor(Contents::parseRuby(Contents::parseTip($text))))))))); + $text = Contents::parseDetails(Contents::parsePicShadow(Contents::parseNotice(Contents::parseKbd(Contents::parseCode(Contents::parseImages(Contents::parseHeadings(Contents::parseTextColor(Contents::parseRuby(Contents::parseTip($text)))))))))); //LazyLoad $text = preg_replace('/<img (.*?)src(.*?)(\/)?>/','<img $1src="/usr/themes/Miracles/images/loading/'.$load_image.'.gif" data-gisrc$2 data-gazeimg />',$text); //owo @@ -209,7 +209,15 @@ class Contents static public function parseKbd($text) { $text = preg_replace('/\[\[(.*?)\]\]/s','<kbd>${1}</kbd>',$text); return $text; - } + } + + /** + * 解析 <details> + */ + static public function parseDetails($text) { + $text = preg_replace('/\[details sum="(.*?)"\](.*?)\[\/details\]/s','<details><summary>${1}</summary>${2}</details>',$text); + return $text; + } /** * 解析章节链接 |
