- edited description
When removing elements from 'allowed elements', it's _contents_ are removed, instead of unwrapping it.
Issue #2
resolved
sample code, where I've removed <div>
from allowed_elements:
<?php
require_once "htmlmaid/src/Maid/Maid.php";
use Maid\Maid;
use Maid\Parser;
$html = file_get_contents('vragen_in.htm');
$options = array();
$options['allowed-tags'] = array('html', 'body', 'p', 'em', 'img', 'i', 'b', 'li', 'ol', 'ul', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6');
$options['remove-tags'] = array('head', 'script');
$options['allowed-attribs'] = array('id'); // 'src', 'class',
$options['strip-comments'] = true;
$maid = new Maid($options);
echo $maid->clean($html);
file_put_contents('vragen_uit.htm', $maid->clean($html));
Expected result:
<html><body>
<p>C:</p>
<p>Verzekeringen, vergoedingen</p>
<p><p> </p></p>
<p>Q:</p>
etc.. etc..
actual result:
<html><body>
</body></html>
The used input file is attached to this issue.
Comments (2)
-
reporter -
repo owner - changed status to resolved
- Log in to comment