Fix: subtree render for tex
This commit is contained in:
parent
cd590c7fe0
commit
63de956a4f
@ -62,7 +62,14 @@ class Token(object):
|
|||||||
return f"<{self.__class__.__name__} {self.__txt__}>"
|
return f"<{self.__class__.__name__} {self.__txt__}>"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return renders[self.RENDER](self._mo)
|
if self.RENDER == "tex":
|
||||||
|
return self.__tex__
|
||||||
|
elif self.RENDER == "txt":
|
||||||
|
return self.__txt__
|
||||||
|
else:
|
||||||
|
raise ValueError(f"Unknow render {self.RENDER}")
|
||||||
|
|
||||||
|
#return renders[self.RENDER](self._mo)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def __txt__(self):
|
def __txt__(self):
|
||||||
|
@ -196,7 +196,7 @@ def render_with_parenthesis(subtree, operator):
|
|||||||
subtree_need_parenthesis = True
|
subtree_need_parenthesis = True
|
||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
pass
|
pass
|
||||||
subtree_ = subtree.__txt__
|
subtree_ = subtree.__tex__
|
||||||
else:
|
else:
|
||||||
if OPERATORS[subtree.node]["precedence"] < OPERATORS[operator]["precedence"]:
|
if OPERATORS[subtree.node]["precedence"] < OPERATORS[operator]["precedence"]:
|
||||||
subtree_need_parenthesis = True
|
subtree_need_parenthesis = True
|
||||||
|
Loading…
Reference in New Issue
Block a user