Commit fd45d9f3 authored by GoshaZotov's avatar GoshaZotov

+ previous revision

parent 6a1945cd
...@@ -7251,29 +7251,61 @@ CMathContent.prototype.GetTextContent = function(arr, str) ...@@ -7251,29 +7251,61 @@ CMathContent.prototype.GetTextContent = function(arr, str)
str = ""; str = "";
} }
var addText = function(value)
{
arr.push(value);
str += value;
};
var getMathSymbol = function(elem) var getMathSymbol = function(elem)
{ {
var res = ""; var res = [];
var getVal = function(val, position)
{
var newVal = {};
newVal.prePosition = !!position;
newVal.value = undefined !== val ? val : "";
return newVal;
};
if(elem instanceof CDegree) if(elem instanceof CDegree)
{ {
res = "^";
if(DEGREE_SUPERSCRIPT === elem.Pr.type)
{
res.push(getVal("^"));
}
else
{
res.push(getVal("_"));
}
} }
else if(elem instanceof CDelimiter) else if(elem instanceof CDelimiter)
{ {
res = "Delimiter"; res[-1] = getVal("(", true);
res.push(getVal(")"));
} }
else if(elem instanceof CNary) else if(elem instanceof CNary)
{ {
res = "CNary"; res[-1] = getVal(String.fromCharCode(elem.Pr.chr), true);
if(!elem.Pr.supHide)
{
res.push(getVal("_", true));
}
if(!elem.Pr.subHide)
{
res.push(getVal("^", true));
}
res.push(getVal("", true));
} }
else if(elem instanceof CFraction) else if(elem instanceof CFraction)
{ {
res = "/"; res.push(getVal("/"));
} }
else if(elem instanceof CRadical) else if(elem instanceof CRadical)
{ {
res = "";//8730 res.push(getVal("", true));//8730;
} }
return res; return res;
...@@ -7293,15 +7325,12 @@ CMathContent.prototype.GetTextContent = function(arr, str) ...@@ -7293,15 +7325,12 @@ CMathContent.prototype.GetTextContent = function(arr, str)
} }
else if(para_Math_Text === this.Content[i].Content[j].Type) else if(para_Math_Text === this.Content[i].Content[j].Type)
{ {
arr.push(String.fromCharCode(this.Content[i].Content[j].value)); addText(String.fromCharCode(this.Content[i].Content[j].value));
str += String.fromCharCode(this.Content[i].Content[j].value);
} }
else if(para_Math_BreakOperator === this.Content[i].Content[j].Type) else if(para_Math_BreakOperator === this.Content[i].Content[j].Type)
{ {
arr.push(String.fromCharCode(this.Content[i].Content[j].value)); addText(String.fromCharCode(this.Content[i].Content[j].value));
str += String.fromCharCode(this.Content[i].Content[j].value);
} }
} }
break; break;
...@@ -7314,62 +7343,43 @@ CMathContent.prototype.GetTextContent = function(arr, str) ...@@ -7314,62 +7343,43 @@ CMathContent.prototype.GetTextContent = function(arr, str)
{ {
if(para_Math_Content === this.Content[i].Content[j].Type) if(para_Math_Content === this.Content[i].Content[j].Type)
{ {
if(this.Content[i].Content.length > 1) if(j === 0 && symbol[-1] && symbol[-1].prePosition)
{ {
arr.push("("); addText(symbol[-1].value);
str += "(";
} }
if(symbol[j] && symbol[j].prePosition)
{
addText(symbol[j].value);
}
addText("(");
str = this.Content[i].Content[j].GetTextContent(arr, str); str = this.Content[i].Content[j].GetTextContent(arr, str);
if(this.Content[i].Content.length > 1)
{
arr.push(")");
str += ")";
}
if(j !== this.Content[i].Content.length - 1) addText(")");
if(symbol[j] && !symbol[j].prePosition)
{ {
/*if(this.Content[i].Content.length > 1) addText(symbol[j].value);
{
arr.push(")");
str += ")";
}*/
arr.push(symbol);
str += symbol;
/*if(this.Content[i].Content.length > 1)
{
arr.push("(");
str += "(";
}*/
} }
} }
else if(para_Math_Text === this.Content[i].Content[j].Type) else if(para_Math_Text === this.Content[i].Content[j].Type)
{ {
arr.push(String.fromCharCode(this.Content[i].Content[j].value)); addText(String.fromCharCode(this.Content[i].Content[j].value));
str += String.fromCharCode(this.Content[i].Content[j].value);
} }
else if(para_Math_BreakOperator === this.Content[i].Content[j].Type) else if(para_Math_BreakOperator === this.Content[i].Content[j].Type)
{ {
arr.push(String.fromCharCode(this.Content[i].Content[j].value)); addText(String.fromCharCode(this.Content[i].Content[j].value));
str += String.fromCharCode(this.Content[i].Content[j].value);
} }
} }
/*if(this.Content[i].Content.length > 1)
{
arr.push(")");
str += ")";
}*/
break; break;
} }
case para_Math_Text: /*case para_Math_Text:
{ {
arr.push(String.fromCharCode(this.Content[i].value)); addText(String.fromCharCode(this.Content[i].Content[j].value));
str += String.fromCharCode(this.Content[i].value);
break; break;
} }*/
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment