mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Refactor LabelledString
This commit is contained in:
parent
14dfd776dc
commit
dbefc3b256
1 changed files with 4 additions and 4 deletions
|
@ -135,17 +135,17 @@ class MTex(LabelledString):
|
|||
if span_begin in brace_indices_dict.keys():
|
||||
span_end = brace_indices_dict[span_begin] + 1
|
||||
else:
|
||||
span = self.find_spans(script_pattern, pos=span_begin)[0]
|
||||
if span[0] != span_begin:
|
||||
spans = self.find_spans(script_pattern, pos=span_begin)
|
||||
if not spans or spans[0][0] != span_begin:
|
||||
script_name = {
|
||||
"_": "subscript",
|
||||
"^": "superscript"
|
||||
}[script_char]
|
||||
}[self.get_string(char_span)]
|
||||
raise ValueError(
|
||||
f"Unclear {script_name} detected while parsing. "
|
||||
"Please use braces to clarify"
|
||||
)
|
||||
span_end = span[1]
|
||||
span_end = spans[0][1]
|
||||
result.append((span_begin, span_end))
|
||||
return result
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue