MDL-21407 tex filter - trim leading whitespace from latex preamble. Merged from 19_STABLE

This commit is contained in:
Eloy Lafuente 2010-02-03 09:23:37 +00:00
parent d3d393ab37
commit 073d380425
3 changed files with 12 additions and 3 deletions

View File

@ -5,10 +5,9 @@ require_once($CFG->dirroot.'/filter/tex/lib.php');
$items = array();
$items[] = new admin_setting_heading('filter_tex_latexheading', get_string('latexsettings', 'admin'), '');
$items[] = new admin_setting_configtextarea('filter_tex_latexpreamble', get_string('latexpreamble','admin'),
'', " \\usepackage[latin1]{inputenc}\n \\usepackage{amsmath}\n \\usepackage{amsfonts}\n \\RequirePackage{amsmath,amssymb,latexsym}\n");
'', "\\usepackage[latin1]{inputenc}\n\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\RequirePackage{amsmath,amssymb,latexsym}\n");
$items[] = new admin_setting_configtext('filter_tex_latexbackground', get_string('backgroundcolour', 'admin'), '', '#FFFFFF');
$items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
$items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
if (PHP_OS=='Linux') {
$default_filter_tex_pathlatex = "/usr/bin/latex";

View File

@ -3029,6 +3029,16 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
}
upgrade_main_savepoint($result, 2010020300);
}
// MDL-21407. Trim leading spaces from default tex latexpreamble causing problems under some confs
if ($result && $oldversion < 2010020301) {
if ($preamble = $CFG->filter_tex_latexpreamble) {
$preamble = preg_replace('/^ +/m', '', $preamble);
set_config('filter_tex_latexpreamble', $preamble);
}
upgrade_main_savepoint($result, 2010020301);
}
return $result;
}

View File

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2010020300; // YYYYMMDD = date of the last version bump
$version = 2010020301; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20100203)'; // Human-friendly version name