diff --git a/var/Widget/Abstract/Contents.php b/var/Widget/Abstract/Contents.php index ef9c69f1..9f0517f2 100644 --- a/var/Widget/Abstract/Contents.php +++ b/var/Widget/Abstract/Contents.php @@ -141,6 +141,22 @@ class Widget_Abstract_Contents extends Widget_Abstract return $this->pluginHandle(__CLASS__)->contentEx($content, $this); } + /** + * 输出文章的第一行作为摘要 + * + * @return string + */ + protected function ___summary() + { + $content = $this->content; + $parts = preg_split("/<\/\s*(?:p|blockquote|q|pre)\s*>/i", $content, 2); + if (!empty($parts)) { + $content = $parts[0] . '

'; + } + + return $content; + } + /** * 锚点id *