MDL-50868 weblib: add ruby support to purify_html

This commit is contained in:
Jetha Chan
2015-07-24 14:12:01 +09:00
parent 7fa73576b5
commit 841fe2b2e8
+4 -1
View File
@@ -1711,7 +1711,7 @@ function purify_html($text, $options = array()) {
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.DefinitionID', 'moodlehtml');
$config->set('HTML.DefinitionRev', 2);
$config->set('HTML.DefinitionRev', 3);
$config->set('Cache.SerializerPath', $cachedir);
$config->set('Cache.SerializerPermissions', $CFG->directorypermissions);
$config->set('Core.NormalizeNewlines', false);
@@ -1750,6 +1750,9 @@ function purify_html($text, $options = array()) {
$def->addElement('algebra', 'Inline', 'Inline', array()); // Algebra syntax, equivalent to @@xx@@.
$def->addElement('lang', 'Block', 'Flow', array(), array('lang'=>'CDATA')); // Original multilang style - only our hacked lang attribute.
$def->addAttribute('span', 'xxxlang', 'CDATA'); // Current very problematic multilang.
// Use the built-in Ruby module to add annotation support.
$def->manager->addModule(new HTMLPurifier_HTMLModule_Ruby());
}
$purifier = new HTMLPurifier($config);