independant elements from p + delete p from li
This commit is contained in:
parent
048a1b67e6
commit
c321a17f3e
8 changed files with 36 additions and 19 deletions
|
|
@ -22,6 +22,13 @@ function resolveFileUrl($field, $page) {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supprime les <p> imbriqués dans les <li> (générés par Kirby pour les listes "loose")
|
||||
*/
|
||||
function stripParagraphsInListItems($html) {
|
||||
return preg_replace('/<li>\s*<p>(.*?)<\/p>\s*<\/li>/s', '<li>$1</li>', $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Résout les images dans le contenu HTML
|
||||
*/
|
||||
|
|
@ -63,7 +70,7 @@ function parseBlocks($blocksField, $page) {
|
|||
switch ($block->type()) {
|
||||
case 'text':
|
||||
$blockData['content'] = [
|
||||
'text' => resolveImagesInHtml($block->text()->value(), $page)
|
||||
'text' => stripParagraphsInListItems(resolveImagesInHtml($block->text()->value(), $page))
|
||||
];
|
||||
break;
|
||||
|
||||
|
|
@ -87,7 +94,7 @@ function parseBlocks($blocksField, $page) {
|
|||
|
||||
case 'list':
|
||||
$blockData['content'] = [
|
||||
'text' => $block->text()->value()
|
||||
'text' => stripParagraphsInListItems($block->text()->value())
|
||||
];
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue