Merge branch 'upsilon-dev-latex' into upsilon-dev-latex

This commit is contained in:
Lauryy06
2021-10-23 13:35:52 +02:00
committed by GitHub

View File

@@ -26,7 +26,7 @@ Layout TexParser::popBlock() {
m_text ++;
}
if (*m_text == '}') {
if (*m_text == '{') {
m_text ++;
return popText('}');
}
@@ -71,7 +71,15 @@ Layout TexParser::popText(char stop) {
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
}
m_text ++;
layout.addOrMergeChildAtIndex(popCommand(), layout.numberOfChildren(), false);
layout.addOrMergeChildAtIndex(VerticalOffsetLayout::Builder(popBlock(), VerticalOffsetLayoutNode::Position::Superscript), layout.numberOfChildren(), false);
start = m_text;
break;
case '_':
if (start != m_text) {
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
}
m_text ++;
layout.addOrMergeChildAtIndex(VerticalOffsetLayout::Builder(popBlock(), VerticalOffsetLayoutNode::Position::Subscript), layout.numberOfChildren(), false);
start = m_text;
break;
default:
@@ -82,12 +90,13 @@ Layout TexParser::popText(char stop) {
if (start != m_text) {
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
}
if (layout.numberOfChildren() == 1) {
layout.squashUnaryHierarchyInPlace();
}
m_text ++;
if (layout.numberOfChildren() == 1) {
return layout.squashUnaryHierarchyInPlace();
}
return layout;
}
@@ -109,9 +118,7 @@ Layout TexParser::popCommand() {
}
Layout TexParser::popFracCommand() {
Layout firstBlock = popBlock();
Layout secondBlock = popBlock();
return FractionLayout::Builder(firstBlock, secondBlock);
return FractionLayout::Builder(popBlock(), popBlock());
}
Layout TexParser::popSqrtCommand() {