handle aside tag
This commit is contained in:
parent
488417582a
commit
0b3c66b99b
44
epub.php
44
epub.php
|
@ -12,6 +12,18 @@
|
|||
require 'settings.php';
|
||||
require 'TPEpubCreator.php';
|
||||
|
||||
function get_clean_html($node)
|
||||
{
|
||||
$innerHTM = '';
|
||||
foreach ($node->childNodes as $childNode){
|
||||
$nodeHTML = $childNode->ownerDocument->saveHTML($childNode);
|
||||
$nodeHTML = str_replace('<aside', '<b><i', $nodeHTML);
|
||||
$nodeHTML = str_replace('</aside', '</i></b', $nodeHTML);
|
||||
$innerHTML .= $nodeHTML;
|
||||
}
|
||||
return '<div>' . strip_tags($innerHTML, '<p><b><h2><i>') . '</div>';
|
||||
}
|
||||
|
||||
function add_mp_article($url, $context, $epub)
|
||||
{
|
||||
if (isset($_POST['mptoday']) && $_POST['mptoday'] && !str_contains($url, (new DateTime('today'))->format('dmy')))
|
||||
|
@ -65,14 +77,8 @@
|
|||
else
|
||||
{
|
||||
$node = $nodes->item(0);
|
||||
|
||||
$innerHTML = '';
|
||||
foreach ($node->childNodes as $childNode){
|
||||
$innerHTML .= $childNode->ownerDocument->saveHTML($childNode);
|
||||
}
|
||||
$result .= '<div>' . strip_tags($innerHTML, '<p><b><h2><i>') . '</div>';
|
||||
|
||||
$epub->AddPage($result, false, $title);
|
||||
$nodehtml = get_clean_html($node);
|
||||
$epub->AddPage($nodehtml, false, $title);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,15 +494,8 @@
|
|||
else
|
||||
{
|
||||
$node = $nodes->item(0);
|
||||
|
||||
$innerHTML = '';
|
||||
foreach ($node->childNodes as $childNode){
|
||||
$innerHTML .= $childNode->ownerDocument->saveHTML($childNode);
|
||||
}
|
||||
|
||||
$result .= '<div>' . strip_tags($innerHTML, '<p><b><h2><i>') . '</div>';
|
||||
|
||||
$epub->AddPage($result, false, $title);
|
||||
$nodehtml = get_clean_html($node);
|
||||
$epub->AddPage($nodehtml, false, $title);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,15 +562,8 @@
|
|||
else
|
||||
{
|
||||
$node = $nodes->item(0);
|
||||
|
||||
$innerHTML = '';
|
||||
foreach ($node->childNodes as $childNode){
|
||||
$innerHTML .= $childNode->ownerDocument->saveHTML($childNode);
|
||||
}
|
||||
|
||||
$result .= '<div>' . strip_tags($innerHTML, '<p><b><h2><i>') . '</div>';
|
||||
|
||||
$epub->AddPage($result, false, $title);
|
||||
$nodehtml = get_clean_html($node);
|
||||
$epub->AddPage($nodehtml, false, $title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue