Small fixes for addHtml.
Adding some HTML Entities to the test for addHTML
This commit is contained in:
parent
4c04071fd5
commit
d17a806305
@ -42,9 +42,14 @@ class Html
|
|||||||
* which could be applied when such an element occurs in the parseNode function.
|
* which could be applied when such an element occurs in the parseNode function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Preprocess: remove all line ends, decode HTML entity, and add body tag for HTML fragments
|
// Preprocess: remove all line ends, decode HTML entity,
|
||||||
|
// fix ampersand and angle brackets and add body tag for HTML fragments
|
||||||
$html = str_replace(array("\n", "\r"), '', $html);
|
$html = str_replace(array("\n", "\r"), '', $html);
|
||||||
$html = html_entity_decode($html);
|
$html = str_replace(array('<', '>', '&'), array('_lt_', '_gt_', '_amp_'), $html);
|
||||||
|
$html = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
|
||||||
|
$html = str_replace('&', '&', $html);
|
||||||
|
$html = str_replace(array('_lt_', '_gt_', '_amp_'), array('<', '>', '&'), $html);
|
||||||
|
|
||||||
if ($fullHTML === false) {
|
if ($fullHTML === false) {
|
||||||
$html = '<body>' . $html . '</body>';
|
$html = '<body>' . $html . '</body>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,12 @@ class HtmlTest extends \PHPUnit_Framework_TestCase
|
|||||||
$content .= '<table><tr><th>Header</th><td>Content</td></tr></table>';
|
$content .= '<table><tr><th>Header</th><td>Content</td></tr></table>';
|
||||||
$content .= '<ul><li>Bullet</li><ul><li>Bullet</li></ul></ul>';
|
$content .= '<ul><li>Bullet</li><ul><li>Bullet</li></ul></ul>';
|
||||||
$content .= '<ol><li>Bullet</li></ol>';
|
$content .= '<ol><li>Bullet</li></ol>';
|
||||||
|
$content .= "'Single Quoted Text'";
|
||||||
|
$content .= '"Double Quoted Text"';
|
||||||
|
$content .= '& Ampersand';
|
||||||
|
$content .= '<>“‘’«»‹›';
|
||||||
|
$content .= '&•°…™©®—';
|
||||||
|
$content .= '–   ²³¼½¾';
|
||||||
Html::addHtml($section, $content);
|
Html::addHtml($section, $content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user