Skip to content

Commit

Permalink
MDL-18893 TeX filter - fine tune "def" commands + add some more comma…
Browse files Browse the repository at this point in the history
…nds to blacklist (from Kopete).

Thanks to Mauno Korpelainen and Steve Mayer. Backported from 19_STABLE
  • Loading branch information
stronk7 committed Apr 20, 2009
1 parent 3f6ce53 commit bdcc247
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions filter/tex/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
function tex_sanitize_formula($texexp) {
/// Check $texexp against blacklist (whitelisting could be more complete but also harder to maintain)
$tex_blacklist = array(
'include','def','command','loop','repeat','open','toks','output',
'include','command','loop','repeat','open','toks','output',
'input','catcode','name','^^',
'\def','\edef','\gdef','\xdef',
'\every','\errhelp','\errorstopmode','\scrollmode','\nonstopmode',
'\batchmode','\read','\write','csname','\newhelp','\uppercase',
'\lowercase','\relax','\aftergroup',
'\afterassignment','\expandafter','\noexpand','\special'
'\afterassignment','\expandafter','\noexpand','\special',
'\let', '\futurelet','\else','\fi','\chardef','\makeatletter','\afterground',
'\noexpand','\line','\mathcode','\item','\section','\mbox','\declarerobustcommand'
);

return str_ireplace($tex_blacklist, 'forbiddenkeyword', $texexp);
Expand All @@ -34,4 +37,4 @@ function filter_tex_updatedcallback($name) {
delete_records('cache_filters', 'filter', 'algebra');
}

?>
?>

0 comments on commit bdcc247

Please sign in to comment.