mirror of
https://github.com/3b1b/manim.git
synced 2025-08-03 04:04:36 +08:00
Clean up code
This commit is contained in:
@ -557,10 +557,7 @@ class MTex(_TexSVG):
|
||||
|
||||
def get_part_by_tex(self, tex, index=0):
|
||||
all_parts = self.get_parts_by_tex(tex)
|
||||
try:
|
||||
return all_parts[index]
|
||||
except IndexError:
|
||||
return None
|
||||
return all_parts[index]
|
||||
|
||||
def set_color_by_tex(self, tex, color):
|
||||
self.get_parts_by_tex(tex).set_color(color)
|
||||
|
@ -449,8 +449,7 @@ class Code(MarkupText):
|
||||
lexer = pygments.lexers.get_lexer_by_name(self.language)
|
||||
formatter = pygments.formatters.PangoMarkupFormatter(style=self.code_style)
|
||||
markup = pygments.highlight(code, lexer, formatter)
|
||||
markup = markup.replace("<tt>", f"<span font_family='{self.font}'>")
|
||||
markup = markup.replace("</tt>", "</span>")
|
||||
markup = markup.replace("<tt>", "<span>").replace("</tt>", "</span>")
|
||||
super().__init__(markup, **kwargs)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user