HTML.js 2.0 KB

12345678910111213141516171819202122232425
  1. /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
  2. /* vim: set ts=2 et sw=2 tw=80: */
  3. /*************************************************************
  4. *
  5. * MathJax/extensions/TeX/HTML.js
  6. *
  7. * Implements the \href, \class, \style, \cssId macros.
  8. *
  9. * ---------------------------------------------------------------------
  10. *
  11. * Copyright (c) 2010-2013 The MathJax Consortium
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the "License");
  14. * you may not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * http://www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS,
  21. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. */MathJax.Extension["TeX/HTML"]={version:"2.2"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var c=MathJax.InputJax.TeX;c.Definitions.Add({macros:{href:"HREF_attribute","class":"CLASS_attribute",style:"STYLE_attribute",cssId:"ID_attribute"}},null,!0);c.Parse.Augment({HREF_attribute:function(a){var b=this.GetArgument(a);a=this.GetArgumentMML(a);this.Push(a.With({href:b}))},CLASS_attribute:function(a){var b=this.GetArgument(a);a=this.GetArgumentMML(a);null!=a["class"]&&(b=a["class"]+" "+b);this.Push(a.With({"class":b}))},STYLE_attribute:function(a){var b=this.GetArgument(a);a=this.GetArgumentMML(a);null!=a.style&&(";"!==b.charAt(b.length-1)&&(b+=";"),b=a.style+" "+b);this.Push(a.With({style:b}))},ID_attribute:function(a){var b=this.GetArgument(a);a=this.GetArgumentMML(a);this.Push(a.With({id:b}))},GetArgumentMML:function(a){a=this.ParseArg(a);a.inferred&&1==a.data.length?a=a.data[0]:delete a.inferred;return a}});MathJax.Hub.Startup.signal.Post("TeX HTML Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/HTML.js");