mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
Replace tabs with spaces
This commit is contained in:
parent
024b2a9e26
commit
adccb818ea
@ -103,18 +103,18 @@ function factory (type, config, load, typed) {
|
||||
var value = this._toString(options)
|
||||
|
||||
switch (getType(this.value)) {
|
||||
case 'number':
|
||||
case 'BigNumber':
|
||||
case 'Fraction':
|
||||
return '<span class="math-number">' + value + '</span>'
|
||||
case 'number':
|
||||
case 'BigNumber':
|
||||
case 'Fraction':
|
||||
return '<span class="math-number">' + value + '</span>'
|
||||
case 'string':
|
||||
return '<span class="math-string">' + value + '</span>'
|
||||
return '<span class="math-string">' + value + '</span>'
|
||||
case 'boolean':
|
||||
return '<span class="math-boolean">' + value + '</span>'
|
||||
return '<span class="math-boolean">' + value + '</span>'
|
||||
case 'null':
|
||||
return '<span class="math-null-symbol">' + value + '</span>'
|
||||
return '<span class="math-null-symbol">' + value + '</span>'
|
||||
case 'undefined':
|
||||
return '<span class="math-undefined">' + value + '</span>'
|
||||
return '<span class="math-undefined">' + value + '</span>'
|
||||
|
||||
default:
|
||||
return '<span class="math-symbol">' + value + '</span>'
|
||||
|
||||
@ -191,8 +191,8 @@ function factory (type, config, load, typed) {
|
||||
FunctionAssignmentNode.prototype.toHTML = function (options) {
|
||||
var parenthesis = (options && options.parenthesis) ? options.parenthesis : 'keep'
|
||||
var params = []
|
||||
for (var i = 0; i < this.params.length; i++) {
|
||||
params.push('<span class="math-symbol math-parameter">' + escape(this.params[i]) + '</span>')
|
||||
for (var i = 0; i < this.params.length; i++) {
|
||||
params.push('<span class="math-symbol math-parameter">' + escape(this.params[i]) + '</span>')
|
||||
}
|
||||
var expr = this.expr.toHTML(options)
|
||||
if (needParenthesis(this, parenthesis)) {
|
||||
|
||||
@ -240,13 +240,13 @@ function factory (type, config, load, typed) {
|
||||
IndexNode.prototype.toHTML = function (options) {
|
||||
// format the parameters like "[1, 0:5]"
|
||||
var dimensions = []
|
||||
for (var i = 0; i < this.dimensions.length; i++) {
|
||||
dimensions[i] = this.dimensions[i].toHTML()
|
||||
for (var i = 0; i < this.dimensions.length; i++) {
|
||||
dimensions[i] = this.dimensions[i].toHTML()
|
||||
}
|
||||
if (this.dotNotation) {
|
||||
return '<span class="math-operator math-accessor-operator">.</span>' + '<span class="math-symbol math-property">' + escape(this.getObjectProperty()) + '</span>'
|
||||
return '<span class="math-operator math-accessor-operator">.</span>' + '<span class="math-symbol math-property">' + escape(this.getObjectProperty()) + '</span>'
|
||||
} else {
|
||||
return '<span class="math-parenthesis math-square-parenthesis">[</span>' + dimensions.join('<span class="math-separator">,</span>') + '<span class="math-parenthesis math-square-parenthesis">]</span>'
|
||||
return '<span class="math-parenthesis math-square-parenthesis">[</span>' + dimensions.join('<span class="math-separator">,</span>') + '<span class="math-parenthesis math-square-parenthesis">]</span>'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -477,11 +477,11 @@ function factory (type, config, load, typed) {
|
||||
rhs = '<span class="math-parenthesis math-round-parenthesis">(</span>' + rhs + '<span class="math-parenthesis math-round-parenthesis">)</span>'
|
||||
}
|
||||
|
||||
if (this.implicit && (this.getIdentifier() === 'OperatorNode:multiply') && (implicit == 'hide')) {
|
||||
return lhs + '<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>' + rhs
|
||||
}
|
||||
if (this.implicit && (this.getIdentifier() === 'OperatorNode:multiply') && (implicit == 'hide')) {
|
||||
return lhs + '<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>' + rhs
|
||||
}
|
||||
|
||||
return lhs + '<span class="math-operator math-binary-operator math-explicit-binary-operator">' + escape(this.op) + '</span>' + rhs
|
||||
return lhs + '<span class="math-operator math-binary-operator math-explicit-binary-operator">' + escape(this.op) + '</span>' + rhs
|
||||
} else if ((args.length > 2) && ((this.getIdentifier() === 'OperatorNode:add') || (this.getIdentifier() === 'OperatorNode:multiply'))) {
|
||||
var stringifiedArgs = args.map(function (arg, index) {
|
||||
arg = arg.toHTML(options)
|
||||
|
||||
@ -136,17 +136,17 @@ function factory (type, config, load, typed, math) {
|
||||
var name = escape(this.name)
|
||||
|
||||
if (name == 'true' || name == 'false') {
|
||||
return '<span class="math-symbol math-boolean">' + name + '</span>'
|
||||
return '<span class="math-symbol math-boolean">' + name + '</span>'
|
||||
} else if (name == 'i') {
|
||||
return '<span class="math-symbol math-imaginary-symbol">' + name + '</span>'
|
||||
return '<span class="math-symbol math-imaginary-symbol">' + name + '</span>'
|
||||
} else if (name == 'Infinity') {
|
||||
return '<span class="math-symbol math-infinity-symbol">' + name + '</span>'
|
||||
return '<span class="math-symbol math-infinity-symbol">' + name + '</span>'
|
||||
} else if (name == 'NaN') {
|
||||
return '<span class="math-symbol math-nan-symbol">' + name + '</span>'
|
||||
return '<span class="math-symbol math-nan-symbol">' + name + '</span>'
|
||||
} else if (name == 'null') {
|
||||
return '<span class="math-symbol math-null-symbol">' + name + '</span>'
|
||||
return '<span class="math-symbol math-null-symbol">' + name + '</span>'
|
||||
} else if (name == 'undefined') {
|
||||
return '<span class="math-symbol math-undefined-symbol">' + name + '</span>'
|
||||
return '<span class="math-symbol math-undefined-symbol">' + name + '</span>'
|
||||
}
|
||||
|
||||
return '<span class="math-symbol">' + name + '</span>'
|
||||
|
||||
@ -460,8 +460,8 @@ export function join (array, separator) {
|
||||
|
||||
/**
|
||||
* Assign a numeric identifier to every element of a sorted array
|
||||
* @param {Array} a An array
|
||||
* @return {Array} An array of objects containing the original value and its identifier
|
||||
* @param {Array} a An array
|
||||
* @return {Array} An array of objects containing the original value and its identifier
|
||||
*/
|
||||
export function identify (a) {
|
||||
if (!Array.isArray(a)) {
|
||||
@ -477,7 +477,7 @@ export function identify (a) {
|
||||
b[0] = {value: a[0], identifier: 0}
|
||||
for (let i = 1; i < a.length; i++) {
|
||||
if (a[i] === a[i - 1]) {
|
||||
count++
|
||||
count++
|
||||
} else {
|
||||
count = 0
|
||||
}
|
||||
@ -488,8 +488,8 @@ export function identify (a) {
|
||||
|
||||
/**
|
||||
* Remove the numeric identifier from the elements
|
||||
* @param {array} a An array
|
||||
* @return {array} An array of values without identifiers
|
||||
* @param {array} a An array
|
||||
* @return {array} An array of values without identifiers
|
||||
*/
|
||||
exports.generalize = function (a) {
|
||||
if (!Array.isArray(a)) {
|
||||
|
||||
@ -155,10 +155,10 @@ exports.stringify = function (value) {
|
||||
exports.escape = function (value) {
|
||||
var text = String(value)
|
||||
text = text.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
|
||||
return text
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user