From 4010978ebffd45e9e04aeeecf6759e725500ee43 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sat, 5 Dec 2015 12:04:48 +0000 Subject: [PATCH] Add inverse of texToClass function in comment Change-Id: Iba9658cfb8f413eaff8cdd62b6b7b2d836c5b23d --- modules/ve-math/tools/makeSvgsAndCss.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/ve-math/tools/makeSvgsAndCss.js b/modules/ve-math/tools/makeSvgsAndCss.js index fdaee6e04..ba4ff5f17 100755 --- a/modules/ve-math/tools/makeSvgsAndCss.js +++ b/modules/ve-math/tools/makeSvgsAndCss.js @@ -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 ) { - // Make the className, replacing any non-alphanumerics with their character code return tex.replace( /[^\w]/g, function ( c ) { return '_' + c.charCodeAt( 0 ) + '_'; } );