X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/41811556ca2ca3ca29191bee012c35e5f40a3995..dcfc97617cdb6307e14752d7fb10f00733737616:/article.inc.php diff --git a/article.inc.php b/article.inc.php index 336511e..98cd475 100644 --- a/article.inc.php +++ b/article.inc.php @@ -17,16 +17,32 @@ function showdate($parts) class ArchiveArticle { public $raw, $preface, $title, $body; + public $meta = []; function __construct($path) { - $this->page = $path; - $this->link = preg_replace('{(?:/index)?\.html$}', '', $path); - if (file_exists($this->page)) { - $this->raw = file_get_contents($this->page); - @list ($this->preface, $this->title, $this->body) = - preg_split('{
(.*?)
}s', $this->story, $bodyp)) { + if ($override = @$this->meta['og:description']) { + # prefer specific page description if found in metadata + return $override; + } + + # paragraph contents following the page header if any + $offset = strpos($this->raw, ''); + $offset = $offset ? $offset + 5 : 0; + if (preg_match('{ + \G (?> \s+ |