adding css classes to most of the structured printing values.
This commit is contained in:
parent
15885bd6a2
commit
e60f96f97c
|
@ -10,7 +10,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var Struct = function (constructorName, fields, structType) {
|
var Struct = function (constructorName, fields, structType) {
|
||||||
this._constructorName = constructorName;
|
this._constructorName = constructorName; // Symbol
|
||||||
this._fields = [];
|
this._fields = [];
|
||||||
this.structType = structType;
|
this.structType = structType;
|
||||||
};
|
};
|
||||||
|
@ -33,15 +33,17 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Struct.prototype.toDomNode = function (params) {
|
Struct.prototype.toDomNode = function (params) {
|
||||||
var node = document.createElement("span"), i;
|
var node = $('<span/>');
|
||||||
$(node).append(document.createTextNode("("));
|
var i;
|
||||||
$(node).append(document.createTextNode(this._constructorName));
|
node.append($('<span/>').text("(").addClass('lParen'));
|
||||||
|
node.append($('<span/>').text(this._constructorName+''));
|
||||||
for(i = 0; i < this._fields.length; i++) {
|
for(i = 0; i < this._fields.length; i++) {
|
||||||
$(node).append(document.createTextNode(" "));
|
node.append(" ");
|
||||||
$(node).append(params.recur(this._fields[i]));
|
node.append(params.recur(this._fields[i]));
|
||||||
}
|
}
|
||||||
$(node).append(document.createTextNode(")"));
|
node.append($('<span/>').text(")").addClass('rParen'));
|
||||||
return node;
|
console.log(node);
|
||||||
|
return node.get(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,4 +310,4 @@
|
||||||
exports.isStruct = isStruct;
|
exports.isStruct = isStruct;
|
||||||
exports.isStructType = isStructType;
|
exports.isStructType = isStructType;
|
||||||
exports.isStructTypeProperty = isStructTypeProperty;
|
exports.isStructTypeProperty = isStructTypeProperty;
|
||||||
}(this.plt.baselib, jQuery));
|
}(this.plt.baselib, jQuery));
|
||||||
|
|
|
@ -55,23 +55,23 @@
|
||||||
|
|
||||||
Symbol.prototype.toDomNode = function(params) {
|
Symbol.prototype.toDomNode = function(params) {
|
||||||
if (params.getMode() === 'write') {
|
if (params.getMode() === 'write') {
|
||||||
return $("<span/>").text(this.val).get(0);
|
return $("<span/>").text(this.val).addClass('wescheme-symbol').get(0);
|
||||||
}
|
}
|
||||||
if (params.getMode() === 'display') {
|
if (params.getMode() === 'display') {
|
||||||
return $("<span/>").text(this.val).get(0);
|
return $("<span/>").text(this.val).addClass('wescheme-symbol').get(0);
|
||||||
}
|
}
|
||||||
if (params.getMode() === 'print') {
|
if (params.getMode() === 'print') {
|
||||||
if (params.getDepth() === 0) {
|
if (params.getDepth() === 0) {
|
||||||
return $("<span/>").text("'" + this.val).get(0);
|
return $("<span/>").text("'" + this.val).addClass('wescheme-symbol').get(0);
|
||||||
} else {
|
} else {
|
||||||
return $("<span/>").text(this.val).get(0);
|
return $("<span/>").text(this.val).addClass('wescheme-symbol').get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (params.getMode() === 'constructor') {
|
if (params.getMode() === 'constructor') {
|
||||||
return $("<span/>").text("'" + this.val).get(0);
|
return $("<span/>").text("'" + this.val).addClass('wescheme-symbol').get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $("<span/>").text(this.val).get(0);
|
return $("<span/>").text(this.val).addClass('wescheme-symbol').get(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// vectors
|
// vectors
|
||||||
/*jslint devel: false, browser: true, vars: true, plusplus: true, maxerr: 500, indent: 4 */
|
/*jslint devel: false, browser: true, vars: true, plusplus: true, maxerr: 500, indent: 4 */
|
||||||
(function (baselib) {
|
(function (baselib, $) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var exports = {};
|
var exports = {};
|
||||||
baselib.vectors = exports;
|
baselib.vectors = exports;
|
||||||
|
@ -83,25 +83,26 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector.prototype.toDomNode = function (params) {
|
Vector.prototype.toDomNode = function (params) {
|
||||||
var node = document.createElement("span"), i;
|
var node = $('<span/>'), i;
|
||||||
if (params.getMode() === 'constructor') {
|
if (params.getMode() === 'constructor') {
|
||||||
node.appendChild(document.createTextNode("(vector"));
|
node.append($('<span/>').text('(').addClass('lParen'));
|
||||||
|
node.append($('<span/>').text('vector'));
|
||||||
for (i = 0; i < this.length(); i++) {
|
for (i = 0; i < this.length(); i++) {
|
||||||
node.appendChild(document.createTextNode(" "));
|
node.append(" ");
|
||||||
node.appendChild(params.recur(this.ref(i)));
|
node.append(params.recur(this.ref(i)));
|
||||||
}
|
}
|
||||||
node.appendChild(document.createTextNode(")"));
|
node.append($('<span/>').text(')').addClass('rParen'));
|
||||||
} else {
|
} else {
|
||||||
node.appendChild(document.createTextNode("#("));
|
node.append($('<span/>').text('#(').addClass('lParen'));
|
||||||
for (i = 0; i < this.length(); i++) {
|
for (i = 0; i < this.length(); i++) {
|
||||||
node.appendChild(params.recur(this.ref(i)));
|
node.append(params.recur(this.ref(i)));
|
||||||
if (i !== this.length() - 1) {
|
if (i !== this.length() - 1) {
|
||||||
node.appendChild(document.createTextNode(" "));
|
node.append(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
node.appendChild(document.createTextNode(")"));
|
node.append($('<span/>').text(')').addClass('rParen'));
|
||||||
}
|
}
|
||||||
return node;
|
return node.get(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,4 +127,4 @@
|
||||||
exports.makeVectorImmutable = makeVectorImmutable;
|
exports.makeVectorImmutable = makeVectorImmutable;
|
||||||
|
|
||||||
|
|
||||||
}(this.plt.baselib));
|
}(this.plt.baselib, jQuery));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user