X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/41811556ca2ca3ca29191bee012c35e5f40a3995..b5e83271a9acb565b3b0315fe90205edf90732b0:/article.inc.php diff --git a/article.inc.php b/article.inc.php index 336511e..a6a4ef8 100644 --- a/article.inc.php +++ b/article.inc.php @@ -82,7 +82,27 @@ class ArchiveArticle } function teaser() { - if (preg_match('{

(.*?)

}s', $this->story, $bodyp)) { + if (preg_match('{ + ]* 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('{ + (?: \s+ | | ]*> )*

\s* (.*?)

+ }sx', $this->raw, $bodyp, PREG_OFFSET_CAPTURE)) { + # fallback paragraph contents following the page header + if ($bodyp[1][1] < 256) { + return $bodyp[1][0]; + } + } + + # starting paragraph for documents without title (assumed simple/partial) + if (strpos($this->raw, ' \s* (.*?)

+ }sx', $this->raw, $bodyp)) { return $bodyp[1]; } }