From b4b191a5b6f881b6d6e8b9ff43f9798e7fa851b1 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 28 Jun 2019 00:32:11 +0200 Subject: [PATCH] page: teaser fallback to untitled paragraph --- article.inc.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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() -- 2.30.0