From: Mischa POSLAWSKY Date: Thu, 27 Jun 2019 22:32:11 +0000 (+0200) Subject: page: teaser fallback to untitled paragraph X-Git-Tag: v4.0~11 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/b4b191a5b6f881b6d6e8b9ff43f9798e7fa851b1 page: teaser fallback to untitled paragraph --- diff --git a/article.inc.php b/article.inc.php index e3a3ee8..a6a4ef8 100644 --- a/article.inc.php +++ b/article.inc.php @@ -89,14 +89,22 @@ class ArchiveArticle #TODO: strip from body contents return $meta[1]; } + if (preg_match('{ - (?: \s+ | | ]*> )*

(.*?)

+ (?: \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]; + } } function img()