mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
hande summary in code blocks correctly
This commit is contained in:
parent
5973a166c2
commit
acfe79f3c4
1 changed files with 10 additions and 3 deletions
|
@ -1026,14 +1026,21 @@ class Item extends Controller
|
|||
// and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.)
|
||||
// we may need virtual or template classes to implement the possible alternatives
|
||||
|
||||
if (str_contains($body, '[/summary]')) {
|
||||
if (str_contains($body, '[/summary]') || str_contains($body, '</summary>')) {
|
||||
$body = wrap_code($body);
|
||||
$match = '';
|
||||
$cnt = preg_match("/\[summary](.*?)\[\/summary]/ism", $body, $match);
|
||||
if ($cnt) {
|
||||
$summary .= $match[1];
|
||||
}
|
||||
$body_content = preg_replace("/^(.*?)\[summary](.*?)\[\/summary]/ism", '', $body);
|
||||
$body = trim($body_content);
|
||||
$cnt = preg_match("/\<summary>(.*?)\<\/summary>/ism", $body, $match);
|
||||
if ($cnt) {
|
||||
$summary .= $match[1];
|
||||
}
|
||||
$body = preg_replace("/^(.*?)\[summary](.*?)\[\/summary]/ism", '', $body);
|
||||
$body = preg_replace("/^(.*?)\<summary>(.*?)\<\/summary>/ism", '', $body);
|
||||
$body = trim($body);
|
||||
$body = unwrap_code($body);
|
||||
}
|
||||
|
||||
$summary = wrap_code($summary);
|
||||
|
|
Loading…
Reference in a new issue