<commit_before>export default Ember.ObjectController.extend({

  detailedLogging: false,

  actions: {
    save: function(status) {
      console.log(status);
      var day = this.get('model'),
          routines = day.get('routines');
      day.set('status', status);
      routines.forEach(function(routine) {
        var workouts = routine.get('workouts');
        workouts.forEach(function(workout) {
          var entry = workout.get('entry'),
              sets = entry.get('sets');
          // sets.forEach(function(set) {
          //   console.log('saving set: ' + set.get('set_number'));
          //   set.save();
          // });
          console.log('saving sets');
          sets.save().then(function() {
            console.log('saving entry');
            entry.save();
          });
        })
      });
      console.log('saving routine');
      routines.save();
      console.log('saving day');
      day.save();
    }
  }

});
<commit_msg>removing commented out code that is not needed<commit_after>export default Ember.ObjectController.extend({

  detailedLogging: false,

  actions: {
    save: function(status) {
      console.log(status);
      var day = this.get('model'),
          routines = day.get('routines');
      day.set('status', status);
      routines.forEach(function(routine) {
        var workouts = routine.get('workouts');
        workouts.forEach(function(workout) {
          var entry = workout.get('entry'),
              sets = entry.get('sets');
          console.log('saving sets');
          sets.save().then(function() {
            console.log('saving entry');
            entry.save();
          });
        })
      });
      console.log('saving routine');
      routines.save();
      console.log('saving day');
      day.save();
    }
  }

});
<|endoftext|>


<commit_before>defineAttr(ClassOrInterface$model.$$.prototype,'interfaces',function(){
  var ints = this.tipo.$$metamodel$$['satisfies'];
  if (ints && ints.length) {
    var rv = [];
    for (var i=0; i < ints.length; i++) {
      var ifc = ints[i].t;
      var mm = ifc.$$metamodel$$;
      if (typeof(mm)==='function') {
        mm = mm();
        ifc.$$metamodel$$=mm;
      }
      rv.push(AppliedInterface(ifc, {Type:{t:Anything}}));
    }
    return rv.reifyCeylonType({Absent:{t:Null},Element:{t:Interface$model,a:{Type:{t:Anything}}}});
  }
  return getEmpty();
},undefined,function(){
  return{mod:$$METAMODEL$$,$t:{t:Sequential,a:{Element:{t:Interface$model,a:{Type:{t:Anything}}}}},$cont:ClassOrInterface$model,
  $an:function(){return[shared(),formal()];},d:['ceylon.language.model','ClassOrInterface','$at','interfaces']};
});
ClassOrInterface$model.$$.prototype.getMethod=function(name,types,$$$mptypes) {
  console.log("IMPLEMENT ME! ClassOrInterface.getMethod");
  return null;
}

<commit_msg>implement ClassOrInterface.getMethod<commit_after>defineAttr(ClassOrInterface$model.$$.prototype,'interfaces',function(){
  var ints = this.tipo.$$metamodel$$['satisfies'];
  if (ints && ints.length) {
    var rv = [];
    for (var i=0; i < ints.length; i++) {
      var ifc = ints[i].t;
      var mm = ifc.$$metamodel$$;
      if (typeof(mm)==='function') {
        mm = mm();
        ifc.$$metamodel$$=mm;
      }
      rv.push(AppliedInterface(ifc, {Type:{t:Anything}}));
    }
    return rv.reifyCeylonType({Absent:{t:Null},Element:{t:Interface$model,a:{Type:{t:Anything}}}});
  }
  return getEmpty();
},undefined,function(){
  return{mod:$$METAMODEL$$,$t:{t:Sequential,a:{Element:{t:Interface$model,a:{Type:{t:Anything}}}}},$cont:ClassOrInterface$model,
  $an:function(){return[shared(),formal()];},d:['ceylon.language.model','ClassOrInterface','$at','interfaces']};
});
ClassOrInterface$model.$$.prototype.getMethod=function(name,types,$$$mptypes) {
  var fun = this.tipo[name];
  if (fun === undefined) fun = this.tipo.$$.prototype[name];
  return AppliedMethod(this.tipo, fun, {Container:$$$mptypes.SubType,Type:$$$mptypes.Type,Arguments:$$$mptypes.Arguments});
}
ClassOrInterface$model.$$.prototype.getMethod.$$metamodel$$=function(){return{mod:$$METAMODEL$$,$t:{t:Method$model,a:{SubType:'SubType',Type:'Type',Arguments:'Arguments'}},$an:function(){return[shared(),formal()];},d:['ceylon.language.model','ClassOrInterface']};};
<|endoftext|>


<commit_before>sap.ui.define([
   'sap/ui/core/mvc/Controller',
   'sap/ui/model/json/JSONModel',
   'sap/ui/commons/CheckBox',
   'sap/ui/commons/Menu',
   'sap/ui/commons/MenuItem',
   'sap/ui/core/Item',
   'sap/ui/table/Column',
   'sap/m/Input',
   'sap/m/Button',
   "sap/ui/core/ResizeHandler",
   "sap/ui/layout/VerticalLayout",
   "sap/ui/layout/HorizontalLayout"
], function (Controller, JSONModel, CheckBox, Menu, MenuItem, coreItem, Column,
             mInput, mButton, ResizeHandler, VerticalLayout, HorizontalLayout) {

   "use strict";

   return Controller.extend("rootui5.eve7.controller.EveTable", {

      onInit : function() {
         var data = this.getView().getViewData();
         // console.log("VIEW DATA", data);

         var id = this.getView().getId();
         console.log("eve.GL.onInit id = ", id );

         this._load_scripts = true;
         this._render_html = false;

         this.mgr = data.mgr;
         this.elementid = data.elementid;
         this.kind = data.kind;

         var element = this.mgr.GetElement(this.elementid);
         // loop over scene and add dependency
         for (var k=0;k<element.childs.length;++k) {
            var scene = element.childs[k];
            this.mgr.RegisterSceneReceiver(scene.fSceneId, this);
            console.log("on init ....table controller");
            this.onSceneCreate();
         }
      },

      locateEveTable: function()
      {
         this.eveTable = 0;
         var element = this.mgr.GetElement(this.elementid);
         var sceneInfo = element.childs[0];
         var scene = this.mgr.GetElement(sceneInfo.fSceneId);
         // console.log(">>>table scene", scene);
         if (scene.childs[0]._typename == "ROOT::Experimental::REveTableViewInfo") {
            // presume table view manger is first child of table scene
            this.viewInfo = scene.childs[0];
         }

         console.log("table viewinfo", this.viewInfo  );
         this.collection = this.mgr.GetElement(this.viewInfo.fDisplayedCollection);
         // loop over products
         for (var i = 1; i < scene.childs.length; ++i) {
            var product = scene.childs[i];
            if (product.childs && product.childs.length && product.childs[0].fCollectionId == this.viewInfo.fDisplayedCollection) {
               console.log("table found  ",product.childs[0] );
               this.eveTable =  product.childs[0];
               break;
            }
         }

      },

      buildTableBody: function(doBind)
      {

         // amt
         //return;
         var oTable = this.getView().byId("table");

         // column definition
         var columnData = [];

         columnData.push({columnName:"Name"});
         columnData.push({columnName:"Filtered"});

         console.log("buildTableBody",this.eveTable );
         var eveColumns = this.eveTable.childs;
         for (var i = 0; i < eveColumns.length; i++)
         {
            var cname = eveColumns[i].fName;
            columnData.push({columnName : cname});
         }

         // row definition
         var rowData = this.eveTable.body;
         for (var i = 0; i < this.collection.childs.length; i++)
         {
            rowData[i].Name =  this.collection.childs[i].fName;
            rowData[i].Filtered =  this.collection.childs[i].fFiltered === true ? "--" : "*";
         }

         // table model
         var oModel = new JSONModel();
         oModel.setData({
            rows: rowData,
            columns: columnData
         });
         oTable.setModel(oModel);
         console.log("column table data ",columnData );

         if (doBind) {
            // bind rows and columns
            oTable.bindColumns("/columns", function(sId, oContext) {
               var columnName = oContext.getObject().columnName;
               var oColumn = new Column({
                  label: columnName,
                  template: columnName,
                  sortProperty: columnName,
                  showFilterMenuEntry: true
               });
               return oColumn;
            });
            oTable.bindRows("/rows");
         }
      },

      buildTableHeader: function()
      {
         var oModel = new JSONModel();
         var collection = this.mgr.GetElement(this.eveTable.fCollectionId);
         var clist = this.mgr.GetElement(collection.fMotherId);
         // console.log("collection list ", clist);

	 var mData = {
	    "itemx": [
	    ]};

         for (var i = 0; i < clist.childs.length; i++)
         {
            mData.itemx.push({"text" :clist.childs[i].fName, "key": clist.childs[i].fName, "elementId":clist.childs[i].fElementId });
         }
         oModel.setData(mData);
         this.getView().setModel(oModel, "collections");

         var combo = this.getView().byId("ccombo");
         combo.setSelectedKey(collection.fName);
         combo.data("controller", this);
      },

      onLoadScripts: function() {
         this._load_scripts = true;
         this.checkScenes();
      },

      // function called from GuiPanelController
      onExit : function() {
         if (this.mgr) this.mgr.Unregister(this);
      },

      onSceneCreate: function(element, id) {
         console.log("EveTable onSceneChanged", id);
         this.locateEveTable();
         this.buildTableHeader();
         this.buildTableBody(true);
      },

      UpdateMgr : function(mgr) {
         var elem = mgr.map[this.elementid];
         var scene = mgr.map[ elem.fMotherId];
         this.mgr = mgr;
      },

      onAfterRendering: function() {
         this._render_html = true;

         // this.getView().$().css("overflow", "hidden");

         // this.getView().$().parent().css("overflow", "hidden");

         // only when rendering completed - register for modify events
         var element = this.mgr.GetElement(this.elementid);

         this.checkScenes();
      },

      checkScenes: function() {
      },

      toggleTableEdit: function() {

         var header = this.getView().byId("header");
         if (!this.editor) {
            this.editor = new VerticalLayout("tableEdit", {"width":"100%"});

            header.addContent(this.editor);

            // expression row
            {
               var collection = this.mgr.GetElement(this.eveTable.fCollectionId);
               var oModel = new JSONModel();
               oModel.setData(collection.publicFunction);
               // oModel.setData(aData);
               this.getView().setModel(oModel);

               var exprIn = new mInput("expression", {
                                         width:"98%",
                                         type : sap.m.InputType.Text,
                                         placeholder: "Expression",
                                         showSuggestion: true
                                       });
               exprIn.setModel(oModel);
               exprIn.bindAggregation("suggestionItems", "/", new coreItem({text: "{name}"}));
               exprIn.setFilterFunction(function(sTerm, oItem) {
                  // A case-insensitive 'string contains' style filter
                  // console.log("filter sterm", sTerm);
                  var base = sTerm;
                  var n = base.lastIndexOf("i.");
                  // console.log("last index ", n);
                  if (n>=0) n+=2;
                  var txt = base.substring(n,this.getFocusInfo().cursorPos );
                  // console.log("suggest filter ", txt);
                  // console.log("focus 1", this.getFocusInfo());

                  return oItem.getText().match(new RegExp(txt, "i"));
               });
               this.editor.addContent(exprIn);
            }

            // title & prec
            {
               var hl = new HorizontalLayout();
               var titleIn = new mInput("title", {placeholder:"Title", tooltip:"title"});
               titleIn.setWidth("98%");
               hl.addContent(titleIn);
               //this.editor.addContent(titleIn);

               var precIn = new mInput("precision", {placeholder:"Precision", type: sap.m.InputType.Number, constraints: {minimum:"0", maximum:"9"}});
               // precIn.bindProperty("value", "abc>precision");
               precIn.setWidth("100px");

               hl.addContent(precIn);

               this.editor.addContent(hl);

            }

            //  button actions
            {
               var ll = new HorizontalLayout();
               var addBut = new mButton("AddCol", {text:"Add", press: this.addColumn});
               addBut.data("controller", this);
               ll.addContent(addBut);
               this.editor.visible = true;
               this.editor.addContent(ll);
            }
            return;
         }

         if (this.editor.visible) {
            var x = header.getContent().pop();
            header.removeContent(x);
            this.editor.visible = false;
         }
         else {
            header.addContent(this.editor);
            this.editor.visible = true;
         }
      },

      addColumn: function(event) {
         // console.log("add column s", event.getSource(), this);
         // console.log("add column p", this.data("controller"));
         var pthis = this.data("controller");
         var ws = pthis.editor.getContent();

         var expr = ws[0].getProperty("value");
         if (!expr) {
            alert("need a new column expression");
         }
         var hl =  ws[1].getContent();
         var title = hl[0].getProperty("value");
         if (!title) {
            title = expr;
         }

         var mir = "AddNewColumnToCurrentCollection( \"" + expr + "\", \"" + title + "\" )";

         // console.log("table element id ", pthis.eveTable.fElementId);

         var obj = {"mir" : mir, "fElementId" :pthis.viewInfo.fElementId, "class" : pthis.eveTable._typename};
         // console.log("MIR obj ", obj);
         pthis.mgr.handle.Send(JSON.stringify(obj));
      },

      collectionChanged: function(oEvent) {
         // console.log("collectionChanged ", oEvent.getSource());
         var model = oEvent.oSource.getSelectedItem().getBindingContext("collections");
         var path = model.getPath();
         var entry = model.getProperty(path);
         var coll = entry.elementId;
         var mng =  this.viewInfo;
         var mir = {"elementid" : mng.fElementId, "elementclass":mng._typename};
         mir.func = "SetDisplayedCollection(" + coll + ")";

         this.mgr.executeCommand(mir);
      },

      sceneElementChange : function(msg)
      {
        // AMT for the moment always recreate table in endChanges
        // var el = this.mgr.GetElement(msg.fElementId);
        // this[msg.tag](el);
      },

      endChanges : function(oEvent) {
         console.log("table controller endChanges ",this.eveTable );
          this.locateEveTable();
         this.buildTableBody(false);
      },

      elementRemoved: function(elId) {
         var el = this.mgr.GetElement(elId);
         // console.log("EveTable element removed ", el);
      }
   });
});
<commit_msg>Remove trailing white space<commit_after>sap.ui.define([
   'sap/ui/core/mvc/Controller',
   'sap/ui/model/json/JSONModel',
   'sap/ui/commons/CheckBox',
   'sap/ui/commons/Menu',
   'sap/ui/commons/MenuItem',
   'sap/ui/core/Item',
   'sap/ui/table/Column',
   'sap/m/Input',
   'sap/m/Button',
   "sap/ui/core/ResizeHandler",
   "sap/ui/layout/VerticalLayout",
   "sap/ui/layout/HorizontalLayout"
], function (Controller, JSONModel, CheckBox, Menu, MenuItem, coreItem, Column,
             mInput, mButton, ResizeHandler, VerticalLayout, HorizontalLayout) {

   "use strict";

   return Controller.extend("rootui5.eve7.controller.EveTable", {

      onInit : function() {
         var data = this.getView().getViewData();
         // console.log("VIEW DATA", data);

         var id = this.getView().getId();
         console.log("eve.GL.onInit id = ", id );

         this._load_scripts = true;
         this._render_html = false;

         this.mgr = data.mgr;
         this.elementid = data.elementid;
         this.kind = data.kind;

         var element = this.mgr.GetElement(this.elementid);
         // loop over scene and add dependency
         for (var k=0;k<element.childs.length;++k) {
            var scene = element.childs[k];
            this.mgr.RegisterSceneReceiver(scene.fSceneId, this);
            console.log("on init ....table controller");
            this.onSceneCreate();
         }
      },

      locateEveTable: function()
      {
         this.eveTable = 0;
         var element = this.mgr.GetElement(this.elementid);
         var sceneInfo = element.childs[0];
         var scene = this.mgr.GetElement(sceneInfo.fSceneId);
         // console.log(">>>table scene", scene);
         if (scene.childs[0]._typename == "ROOT::Experimental::REveTableViewInfo") {
            // presume table view manger is first child of table scene
            this.viewInfo = scene.childs[0];
         }

         console.log("table viewinfo", this.viewInfo  );
         this.collection = this.mgr.GetElement(this.viewInfo.fDisplayedCollection);
         // loop over products
         for (var i = 1; i < scene.childs.length; ++i) {
            var product = scene.childs[i];
            if (product.childs && product.childs.length && product.childs[0].fCollectionId == this.viewInfo.fDisplayedCollection) {
               console.log("table found  ",product.childs[0] );
               this.eveTable =  product.childs[0];
               break;
            }
         }

      },

      buildTableBody: function(doBind)
      {

         // amt
         //return;
         var oTable = this.getView().byId("table");

         // column definition
         var columnData = [];

         columnData.push({columnName:"Name"});
         columnData.push({columnName:"Filtered"});

         console.log("buildTableBody",this.eveTable );
         var eveColumns = this.eveTable.childs;
         for (var i = 0; i < eveColumns.length; i++)
         {
            var cname = eveColumns[i].fName;
            columnData.push({columnName : cname});
         }

         // row definition
         var rowData = this.eveTable.body;
         for (var i = 0; i < this.collection.childs.length; i++)
         {
            rowData[i].Name =  this.collection.childs[i].fName;
            rowData[i].Filtered =  this.collection.childs[i].fFiltered === true ? "--" : "*";
         }

         // table model
         var oModel = new JSONModel();
         oModel.setData({
            rows: rowData,
            columns: columnData
         });
         oTable.setModel(oModel);
         console.log("column table data ",columnData );

         if (doBind) {
            // bind rows and columns
            oTable.bindColumns("/columns", function(sId, oContext) {
               var columnName = oContext.getObject().columnName;
               var oColumn = new Column({
                  label: columnName,
                  template: columnName,
                  sortProperty: columnName,
                  showFilterMenuEntry: true
               });
               return oColumn;
            });
            oTable.bindRows("/rows");
         }
      },

      buildTableHeader: function()
      {
         var oModel = new JSONModel();
         var collection = this.mgr.GetElement(this.eveTable.fCollectionId);
         var clist = this.mgr.GetElement(collection.fMotherId);
         // console.log("collection list ", clist);

	 var mData = {
	    "itemx": [
	    ]};

         for (var i = 0; i < clist.childs.length; i++)
         {
            mData.itemx.push({"text" :clist.childs[i].fName, "key": clist.childs[i].fName, "elementId":clist.childs[i].fElementId });
         }
         oModel.setData(mData);
         this.getView().setModel(oModel, "collections");

         var combo = this.getView().byId("ccombo");
         combo.setSelectedKey(collection.fName);
         combo.data("controller", this);
      },

      onLoadScripts: function() {
         this._load_scripts = true;
         this.checkScenes();
      },

      // function called from GuiPanelController
      onExit : function() {
         if (this.mgr) this.mgr.Unregister(this);
      },

      onSceneCreate: function(element, id) {
         console.log("EveTable onSceneChanged", id);
         this.locateEveTable();
         this.buildTableHeader();
         this.buildTableBody(true);
      },

      UpdateMgr : function(mgr) {
         var elem = mgr.map[this.elementid];
         var scene = mgr.map[ elem.fMotherId];
         this.mgr = mgr;
      },

      onAfterRendering: function() {
         this._render_html = true;

         // this.getView().$().css("overflow", "hidden");

         // this.getView().$().parent().css("overflow", "hidden");

         // only when rendering completed - register for modify events
         var element = this.mgr.GetElement(this.elementid);

         this.checkScenes();
      },

      checkScenes: function() {
      },

      toggleTableEdit: function() {

         var header = this.getView().byId("header");
         if (!this.editor) {
            this.editor = new VerticalLayout("tableEdit", {"width":"100%"});

            header.addContent(this.editor);

            // expression row
            {
               var collection = this.mgr.GetElement(this.eveTable.fCollectionId);
               var oModel = new JSONModel();
               oModel.setData(collection.publicFunction);
               // oModel.setData(aData);
               this.getView().setModel(oModel);

               var exprIn = new mInput("expression", {
                                         width:"98%",
                                         type : sap.m.InputType.Text,
                                         placeholder: "Expression",
                                         showSuggestion: true
                                       });
               exprIn.setModel(oModel);
               exprIn.bindAggregation("suggestionItems", "/", new coreItem({text: "{name}"}));
               exprIn.setFilterFunction(function(sTerm, oItem) {
                  // A case-insensitive 'string contains' style filter
                  // console.log("filter sterm", sTerm);
                  var base = sTerm;
                  var n = base.lastIndexOf("i.");
                  // console.log("last index ", n);
                  if (n>=0) n+=2;
                  var txt = base.substring(n,this.getFocusInfo().cursorPos );
                  // console.log("suggest filter ", txt);
                  // console.log("focus 1", this.getFocusInfo());

                  return oItem.getText().match(new RegExp(txt, "i"));
               });
               this.editor.addContent(exprIn);
            }

            // title & prec
            {
               var hl = new HorizontalLayout();
               var titleIn = new mInput("title", {placeholder:"Title", tooltip:"title"});
               titleIn.setWidth("98%");
               hl.addContent(titleIn);
               //this.editor.addContent(titleIn);

               var precIn = new mInput("precision", {placeholder:"Precision", type: sap.m.InputType.Number, constraints: {minimum:"0", maximum:"9"}});
               // precIn.bindProperty("value", "abc>precision");
               precIn.setWidth("100px");

               hl.addContent(precIn);

               this.editor.addContent(hl);

            }

            //  button actions
            {
               var ll = new HorizontalLayout();
               var addBut = new mButton("AddCol", {text:"Add", press: this.addColumn});
               addBut.data("controller", this);
               ll.addContent(addBut);
               this.editor.visible = true;
               this.editor.addContent(ll);
            }
            return;
         }

         if (this.editor.visible) {
            var x = header.getContent().pop();
            header.removeContent(x);
            this.editor.visible = false;
         }
         else {
            header.addContent(this.editor);
            this.editor.visible = true;
         }
      },

      addColumn: function(event) {
         // console.log("add column s", event.getSource(), this);
         // console.log("add column p", this.data("controller"));
         var pthis = this.data("controller");
         var ws = pthis.editor.getContent();

         var expr = ws[0].getProperty("value");
         if (!expr) {
            alert("need a new column expression");
         }
         var hl =  ws[1].getContent();
         var title = hl[0].getProperty("value");
         if (!title) {
            title = expr;
         }

         var mir = "AddNewColumnToCurrentCollection( \"" + expr + "\", \"" + title + "\" )";

         // console.log("table element id ", pthis.eveTable.fElementId);

         var obj = {"mir" : mir, "fElementId" :pthis.viewInfo.fElementId, "class" : pthis.eveTable._typename};
         // console.log("MIR obj ", obj);
         pthis.mgr.handle.Send(JSON.stringify(obj));
      },

      collectionChanged: function(oEvent) {
         // console.log("collectionChanged ", oEvent.getSource());
         var model = oEvent.oSource.getSelectedItem().getBindingContext("collections");
         var path = model.getPath();
         var entry = model.getProperty(path);
         var coll = entry.elementId;
         var mng =  this.viewInfo;
         var mir = {"elementid" : mng.fElementId, "elementclass":mng._typename};
         mir.func = "SetDisplayedCollection(" + coll + ")";

         this.mgr.executeCommand(mir);
      },

      sceneElementChange : function(msg)
      {
        // AMT for the moment always recreate table in endChanges
        // var el = this.mgr.GetElement(msg.fElementId);
        // this[msg.tag](el);
      },

      endChanges : function(oEvent) {
         console.log("table controller endChanges ",this.eveTable );
         this.locateEveTable();
         this.buildTableBody(false);
      },

      elementRemoved: function(elId) {
         var el = this.mgr.GetElement(elId);
         // console.log("EveTable element removed ", el);
      }
   });
});
<|endoftext|>


<commit_before>запроситьМодуль('./руссфифцировать.джаваскрипт');

function являетсяИнтересным(число, офигенныеФразы) {

  var интересное = function (число) {
    return число.является(почтиИнтересным).илиЖе(одноИз, офигенныеФразы).вНатуре();
  }

  if (число.имеет(корректнуюДлину).иЕще(интересное).вНатуре()) {
    return 2;
  }

  var другиеЧислаЯвляютсяИнтересными = [число + 1, число + 2].хотяБыОдинЭлемент(function (число) {
    return число.имеет(корректнуюДлину).иЕще(интересное).вНатуре();
  });

  if (другиеЧислаЯвляютсяИнтересными) {
    return 1;
  }

  return 0;
}

function почтиИнтересным(число) {
  return число.имеет(нулиВКонце).илиИмеет(одинаковыеЦифры).илиЖе(возрастающаяПоследовательность)
    .илиЖе(убывающаяПоследовательность).илиЖе(палиндром).вНатуре();
}

function корректнуюДлину(число) {
  return число.кСтроке().длина > 2;
}

function нулиВКонце(число) {
  var цифры = число.кСтроке();
  return цифры.срезать(1).разделить('').каждая(function (цифра) { return цифра == 0; });
}

function одинаковыеЦифры(число) {
  var цифры = число.кСтроке();
  return цифры.разделить('').каждая(function (цифра) { return цифра == цифры[0]; });
}

var возрПоследовательность = '1234567890';

function возрастающаяПоследовательность(число) {
  var цифры = число.кСтроке();
  return возрПоследовательность.взятьИндекс(цифры) != -1;
}

var убывПоследовательность = '0123456789';

function убывающаяПоследовательность(число) {
  var цифры = число.кСтроке();
  return убывПоследовательность.взятьИндекс(цифры) != -1;
}

function палиндром(число) {
  var цифры = число.кСтроке();
  return цифры == цифры.разделить('').наоборот().соединить('');
}

function одноИз(число, массив) {
  return массив.взятьИндекс(число) != -1;
}

Число.прототип.является = Число.прототип.являются = Число.прототип.имеет = Число.прототип.имеют = function (предикат, аргументы) {
  var аргументы = [ this.значение() ].concat(Массив.прототип.срезать.вызвать(arguments, 1));
  return new ПредикатнаяОбертка(this.значение(), предикат.применить(ничто, аргументы));
};

function ПредикатнаяОбертка(субъект, начальноеЗначение) {
  this.субъект = субъект;
  this.логическоеЗначение = начальноеЗначение;
}

var прототипОбертки = ПредикатнаяОбертка.прототип;

прототипОбертки.иИмеют = прототипОбертки.иИмеет = прототипОбертки.иЯвляются = прототипОбертки.иЯвляется = function (предикат, аргументы) {
  var аргументы = [ this.субъект ].concat(Массив.прототип.срезать.вызвать(arguments, 1));
  this.логическоеЗначение = this.логическоеЗначение && предикат.применить(ничто, аргументы);
  return this;
};

прототипОбертки.илиИмеют = прототипОбертки.илиИмеет = прототипОбертки.илиЯвляются = прототипОбертки.илиЯвляется = function (предикат, аргументы) {
  var аргументы = [ this.субъект ].concat(Массив.прототип.срезать.вызвать(arguments, 1));
  this.логическоеЗначение = this.логическоеЗначение || предикат.применить(ничто, аргументы);
  return this;
};

прототипОбертки.вНатуре = function () {
  return this.логическоеЗначение;
};

модуль.экспортированныеЭлементы = являетсяИнтересным;<commit_msg>fixed bug with descending sequences<commit_after>запроситьМодуль('./руссфифцировать.джаваскрипт');

function являетсяИнтересным(число, офигенныеФразы) {

  var интересное = function (число) {
    return число.является(почтиИнтересным).илиЖе(одноИз, офигенныеФразы).вНатуре();
  }

  if (число.имеет(корректнуюДлину).иЕще(интересное).вНатуре()) {
    return 2;
  }

  var другиеЧислаЯвляютсяИнтересными = [число + 1, число + 2].хотяБыОдинЭлемент(function (число) {
    return число.имеет(корректнуюДлину).иЕще(интересное).вНатуре();
  });

  if (другиеЧислаЯвляютсяИнтересными) {
    return 1;
  }

  return 0;
}

function почтиИнтересным(число) {
  return число.имеет(нулиВКонце).илиИмеет(одинаковыеЦифры).илиЖе(возрастающаяПоследовательность)
    .илиЖе(убывающаяПоследовательность).илиЖе(палиндром).вНатуре();
}

function корректнуюДлину(число) {
  return число.кСтроке().длина > 2;
}

function нулиВКонце(число) {
  var цифры = число.кСтроке();
  return цифры.срезать(1).разделить('').каждая(function (цифра) { return цифра == 0; });
}

function одинаковыеЦифры(число) {
  var цифры = число.кСтроке();
  return цифры.разделить('').каждая(function (цифра) { return цифра == цифры[0]; });
}

var возрПоследовательность = '1234567890';

function возрастающаяПоследовательность(число) {
  var цифры = число.кСтроке();
  return возрПоследовательность.взятьИндекс(цифры) != -1;
}

var убывПоследовательность = '9876543210';

function убывающаяПоследовательность(число) {
  var цифры = число.кСтроке();
  return убывПоследовательность.взятьИндекс(цифры) != -1;
}

function палиндром(число) {
  var цифры = число.кСтроке();
  return цифры == цифры.разделить('').наоборот().соединить('');
}

function одноИз(число, массив) {
  return массив.взятьИндекс(число) != -1;
}

Число.прототип.является = Число.прототип.являются = Число.прототип.имеет = Число.прототип.имеют = function (предикат, аргументы) {
  var аргументы = [ this.значение() ].concat(Массив.прототип.срезать.вызвать(arguments, 1));
  return new ПредикатнаяОбертка(this.значение(), предикат.применить(ничто, аргументы));
};

function ПредикатнаяОбертка(субъект, начальноеЗначение) {
  this.субъект = субъект;
  this.логическоеЗначение = начальноеЗначение;
}

var прототипОбертки = ПредикатнаяОбертка.прототип;

прототипОбертки.иИмеют = прототипОбертки.иИмеет = прототипОбертки.иЯвляются = прототипОбертки.иЯвляется = function (предикат, аргументы) {
  var аргументы = [ this.субъект ].concat(Массив.прототип.срезать.вызвать(arguments, 1));
  this.логическоеЗначение = this.логическоеЗначение && предикат.применить(ничто, аргументы);
  return this;
};

прототипОбертки.илиИмеют = прототипОбертки.илиИмеет = прототипОбертки.илиЯвляются = прототипОбертки.илиЯвляется = function (предикат, аргументы) {
  var аргументы = [ this.субъект ].concat(Массив.прототип.срезать.вызвать(arguments, 1));
  this.логическоеЗначение = this.логическоеЗначение || предикат.применить(ничто, аргументы);
  return this;
};

прототипОбертки.вНатуре = function () {
  return this.логическоеЗначение;
};

модуль.экспортированныеЭлементы = являетсяИнтересным;<|endoftext|>


<commit_before>#!/usr/bin/env node
//#############################################################################
// @author: Facundo Victor
// @licence: MIT
// @description: Script that allows to do a backup of your jsFiddles to disk.
//#############################################################################

var commander = require('commander');
var chalk = require('chalk');
var https = require('https');
var Promise = require('bluebird');
var cheerio = require('cheerio');
var url_parser = require('url');
var fs = Promise.promisifyAll(require("fs"));

//#############################################################################

commander
    .version('0.0.1')
    .option('-u, --user <user>', 'Save all the users fiddles')
    .option('-l, --link <url>', 'Url of the fiddle to save')
    .option('-o, --output <path>', 'Target path to download the data')
    .option('-c, --compressed', 'Compress the spaces of the HTML output')
    .option('-i, --identifier <fiddle_id>', 'Identifier of the fiddle to save')
    .option('-v, --verbose', 'Verbose output')
    .parse(process.argv);

//#############################################################################
// Print helpers

function logIfVerbose(str, error){
    if (commander.verbose){
        if (error){
            console.error(str);
        }else{
            console.log(chalk.bgGreen(str));
        }
    }
}

function printError(str){
    console.error(chalk.red(str));
}

//#############################################################################

function mkdirp (path) {
    Promise.bind(this)
        .then( function(){
            return Promise.promisify(fs.mkdir)(path);
        }).then( function(){
            logIfVerbose('Dir '+path+' created.');
        }).catch( function(error){
            if ( error.code != 'EEXIST' ) throw error;
        });
}

function isCommand(str){
    return /^show$|^embed$/.test(str);
}

function getCompletePath(fiddle_code, user){
    var complete_path = '/';
    if (user != null){
        complete_path += user +'/';
    }
    if (fiddle_code != null){
        complete_path += fiddle_code +'/show/light/';
    }
    return complete_path;
}

//#############################################################################
// HTTPS Requests

function getListOfFiddles(user){
    return new Promise(function (resolve, reject){
        var complete_path = "/api/user/"+user+
            "/demo/list.json?callback=Api&sort=framework&start=0&limit=50000";

        var options = {
            hostname: 'jsfiddle.net',
            port: 443,
            method: 'GET',
            path: complete_path
        };

        var request = https.request(options, function (res){
            var body = '';
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
                logIfVerbose('Retreive chunk');
                body += chunk;
            });
            res.on('end', function () {
                logIfVerbose('End request');
                if ((body.length > 3) && (body.substring(0,3) === 'Api')){
                    var jsonSource = body.substring(4,body.length - 3);
                    var data = JSON.parse(jsonSource);
                    if (data.status === 'ok'){
                        logIfVerbose('Parsed response..');
                        resolve(data.list);
                    } else {
                        logIfVerbose('JSFiddle API error..',true);
                        reject(data);
                    }
                } else {
                    logIfVerbose('JSFiddle API error..',true);
                    console.log('Please verify the user and try again!');
                    reject(new Error('JSFiddle API error..'));
                }
            });
        });

        request.on('error', function(error){
            logIfVerbose(error, true);
            reject(error);
        });
        request.write('');
        request.end();
    });
}

function makeHttpRequest(fiddle_code, user){
    return new Promise(function (resolve, reject){
        var complete_path = getCompletePath(fiddle_code, user);
        var options = {
            hostname: 'jsfiddle.net',
            port: 443,
            method: 'GET',
            path: complete_path,
            headers: {
                'Referer': 'https://jsfiddle.net' + complete_path
            }
        };

        var request = https.request(options, function (res){
            var body = '';
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
                logIfVerbose('Retreive chunk');
                body += chunk;
            });
            res.on('end', function () {
                logIfVerbose('End request');
                resolve(body);
            });
        });

        request.on('error', function(error){
            logIfVerbose(error, true);
            reject(error);
        });
        request.write('');
        request.end();
    });
}

//#############################################################################

function insertDescription(html_raw, fiddle_data){
    return new Promise(function (resolve, reject){
        if (html_raw.length > 0){
            var config = {
                normalizeWhitespace: commander.compressed
            };
            $ = cheerio.load(html_raw, config);

            if (fiddle_data){
                $('head').append("<!-- Title: "+fiddle_data.title+" -->");
                $('head').append("<!-- Author: "+fiddle_data.author+" -->");
                $('head').append("<!-- Description: "+fiddle_data.description+" -->");
                $('head').append("<!-- Framework: "+fiddle_data.framework+" -->");
                $('head').append("<!-- Version: "+fiddle_data.veresion+" -->");
                $('head').append("<!-- Latest_version: "+fiddle_data.latest_version+" -->");
                $('head').append("<!-- Url: "+fiddle_data.url+" -->");
                $('head').append("<!-- Created date: "+fiddle_data.created+" -->");
            }
            resolve($.html());
        } else {
            reject(new Error('Empty html'));
        }
    });
}

function loadDataFromUrl(url){
    return new Promise(function (resolve, reject){
        if (typeof url === 'string' && (url.indexOf('/') > 0)){
            var data = {};
            var url_parts = url_parser.parse(url);
            var path_parts = url_parts.path.split('/');

            if (path_parts.length > 1){
                amount_of_parts = path_parts.length - 1; // Minus the first slash

                if (amount_of_parts === 1){
                    // Only one argument (fiddle_id)
                    data.fiddle_code = path_parts[1];
                    logIfVerbose(    'Detected single fiddle url..')
                } else {
                    // Could bee user/fiddle_id or fiddle_id/command
                    if (isCommand(path_parts[2])){
                        data.fiddle_code = path_parts[1];
                        logIfVerbose(    'Detected fiddle and command url..')
                    } else {
                        // The user may not be present on the url
                        if (amount_of_parts === 2) {
                            data.fiddle_code = path_parts[1];
                            logIfVerbose(    'Detected fiddle url..')
                        } else {
                            data.user = path_parts[1];
                            data.fiddle_code = path_parts[2];
                            logIfVerbose(    'Detected user and fiddle url..')
                        }
                    }
                }
                process.stdout.write('Detected fiddle code = '+chalk.green(data.fiddle_code));
                if (data.user != null){
                    process.stdout.write(', from user = '+chalk.green(data.user));
                }
                process.stdout.write('\n');
                resolve(data);
            }else{
                reject(new Error('Invalid url'));
            }
        }else{
            reject(new Error('Invalid url'));
        }
    });
}

function recoverSingleFiddle(url, output, fiddle_data){
    Promise.bind(this)
        .then(function(){
            return loadDataFromUrl(url);
        }).then( function(data){
            output = output || global.cwd+'/'+data.fiddle_code+'.html'
            return makeHttpRequest(data.fiddle_code, data.user);
        }).then( function(fiddle) {
            return insertDescription(fiddle, fiddle_data);
        }).then( function(fiddle) {
            console.log('Output file = '+output);
            fs.writeFile(output, fiddle);
        }).catch( function (error) {
            printError(error);
            process.exit(1);
        });
}

function getValidCode(code){
    return new Promise(function (resolve, reject){
        if (/^[a-zA-Z0-9_]*$/.test(code)){
            resolve(code);
        } else {
            reject(code);
        }
    });
}

function recoverSingleFiddleById(fiddle_code, output){
    Promise.bind(this)
        .then(function(){
            return getValidCode(fiddle_code);
        }).then( function(code){
            return makeHttpRequest(code);
        }).then( function(fiddle) {
            output = output || global.cwd+'/'+fiddle_code+'.html'
            console.log('Output file = '+output);
            fs.writeFile(output, fiddle);
        }).catch( function (error) {
            printError(error);
            process.exit(1);
        });
}

function saveFiddles(list, output){
    global.cwd = process.cwd();
    var amount = list.length;
    var promises = [];
    for (var i=0; i < amount; i++) {
        var fiddle = list[i];
        var url = fiddle.url.substring(2, fiddle.url.length);
        logIfVerbose('Processing fiddle = '+url);
        promises.push(recoverSingleFiddle(url, null, fiddle));
    }
    return Promise.all(promises);
}

function recoverAllFiddles(user, output){
    var current_dir = process.cwd();
    Promise.bind(this)
        .then(function(){
            mkdirp(output);
        }).then(function(){
            return getListOfFiddles(user);
        }).then(function(list){
            process.chdir(output);
            return saveFiddles(list, output);
        }).then(function(result){
            console.log(chalk.green('Download terminated'));
        }).catch( function (error) {
            printError(error);
            process.exit(1);
        });
}

//#############################################################################

(function main (){
    global.cwd = process.cwd();
    if (commander.user){
        recoverAllFiddles(commander.user, commander.output || 'output_dir');
    } else if (commander.link){
        recoverSingleFiddle(commander.link, commander.output);
    } else if (commander.identifier){
        recoverSingleFiddleById(commander.identifier, commander.output);
    } else {
        commander.help();
    }
})();
<commit_msg>Promisify the file write process<commit_after>#!/usr/bin/env node
//#############################################################################
// @author: Facundo Victor
// @licence: MIT
// @description: Script that allows to do a backup of your jsFiddles to disk.
//#############################################################################

var commander = require('commander');
var chalk = require('chalk');
var https = require('https');
var Promise = require('bluebird');
var cheerio = require('cheerio');
var url_parser = require('url');
var fs = require("fs");

//#############################################################################

commander
    .version('0.0.1')
    .option('-u, --user <user>', 'Save all the users fiddles')
    .option('-l, --link <url>', 'Url of the fiddle to save')
    .option('-o, --output <path>', 'Target path to download the data')
    .option('-c, --compressed', 'Compress the spaces of the HTML output')
    .option('-i, --identifier <fiddle_id>', 'Identifier of the fiddle to save')
    .option('-v, --verbose', 'Verbose output')
    .parse(process.argv);

//#############################################################################
// Print helpers

function logIfVerbose(str, error){
    if (commander.verbose){
        if (error){
            console.error(str);
        }else{
            console.log(chalk.bgGreen(str));
        }
    }
}

function printError(str){
    console.error(chalk.red(str));
}

//#############################################################################

function mkdirp (path) {
    Promise.bind(this)
        .then( function(){
            return Promise.promisify(fs.mkdir)(path);
        }).then( function(){
            logIfVerbose('Dir '+path+' created.');
        }).catch( function(error){
            // EEXIST: Dir already exists
            if ( error.code !== 'EEXIST' ) throw error;
        });
}

function writeFile(file_path, data) {
    Promise.bind(this)
        .then( function(){
            return Promise.promisify(fs.writeFile)(file_path, data);
        }).then( function(){
            logIfVerbose('File '+file_path+' created.');
        }).catch( function(error){
            // EEXIST: File already exists
            if ( error.code !== 'EEXIST' ) throw error;
        });
}

function isCommand(str){
    return /^show$|^embed$/.test(str);
}

function getCompletePath(fiddle_code, user){
    var complete_path = '/';
    if (user != null){
        complete_path += user +'/';
    }
    if (fiddle_code != null){
        complete_path += fiddle_code +'/show/light/';
    }
    return complete_path;
}

//#############################################################################
// HTTPS Requests

function getListOfFiddles(user){
    return new Promise(function (resolve, reject){
        var complete_path = "/api/user/"+user+
            "/demo/list.json?callback=Api&sort=framework&start=0&limit=50000";

        var options = {
            hostname: 'jsfiddle.net',
            port: 443,
            method: 'GET',
            path: complete_path
        };

        var request = https.request(options, function (res){
            var body = '';
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
                logIfVerbose('Retreive chunk');
                body += chunk;
            });
            res.on('end', function () {
                logIfVerbose('End request');
                if ((body.length > 3) && (body.substring(0,3) === 'Api')){
                    var jsonSource = body.substring(4,body.length - 3);
                    var data = JSON.parse(jsonSource);
                    if (data.status === 'ok'){
                        logIfVerbose('Parsed response..');
                        resolve(data.list);
                    } else {
                        logIfVerbose('JSFiddle API error..',true);
                        reject(data);
                    }
                } else {
                    logIfVerbose('JSFiddle API error..',true);
                    console.log('Please verify the user and try again!');
                    reject(new Error('JSFiddle API error..'));
                }
            });
        });

        request.on('error', function(error){
            logIfVerbose(error, true);
            reject(error);
        });
        request.write('');
        request.end();
    });
}

function makeHttpRequest(fiddle_code, user){
    return new Promise(function (resolve, reject){
        var complete_path = getCompletePath(fiddle_code, user);
        var options = {
            hostname: 'jsfiddle.net',
            port: 443,
            method: 'GET',
            path: complete_path,
            headers: {
                'Referer': 'https://jsfiddle.net' + complete_path
            }
        };

        var request = https.request(options, function (res){
            var body = '';
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
                logIfVerbose('Retreive chunk');
                body += chunk;
            });
            res.on('end', function () {
                logIfVerbose('End request');
                resolve(body);
            });
        });

        request.on('error', function(error){
            logIfVerbose(error, true);
            reject(error);
        });
        request.write('');
        request.end();
    });
}

//#############################################################################

function insertDescription(html_raw, fiddle_data){
    return new Promise(function (resolve, reject){
        if (html_raw.length > 0){
            var config = {
                normalizeWhitespace: commander.compressed
            };
            $ = cheerio.load(html_raw, config);

            if (fiddle_data){
                $('head').append("<!-- Title: "+fiddle_data.title+" -->");
                $('head').append("<!-- Author: "+fiddle_data.author+" -->");
                $('head').append("<!-- Description: "+fiddle_data.description+" -->");
                $('head').append("<!-- Framework: "+fiddle_data.framework+" -->");
                $('head').append("<!-- Version: "+fiddle_data.veresion+" -->");
                $('head').append("<!-- Latest_version: "+fiddle_data.latest_version+" -->");
                $('head').append("<!-- Url: "+fiddle_data.url+" -->");
                $('head').append("<!-- Created date: "+fiddle_data.created+" -->");
            }
            resolve($.html());
        } else {
            reject(new Error('Empty html'));
        }
    });
}

function loadDataFromUrl(url){
    return new Promise(function (resolve, reject){
        if (typeof url === 'string' && (url.indexOf('/') > 0)){
            var data = {};
            var url_parts = url_parser.parse(url);
            var path_parts = url_parts.path.split('/');

            if (path_parts.length > 1){
                amount_of_parts = path_parts.length - 1; // Minus the first slash

                if (amount_of_parts === 1){
                    // Only one argument (fiddle_id)
                    data.fiddle_code = path_parts[1];
                    logIfVerbose(    'Detected single fiddle url..')
                } else {
                    // Could bee user/fiddle_id or fiddle_id/command
                    if (isCommand(path_parts[2])){
                        data.fiddle_code = path_parts[1];
                        logIfVerbose(    'Detected fiddle and command url..')
                    } else {
                        // The user may not be present on the url
                        if (amount_of_parts === 2) {
                            data.fiddle_code = path_parts[1];
                            logIfVerbose(    'Detected fiddle url..')
                        } else {
                            data.user = path_parts[1];
                            data.fiddle_code = path_parts[2];
                            logIfVerbose(    'Detected user and fiddle url..')
                        }
                    }
                }
                process.stdout.write('Detected fiddle code = '+chalk.green(data.fiddle_code));
                if (data.user != null){
                    process.stdout.write(', from user = '+chalk.green(data.user));
                }
                process.stdout.write('\n');
                resolve(data);
            }else{
                reject(new Error('Invalid url'));
            }
        }else{
            reject(new Error('Invalid url'));
        }
    });
}

function recoverSingleFiddle(url, output, fiddle_data){
    Promise.bind(this)
        .then(function(){
            return loadDataFromUrl(url);
        }).then( function(data){
            output = output || global.cwd+'/'+data.fiddle_code+'.html'
            return makeHttpRequest(data.fiddle_code, data.user);
        }).then( function(fiddle) {
            return insertDescription(fiddle, fiddle_data);
        }).then( function(fiddle) {
            console.log('Output file = '+output);
            writeFile(output, fiddle);
        }).catch( function (error) {
            printError(error);
            process.exit(1);
        });
}

function getValidCode(code){
    return new Promise(function (resolve, reject){
        if (/^[a-zA-Z0-9_]*$/.test(code)){
            resolve(code);
        } else {
            reject(code);
        }
    });
}

function recoverSingleFiddleById(fiddle_code, output){
    Promise.bind(this)
        .then(function(){
            return getValidCode(fiddle_code);
        }).then( function(code){
            return makeHttpRequest(code);
        }).then( function(fiddle) {
            output = output || global.cwd+'/'+fiddle_code+'.html'
            console.log('Output file = '+output);
            writeFile(output, fiddle);
        }).catch( function (error) {
            printError(error);
            process.exit(1);
        });
}

function saveFiddles(list, output){
    global.cwd = process.cwd();
    var amount = list.length;
    var promises = [];
    for (var i=0; i < amount; i++) {
        var fiddle = list[i];
        var url = fiddle.url.substring(2, fiddle.url.length);
        logIfVerbose('Processing fiddle = '+url);
        promises.push(recoverSingleFiddle(url, null, fiddle));
    }
    return Promise.all(promises);
}

function recoverAllFiddles(user, output){
    var current_dir = process.cwd();
    Promise.bind(this)
        .then(function(){
            mkdirp(output);
        }).then(function(){
            return getListOfFiddles(user);
        }).then(function(list){
            process.chdir(output);
            return saveFiddles(list, output);
        }).then(function(result){
            console.log(chalk.green('Download terminated'));
        }).catch( function (error) {
            printError(error);
            process.exit(1);
        });
}

//#############################################################################

(function main (){
    global.cwd = process.cwd();
    if (commander.user){
        recoverAllFiddles(commander.user, commander.output || 'output_dir');
    } else if (commander.link){
        recoverSingleFiddle(commander.link, commander.output);
    } else if (commander.identifier){
        recoverSingleFiddleById(commander.identifier, commander.output);
    } else {
        commander.help();
    }
})();
<|endoftext|>


<commit_before>// Unit test for a.jsep

/*
TODO:

Test operator change does not affect other instance
Test an HTML parser system, almost completely override
Test every possibility to be sure all "expressions" works flawless...
Update documentation for JSEP
*/

QUnit.module('core/jsep.js', {
    setup: function() {
        a.console.clear();
    },
    teardown: function() {
        a.console.clear();
    }
});

// Most basic addition
QUnit.test('a.jsep.basic', function(assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 + 1');

    var parser = a.jsep.interpreter('qunit.jsep.basic', true, true, true);

    var result = parser.evaluate(tree);

    assert.strictEqual(result.result, 2, 'Test computing');
    assert.strictEqual(result.variables.length, 0);
});

// Using a scope variable
QUnit.test('a.jsep.scope', function(assert) {
    assert.expect(3);

    var tree = a.jsep.parse('a + 1');

    var parser = a.jsep.interpreter('qunit.jsep.scope', true, true, true);

    var result = parser.evaluate(tree, {
        a: 5
    });

    assert.strictEqual(result.result, 6, 'Test computing');
    assert.strictEqual(result.variables.length, 1);
    assert.strictEqual(result.variables[0], 'a');
});

// Custom operators
QUnit.test('a.jsep.custom-operator', function(assert) {
    assert.expect(6);

    var tree = a.jsep.parse('a + 1');
    var parser = a.jsep.interpreter('qunit.jsep.custom-operator', true, true,
            true);
    var result1 = parser.evaluate(tree, {
        a: 5
    });

    assert.strictEqual(result1.result, 6, 'Test computing 1');
    assert.strictEqual(result1.variables.length, 1);
    assert.strictEqual(result1.variables[0], 'a');

    // Now we change the "+" operator
    parser.binaryOperators.set('+', function (left, right) {
        return left - right;
    });

    var result2 = parser.evaluate(tree, {
        a: 5
    });

    assert.strictEqual(result2.result, 4, 'Test computing 2');
    assert.strictEqual(result2.variables.length, 1);
    assert.strictEqual(result2.variables[0], 'a');
});

// Custom operators do not affect others
QUnit.test('a.jsep.custom-operator-parallel', function(assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 + 1');
    var parser1 = a.jsep.interpreter('qunit.jsep.co-parallel1', true, true,
            true),
        parser2 = a.jsep.interpreter('qunit.jsep.co-parallel2', true, true,
            true);

    parser2.binaryOperators.set('+', function (left, right) {
        return left - right;
    });

    var result1 = parser1.evaluate(tree),
        result2 = parser2.evaluate(tree);

    assert.strictEqual(result1.result, 2, 'Test computing 1');
    assert.strictEqual(result2.result, 0, 'Test computing 2');
});

// Test nest functions call
QUnit.test('a.jsep.function', function(assert) {
    assert.expect(2);

    var tree = a.jsep.parse('a(b(12))');
    var parser = a.jsep.interpreter('qunit.jsep.function', true, true, true);

    var result = parser.evaluate(tree, {
        a: function(value) {
            return value - 4;
        },
        b: function(value) {
            return value * 2;
        }
    });

    assert.strictEqual(result.result, 20, 'Test computing');
    assert.strictEqual(result.variables.length, 0);
});

// Using object
QUnit.test('a.jsep.object', function(assert) {
    assert.expect(4);

    var tree = a.jsep.parse('"ok " + a.b[c] + " " + 4 + ok + func(2, 3)');
    var parser = a.jsep.interpreter('qunit.jsep.object', true, true, true);

    var result = parser.evaluate(tree, {
        func: function(a, b) {
            return a + ' yatta ' + b;
        },
        a: {
            b: {
                c: 'member'
            }
        },
        ok: 'hello'
    });

    assert.strictEqual(result.result, 'ok member 4hello2 yatta 3', 'concat');
    assert.strictEqual(result.variables.length, 2, 'Test variables length');
    assert.strictEqual(result.variables[0], 'a', 'variable 1');
    assert.strictEqual(result.variables[1], 'ok', 'variable 2');
});

// Logical operator not defined raise error on console
QUnit.test('a.jsep.not-defined-logical', function(assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 && 1');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-logical', true,
            false, true);

    var result = parser.evaluate(tree),
        trace = a.console.trace('error');

    assert.strictEqual(trace[0].source,
            'a.jsep.interpreter.qunit.jsep.not-defined-logical','test source');
    assert.ok(trace[0].args[0].indexOf('Unknow logical operator ```&&```') >0);
});

// Binary operator not defined raise error on console
QUnit.test('a.jsep.not-defined-binary', function(assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 + 1');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-binary', false,
            true, true);

    var result = parser.evaluate(tree),
        trace = a.console.trace('error');

    assert.strictEqual(trace[0].source,
            'a.jsep.interpreter.qunit.jsep.not-defined-binary','test source');
    assert.ok(trace[0].args[0].indexOf('Unknow binary operator ```+```') >0);
});

// Unary operator not defined raise error on console
QUnit.test('a.jsep.not-defined-unary', function(assert) {
    assert.expect(2);

    var tree = a.jsep.parse('-a');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-unary', true, true,
            false);

    var result = parser.evaluate(tree),
        trace = a.console.trace('error');

    assert.strictEqual(trace[0].source,
            'a.jsep.interpreter.qunit.jsep.not-defined-unary','test source');
    assert.ok(trace[0].args[0].indexOf('Unknow unary operator ```-```') >0);
});

// Test an indentifier does not exist in scope
// NOTE: identifier cannot put something on console, as it can easily
// raise wrong error like this (for example with object members identifier
// will be called...)
// So we just check the system does not crash...
QUnit.test('a.jsep.not-defined-identifier', function(assert) {
    assert.expect(2);

    var tree = a.jsep.parse('a');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-identifier', true,
            true, true);

    var result = parser.evaluate(tree);

    assert.strictEqual(result.result, 'a', 'Test string return');
    assert.strictEqual(result.variables.length, 0);
});<commit_msg>Finishing unit test for jsep default parser.<commit_after>// Unit test for a.jsep

QUnit.module('core/jsep.js', {
    setup: function() {
        a.console.clear();
    },
    teardown: function() {
        a.console.clear();
    }
});

// Most basic addition
QUnit.test('a.jsep.basic', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 + 1');

    var parser = a.jsep.interpreter('qunit.jsep.basic', true, true, true);

    var result = parser.evaluate(tree);

    assert.strictEqual(result.result, 2, 'Test computing');
    assert.strictEqual(result.variables.length, 0);
});

// Using a scope variable
QUnit.test('a.jsep.scope', function (assert) {
    assert.expect(3);

    var tree = a.jsep.parse('a + 1');

    var parser = a.jsep.interpreter('qunit.jsep.scope', true, true, true);

    var result = parser.evaluate(tree, {
        a: 5
    });

    assert.strictEqual(result.result, 6, 'Test computing');
    assert.strictEqual(result.variables.length, 1);
    assert.strictEqual(result.variables[0], 'a');
});

// Custom operators
QUnit.test('a.jsep.custom-operator', function (assert) {
    assert.expect(6);

    var tree = a.jsep.parse('a + 1');
    var parser = a.jsep.interpreter('qunit.jsep.custom-operator', true, true,
            true);
    var result1 = parser.evaluate(tree, {
        a: 5
    });

    assert.strictEqual(result1.result, 6, 'Test computing 1');
    assert.strictEqual(result1.variables.length, 1);
    assert.strictEqual(result1.variables[0], 'a');

    // Now we change the "+" operator
    parser.binaryOperators.set('+', function (left, right) {
        return left - right;
    });

    var result2 = parser.evaluate(tree, {
        a: 5
    });

    assert.strictEqual(result2.result, 4, 'Test computing 2');
    assert.strictEqual(result2.variables.length, 1);
    assert.strictEqual(result2.variables[0], 'a');
});

// Custom operators do not affect others
QUnit.test('a.jsep.custom-operator-parallel', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 + 1');
    var parser1 = a.jsep.interpreter('qunit.jsep.co-parallel1', true, true,
            true),
        parser2 = a.jsep.interpreter('qunit.jsep.co-parallel2', true, true,
            true);

    parser2.binaryOperators.set('+', function (left, right) {
        return left - right;
    });

    var result1 = parser1.evaluate(tree),
        result2 = parser2.evaluate(tree);

    assert.strictEqual(result1.result, 2, 'Test computing 1');
    assert.strictEqual(result2.result, 0, 'Test computing 2');
});

// Test nest functions call
QUnit.test('a.jsep.function', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('a(b(12))');
    var parser = a.jsep.interpreter('qunit.jsep.function', true, true, true);

    var result = parser.evaluate(tree, {
        a: function(value) {
            return value - 4;
        },
        b: function(value) {
            return value * 2;
        }
    });

    assert.strictEqual(result.result, 20, 'Test computing');
    assert.strictEqual(result.variables.length, 0);
});

// Using object
QUnit.test('a.jsep.object', function (assert) {
    assert.expect(4);

    var tree = a.jsep.parse('"ok " + a.b[c] + " " + 4 + ok + func(2, 3)');
    var parser = a.jsep.interpreter('qunit.jsep.object', true, true, true);

    var result = parser.evaluate(tree, {
        func: function(a, b) {
            return a + ' yatta ' + b;
        },
        a: {
            b: {
                c: 'member'
            }
        },
        ok: 'hello'
    });

    assert.strictEqual(result.result, 'ok member 4hello2 yatta 3', 'concat');
    assert.strictEqual(result.variables.length, 2, 'Test variables length');
    assert.strictEqual(result.variables[0], 'a', 'variable 1');
    assert.strictEqual(result.variables[1], 'ok', 'variable 2');
});

// Test array support
QUnit.test('a.jsep.array', function (assert) {
    assert.expect(5);

    var tree = a.jsep.parse('["a", "b"]');
    var parser = a.jsep.interpreter('qunit.jsep.array', true, true, true);

    var result = parser.evaluate(tree);

    assert.strictEqual(a.isArray(result.result), true, 'Test array');
    assert.strictEqual(result.result.length, 2, 'Test size');
    assert.strictEqual(result.variables.length, 0, 'Test variables');
    assert.strictEqual(result.result[0], 'a', 'Test first');
    assert.strictEqual(result.result[1], 'b', 'Test first');
});

// Test this keyword
QUnit.test('a.jsep.this', function (assert) {
    assert.expect(1);

    var tree = a.jsep.parse('this.b');
    var parser = a.jsep.interpreter('qunit.jsep.this', true, true, true);

    var result = parser.evaluate(tree, {
        b: 'ok'
    });

    assert.strictEqual(result.result, 'ok', 'Test value');
});

// Test compound
QUnit.test('a.jsep.compound', function (assert) {
    assert.expect(7);

    var tree = a.jsep.parse('a, b');
    var parser = a.jsep.interpreter('qunit.jsep.compound', true, true, true);

    var result = parser.evaluate(tree, {
        a: 'first',
        b: 'second'
    });

    assert.strictEqual(a.isArray(result.result), true, 'Test array');
    assert.strictEqual(result.result.length, 2, 'Test size');
    assert.strictEqual(result.result[0], 'first', 'Test first');
    assert.strictEqual(result.result[1], 'second', 'Test second');

    assert.strictEqual(result.variables.length, 2, 'Test variables length');
    assert.strictEqual(result.variables[0], 'a', 'Test variable 1');
    assert.strictEqual(result.variables[1], 'b', 'Test variable 2');
});

// Test if structure
QUnit.test('a.jsep.ternary-operator', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('4 == b ? 4: 5'),
        parser = a.jsep.interpreter('qunit.jsep.ternary-operator', true, true,
                true);

    var result1 = parser.evaluate(tree, {
        b: 4
    });
    var result2 = parser.evaluate(tree, {
        b: 2
    });

    assert.strictEqual(result1.result, 4, 'Test 1');
    assert.strictEqual(result2.result, 5, 'Test 1');
});

// Logical operator not defined raise error on console
QUnit.test('a.jsep.not-defined-logical', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 && 1');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-logical', true,
            false, true);

    var result = parser.evaluate(tree),
        trace = a.console.trace('error');

    assert.strictEqual(trace[0].source,
            'a.jsep.interpreter.qunit.jsep.not-defined-logical','test source');
    assert.ok(trace[0].args[0].indexOf('Unknow logical operator ```&&```') >0);
});

// Binary operator not defined raise error on console
QUnit.test('a.jsep.not-defined-binary', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('1 + 1');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-binary', false,
            true, true);

    var result = parser.evaluate(tree),
        trace = a.console.trace('error');

    assert.strictEqual(trace[0].source,
            'a.jsep.interpreter.qunit.jsep.not-defined-binary','test source');
    assert.ok(trace[0].args[0].indexOf('Unknow binary operator ```+```') >0);
});

// Unary operator not defined raise error on console
QUnit.test('a.jsep.not-defined-unary', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('-a');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-unary', true, true,
            false);

    var result = parser.evaluate(tree),
        trace = a.console.trace('error');

    assert.strictEqual(trace[0].source,
            'a.jsep.interpreter.qunit.jsep.not-defined-unary','test source');
    assert.ok(trace[0].args[0].indexOf('Unknow unary operator ```-```') >0);
});

// Test an indentifier does not exist in scope
// NOTE: identifier cannot put something on console, as it can easily
// raise wrong error like this (for example with object members identifier
// will be called...)
// So we just check the system does not crash...
QUnit.test('a.jsep.not-defined-identifier', function (assert) {
    assert.expect(2);

    var tree = a.jsep.parse('a');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-identifier', true,
            true, true);

    var result = parser.evaluate(tree);

    assert.strictEqual(result.result, 'a', 'Test string return');
    assert.strictEqual(result.variables.length, 0);
});

// Not defined function call
QUnit.test('a.jsep.not-defined-call', function (assert) {
    assert.expect(5);

    var tree = a.jsep.parse('func(12)');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-call', true, true,
            true);

    var result = parser.evaluate(tree),
        trace = a.console.trace('error');

    assert.strictEqual(result.result, null, 'Test null value');
    assert.strictEqual(result.variables.length, 0, 'Test no variable involve');
    assert.strictEqual(trace[0].source,
        'a.jsep.interpreter.qunit.jsep.not-defined-call', 'Test source');
    assert.ok(trace[0].args[0].indexOf('The function')>0, 'Test log 1');
    assert.ok(trace[0].args[0].indexOf('could not be resolved')>0, 'Test log');
});

// Not defined object member
QUnit.test('a.jsep.not-defined-member', function (assert) {
    assert.expect(4);

    var tree = a.jsep.parse('a.b[c]');
    var parser = a.jsep.interpreter('qunit.jsep.not-defined-member', true,true,
            true);

    var result = parser.evaluate(tree, {
        a: {
            b: {
                z: 'ok'
            }
        }
    });
    var trace = a.console.trace('error');

    assert.strictEqual(result.result, null, 'Test result');
    assert.strictEqual(trace[0].source,
        'a.jsep.interpreter.qunit.jsep.not-defined-member', 'Test source');
    assert.ok(trace[0].args[0].indexOf('The property') > 0, 'Test log');
    assert.ok(trace[0].args[0].indexOf('could not be found') > 0, 'Test log');
});<|endoftext|>


<commit_before>MathJax.Extension["TeX/mediawiki-texvc"] = {
	version: "2.5.1"
};

MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () {
	MathJax.InputJax.TeX.Definitions.Add({
		macros: {
			AA: ["Macro", "\u00c5"],
			alef: ["Macro", "\\aleph"],
			alefsym: ["Macro", "\\aleph"],
			Alpha: ["Macro", "\\mathrm{A}"],
			and: ["Macro", "\\land"],
			ang: ["Macro", "\\angle"],
			Bbb: ["Macro", "\\mathbb"],
			Beta: ["Macro", "\\mathrm{B}"],
			bold: ["Macro", "\\mathbf"],
			bull: ["Macro", "\\bullet"],
			C: ["Macro", "\\mathbb{C}"],
			Chi: ["Macro", "\\mathrm{X}"],
			clubs: ["Macro", "\\clubsuit"],
			cnums: ["Macro", "\\mathbb{C}"],
			Complex: ["Macro", "\\mathbb{C}"],
			coppa: ["Macro", "\u03D9"],
			Coppa: ["Macro", "\u03D8"],
			Dagger: ["Macro", "\\ddagger"],
			Digamma: ["Macro", "\u03DC"],
			darr: ["Macro", "\\downarrow"],
			dArr: ["Macro", "\\Downarrow"],
			Darr: ["Macro", "\\Downarrow"],
			diamonds: ["Macro", "\\diamondsuit"],
			empty: ["Macro", "\\emptyset"],
			Epsilon: ["Macro", "\\mathrm{E}"],
			Eta: ["Macro", "\\mathrm{H}"],
			euro: ["Macro", "\u20AC"],
			exist: ["Macro", "\\exists"],
			geneuro: ["Macro", "\u20AC"],
			geneuronarrow: ["Macro", "\u20AC"],
			geneurowide: ["Macro", "\u20AC"],
			H: ["Macro", "\\mathbb{H}"],
			hAar: ["Macro", "\\Leftrightarrow"],
			harr: ["Macro", "\\leftrightarrow"],
			Harr: ["Macro", "\\Leftrightarrow"],
			hearts: ["Macro", "\\heartsuit"],
			image: ["Macro", "\\Im"],
			infin: ["Macro", "\\infty"],
			Iota: ["Macro", "\\mathrm{I}"],
			isin: ["Macro", "\\in"],
			Kappa: ["Macro", "\\mathrm{K}"],
			koppa: ["Macro", "\u03DF"],
			Koppa: ["Macro", "\u03DE"],
			lang: ["Macro", "\\langle"],
			larr: ["Macro", "\\leftarrow"],
			Larr: ["Macro", "\\Leftarrow"],
			lArr: ["Macro", "\\Leftarrow"],
			lrarr: ["Macro", "\\leftrightarrow"],
			Lrarr: ["Macro", "\\Leftrightarrow"],
			lrArr: ["Macro", "\\Leftrightarrow"],
			Mu: ["Macro", "\\mathrm{M}"],
			N: ["Macro", "\\mathbb{N}"],
			natnums: ["Macro", "\\mathbb{N}"],
			Nu: ["Macro", "\\mathrm{N}"],
			O: ["Macro", "\\emptyset"],
			oint: ["Macro", "\u222E"],
			oiint: ["Macro", "\u222F"],
			oiiint: ["Macro", "\u2230"],
			ointctrclockwise: ["Macro", "\u2233"],
			officialeuro: ["Macro", "\u20AC"],
			Omicron: ["Macro", "\\mathrm{O}"],
			or: ["Macro", "\\lor"],
			P: ["Macro", "\u00B6"],
			pagecolor: ['Macro','',1],  // ignore \pagecolor{}
			part: ["Macro", "\\partial"],
			plusmn: ["Macro", "\\pm"],
			Q: ["Macro", "\\mathbb{Q}"],
			R: ["Macro", "\\mathbb{R}"],
			rang: ["Macro", "\\rangle"],
			rarr: ["Macro", "\\rightarrow"],
			Rarr: ["Macro", "\\Rightarrow"],
			rArr: ["Macro", "\\Rightarrow"],
			real: ["Macro", "\\Re"],
			reals: ["Macro", "\\mathbb{R}"],
			Reals: ["Macro", "\\mathbb{R}"],
			Rho: ["Macro", "\\mathrm{P}"],
			sdot: ["Macro", "\\cdot"],
			sampi: ["Macro", "\u03E1"],
			Sampi: ["Macro", "\u03E0"],
			sect: ["Macro", "\\S"],
			spades: ["Macro", "\\spadesuit"],
			stigma: ["Macro", "\u03DB"],
			Stigma: ["Macro", "\u03DA"],
			sub: ["Macro", "\\subset"],
			sube: ["Macro", "\\subseteq"],
			supe: ["Macro", "\\supseteq"],
			Tau: ["Macro", "\\mathrm{T}"],
			textvisiblespace: ["Macro", "\u2423"],
			thetasym: ["Macro", "\\vartheta"],
			uarr: ["Macro", "\\uparrow"],
			uArr: ["Macro", "\\Uparrow"],
			Uarr: ["Macro", "\\Uparrow"],
			varcoppa: ["Macro", "\u03D9"],
			varstigma: ["Macro", "\u03DB"],
			varointclockwise: ["Macro", "\u2232"],
			vline: ['Macro','\\smash{\\large\\lvert}',0],
			weierp: ["Macro", "\\wp"],
			Z: ["Macro", "\\mathbb{Z}"],
			Zeta: ["Macro", "\\mathrm{Z}"]
		}
	});
});

MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mediawiki-texvc.js");
<commit_msg>Render \dim as operator<commit_after>MathJax.Extension["TeX/mediawiki-texvc"] = {
	version: "2.5.1"
};

MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () {
	MathJax.InputJax.TeX.Definitions.Add({
		macros: {
			AA: ["Macro", "\u00c5"],
			alef: ["Macro", "\\aleph"],
			alefsym: ["Macro", "\\aleph"],
			Alpha: ["Macro", "\\mathrm{A}"],
			and: ["Macro", "\\land"],
			ang: ["Macro", "\\angle"],
			Bbb: ["Macro", "\\mathbb"],
			Beta: ["Macro", "\\mathrm{B}"],
			bold: ["Macro", "\\mathbf"],
			bull: ["Macro", "\\bullet"],
			C: ["Macro", "\\mathbb{C}"],
			Chi: ["Macro", "\\mathrm{X}"],
			dim: ["Macro", "\\mmlToken{mo}{dim}"],
			clubs: ["Macro", "\\clubsuit"],
			cnums: ["Macro", "\\mathbb{C}"],
			Complex: ["Macro", "\\mathbb{C}"],
			coppa: ["Macro", "\u03D9"],
			Coppa: ["Macro", "\u03D8"],
			Dagger: ["Macro", "\\ddagger"],
			Digamma: ["Macro", "\u03DC"],
			darr: ["Macro", "\\downarrow"],
			dArr: ["Macro", "\\Downarrow"],
			Darr: ["Macro", "\\Downarrow"],
			diamonds: ["Macro", "\\diamondsuit"],
			empty: ["Macro", "\\emptyset"],
			Epsilon: ["Macro", "\\mathrm{E}"],
			Eta: ["Macro", "\\mathrm{H}"],
			euro: ["Macro", "\u20AC"],
			exist: ["Macro", "\\exists"],
			geneuro: ["Macro", "\u20AC"],
			geneuronarrow: ["Macro", "\u20AC"],
			geneurowide: ["Macro", "\u20AC"],
			H: ["Macro", "\\mathbb{H}"],
			hAar: ["Macro", "\\Leftrightarrow"],
			harr: ["Macro", "\\leftrightarrow"],
			Harr: ["Macro", "\\Leftrightarrow"],
			hearts: ["Macro", "\\heartsuit"],
			image: ["Macro", "\\Im"],
			infin: ["Macro", "\\infty"],
			Iota: ["Macro", "\\mathrm{I}"],
			isin: ["Macro", "\\in"],
			Kappa: ["Macro", "\\mathrm{K}"],
			koppa: ["Macro", "\u03DF"],
			Koppa: ["Macro", "\u03DE"],
			lang: ["Macro", "\\langle"],
			larr: ["Macro", "\\leftarrow"],
			Larr: ["Macro", "\\Leftarrow"],
			lArr: ["Macro", "\\Leftarrow"],
			lrarr: ["Macro", "\\leftrightarrow"],
			Lrarr: ["Macro", "\\Leftrightarrow"],
			lrArr: ["Macro", "\\Leftrightarrow"],
			Mu: ["Macro", "\\mathrm{M}"],
			N: ["Macro", "\\mathbb{N}"],
			natnums: ["Macro", "\\mathbb{N}"],
			Nu: ["Macro", "\\mathrm{N}"],
			O: ["Macro", "\\emptyset"],
			oint: ["Macro", "\u222E"],
			oiint: ["Macro", "\u222F"],
			oiiint: ["Macro", "\u2230"],
			ointctrclockwise: ["Macro", "\u2233"],
			officialeuro: ["Macro", "\u20AC"],
			Omicron: ["Macro", "\\mathrm{O}"],
			or: ["Macro", "\\lor"],
			P: ["Macro", "\u00B6"],
			pagecolor: ['Macro','',1],  // ignore \pagecolor{}
			part: ["Macro", "\\partial"],
			plusmn: ["Macro", "\\pm"],
			Q: ["Macro", "\\mathbb{Q}"],
			R: ["Macro", "\\mathbb{R}"],
			rang: ["Macro", "\\rangle"],
			rarr: ["Macro", "\\rightarrow"],
			Rarr: ["Macro", "\\Rightarrow"],
			rArr: ["Macro", "\\Rightarrow"],
			real: ["Macro", "\\Re"],
			reals: ["Macro", "\\mathbb{R}"],
			Reals: ["Macro", "\\mathbb{R}"],
			Rho: ["Macro", "\\mathrm{P}"],
			sdot: ["Macro", "\\cdot"],
			sampi: ["Macro", "\u03E1"],
			Sampi: ["Macro", "\u03E0"],
			sect: ["Macro", "\\S"],
			spades: ["Macro", "\\spadesuit"],
			stigma: ["Macro", "\u03DB"],
			Stigma: ["Macro", "\u03DA"],
			sub: ["Macro", "\\subset"],
			sube: ["Macro", "\\subseteq"],
			supe: ["Macro", "\\supseteq"],
			Tau: ["Macro", "\\mathrm{T}"],
			textvisiblespace: ["Macro", "\u2423"],
			thetasym: ["Macro", "\\vartheta"],
			uarr: ["Macro", "\\uparrow"],
			uArr: ["Macro", "\\Uparrow"],
			Uarr: ["Macro", "\\Uparrow"],
			varcoppa: ["Macro", "\u03D9"],
			varstigma: ["Macro", "\u03DB"],
			varointclockwise: ["Macro", "\u2232"],
			vline: ['Macro','\\smash{\\large\\lvert}',0],
			weierp: ["Macro", "\\wp"],
			Z: ["Macro", "\\mathbb{Z}"],
			Zeta: ["Macro", "\\mathrm{Z}"]
		}
	});
});

MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/mediawiki-texvc.js");
<|endoftext|>