Fix: subtree render for tex

This commit is contained in:
Bertrand Benjamin 2019-07-11 18:03:49 +02:00
parent cd590c7fe0
commit 63de956a4f
2 changed files with 9 additions and 2 deletions

View File

@ -62,7 +62,14 @@ class Token(object):
return f"<{self.__class__.__name__} {self.__txt__}>"
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
def __txt__(self):

View File

@ -196,7 +196,7 @@ def render_with_parenthesis(subtree, operator):
subtree_need_parenthesis = True
except (AttributeError, KeyError):
pass
subtree_ = subtree.__txt__
subtree_ = subtree.__tex__
else:
if OPERATORS[subtree.node]["precedence"] < OPERATORS[operator]["precedence"]:
subtree_need_parenthesis = True