mirror of
https://github.com/getgrav/grav.git
synced 2026-03-04 11:31:43 +01:00
fix for summary miscalculation - take 2
This commit is contained in:
@@ -260,13 +260,6 @@ class Page
|
||||
{
|
||||
$content = $this->content();
|
||||
|
||||
// Handle summary divider
|
||||
$divider_pos = strpos($content, '<p>'.SUMMARY_DELIMITER.'</p>');
|
||||
if ($divider_pos !== false) {
|
||||
$this->summary_size = $divider_pos;
|
||||
$content = str_replace('<p>'.SUMMARY_DELIMITER.'</p>', '', $content);
|
||||
}
|
||||
|
||||
// Return calculated summary based on summary divider's position
|
||||
if (!$size && isset($this->summary_size)) {
|
||||
return substr($content, 0, $this->summary_size);
|
||||
@@ -350,13 +343,20 @@ class Page
|
||||
}
|
||||
}
|
||||
|
||||
// Process any post-processing but pre-caching functionality
|
||||
self::$grav->fireEvent('onPageContentProcessed', new Event(['page' => $this]));
|
||||
|
||||
// Cache the whole page, including processed content
|
||||
if ($update_cache) {
|
||||
$cache->save($cache_id, $this->content);
|
||||
}
|
||||
|
||||
// Process any post-processing but pre-caching functionality
|
||||
self::$grav->fireEvent('onPageContentProcessed', new Event(['page' => $this]));
|
||||
// Handle summary divider
|
||||
$divider_pos = strpos($this->content, '<p>'.SUMMARY_DELIMITER.'</p>');
|
||||
if ($divider_pos !== false) {
|
||||
$this->summary_size = $divider_pos;
|
||||
$this->content = str_replace('<p>'.SUMMARY_DELIMITER.'</p>', '', $this->content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user