wfEscapeSingleQuotes() change proposed by Ralf Lederle in
https://bugzilla.wikimedia.org/show_bug.cgi?id=13518#c11 For Bug 13518 - <math> does not work (wrong shell escaping under Windows)
This commit is contained in:
parent
040710a2f9
commit
8aab88b76d
|
@ -10,6 +10,17 @@
|
|||
* @ingroup Parser
|
||||
*/
|
||||
|
||||
if ( !function_exists('wfEscapeSingleQuotes') ) {
|
||||
/**
|
||||
* Escapes a string with single quotes for a UNIX shell.
|
||||
* It's equivalente to escapeshellarg() in UNIX, but also
|
||||
* working in Windows, where we need it for cygwin shell.
|
||||
*/
|
||||
function wfEscapeSingleQuotes( $str ) {
|
||||
return "'" . str_replace( "'", "'\\''", $str ) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes LaTeX fragments, sends them to a helper program (texvc) for rendering
|
||||
* to rasterized PNG and HTML and MathML approximations. An appropriate
|
||||
|
@ -65,11 +76,11 @@ class MathRenderer {
|
|||
return $this->_error( 'math_notexvc' );
|
||||
}
|
||||
$cmd = $wgTexvc . ' ' .
|
||||
escapeshellarg( $wgTmpDirectory ).' '.
|
||||
escapeshellarg( $wgTmpDirectory ).' '.
|
||||
escapeshellarg( $this->tex ).' '.
|
||||
escapeshellarg( 'UTF-8' ).' '.
|
||||
escapeshellarg( $wgTexvcBackgroundColor );
|
||||
wfEscapeSingleQuotes( $wgTmpDirectory ) . ' '.
|
||||
wfEscapeSingleQuotes( $wgTmpDirectory ) . ' '.
|
||||
wfEscapeSingleQuotes( $this->tex ) . ' '.
|
||||
wfEscapeSingleQuotes( 'UTF-8' ) . ' '.
|
||||
wfEscapeSingleQuotes( $wgTexvcBackgroundColor );
|
||||
|
||||
if ( wfIsWindows() ) {
|
||||
# Invoke it within cygwin sh, because texvc expects sh features in its default shell
|
||||
|
|
Loading…
Reference in New Issue