mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-28 01:10:09 +00:00
Add inverse of texToClass function in comment
Change-Id: Iba9658cfb8f413eaff8cdd62b6b7b2d836c5b23d
This commit is contained in:
parent
92bd24474c
commit
4010978ebf
|
@ -35,8 +35,16 @@
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make the className, replacing any non-alphanumerics with their character code
|
||||||
|
*
|
||||||
|
* The reverse of function would look like this, although we have no use for it yet:
|
||||||
|
*
|
||||||
|
* return className.replace( /_([0-9]+)_/g, function () {
|
||||||
|
* return String.fromCharCode( +arguments[ 1 ] );
|
||||||
|
* } );
|
||||||
|
*/
|
||||||
function texToClass( tex ) {
|
function texToClass( tex ) {
|
||||||
// Make the className, replacing any non-alphanumerics with their character code
|
|
||||||
return tex.replace( /[^\w]/g, function ( c ) {
|
return tex.replace( /[^\w]/g, function ( c ) {
|
||||||
return '_' + c.charCodeAt( 0 ) + '_';
|
return '_' + c.charCodeAt( 0 ) + '_';
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in a new issue