enclose.js 1.2 KB

12345678910111213
  1. /*
  2. * /MathJax/extensions/TeX/enclose.js
  3. *
  4. * Copyright (c) 2009-2013 The MathJax Consortium
  5. *
  6. * Part of the MathJax library.
  7. * See http://www.mathjax.org for details.
  8. *
  9. * Licensed under the Apache License, Version 2.0;
  10. * you may not use this file except in compliance with the License.
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. */MathJax.Extension["TeX/enclose"]={version:"2.2",ALLOWED:{arrow:1,color:1,mathcolor:1,background:1,mathbackground:1,padding:1,thickness:1}};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var d=MathJax.InputJax.TeX,g=MathJax.ElementJax.mml,h=MathJax.Extension["TeX/enclose"].ALLOWED;d.Definitions.Add({macros:{enclose:"Enclose"}},null,!0);d.Parse.Augment({Enclose:function(b){var e=this.GetArgument(b),c=this.GetBrackets(b);b=this.ParseArg(b);e={notation:e.replace(/,/g," ")};if(c)for(var c=c.replace(/ /g,"").split(/,/),f=0,d=c.length;f<d;f++){var a=c[f].split(/[:=]/);h[a[0]]&&(a[1]=a[1].replace(/^"(.*)"$/,"$1"),"true"===a[1]&&(a[1]=!0),"false"===a[1]&&(a[1]=!1),e[a[0]]=a[1])}this.Push(g.menclose(b).With(e))}});MathJax.Hub.Startup.signal.Post("TeX enclose Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/enclose.js");