politis: tranform zoom divs into aside tags

This commit is contained in:
quenousimporte 2024-09-11 15:45:11 +02:00
parent f5fd44291e
commit e0d841c594
1 changed files with 12 additions and 0 deletions

View File

@ -470,6 +470,18 @@
$date = $finder->query('//span[@class="date"]')->item(0)->textContent;
$summary = $finder->query('//div[@class="extrait"]')->item(0)->textContent;
// tranform "zoom" divs into aside tags
$zooms = $finder->query('//div[contains(@class,"gt_zoom")]');
foreach ($zooms as $zoom)
{
$aside = $doc->createElement('aside');
while ($zoom->childNodes->length > 0)
{
$aside->appendChild($zoom->childNodes->item(0));
}
$zoom->parentNode->replaceChild($aside, $zoom);
}
$result = '<h1>' . $title . '</h1>';
$result .= '<p>' . $author . '</p>';
$result .= '<p>' . $date . '</p>';