From c2a75e15ccca6d025fb5696f0a9d1c20bccdf479 Mon Sep 17 00:00:00 2001 From: YishiMichael Date: Mon, 22 Aug 2022 16:55:46 +0800 Subject: [PATCH] refactor: refactor StringMobject --- manimlib/mobject/svg/mtex_mobject.py | 9 +- manimlib/mobject/svg/string_mobject.py | 478 ++++++++++--------------- manimlib/mobject/svg/text_mobject.py | 2 +- 3 files changed, 200 insertions(+), 289 deletions(-) diff --git a/manimlib/mobject/svg/mtex_mobject.py b/manimlib/mobject/svg/mtex_mobject.py index 1f808dad..308f8629 100644 --- a/manimlib/mobject/svg/mtex_mobject.py +++ b/manimlib/mobject/svg/mtex_mobject.py @@ -79,10 +79,9 @@ class MTex(StringMobject): @staticmethod def get_command_matches(string: str) -> list[re.Match]: - # Group together adjacent braces + # Lump together adjacent brace pairs pattern = re.compile(r""" (?P\\(?:[a-zA-Z]+|.)) - |(?P