}
function teaser()
{
- if (preg_match('{<p>(.*?)</p>}s', $this->story, $bodyp)) {
- return $bodyp[1];
+ if (preg_match('{
+ <meta \s+ name="description" [^>]* content="([^">]*)"
+ }x', $this->preface, $meta)) {
+ # prefer specific page description if found (assume before title)
+ #TODO: strip from body contents
+ return $meta[1];
+ }
+ if (preg_match('{
+ </h2> (?: \s+ | <p\sclass="nav\b.*?</p> | <div[^>]*> )* <p> (.*?) </p>
+ }sx', $this->raw, $bodyp, PREG_OFFSET_CAPTURE)) {
+ # fallback paragraph contents following the page header
+ if ($bodyp[1][1] < 256) {
+ return $bodyp[1][0];
+ }
}
}