Skip to content

Commit aa77e04

Browse files
committed
feat(conversion.py): ignore all inline envs or commands
there are a lot of envs or commands that lie in the text envs, this new conditions will ensure none of them will parsed, so the text will stays as a whole to be rendered.
1 parent d9274ef commit aa77e04

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

TexSoup/app/conversion.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ def to_list(tex_tree):
4444
+ envs.algorithm_envs
4545
+ envs.tabular_envs
4646
+ envs.list_envs
47+
+ envs.nonexpand_envs
4748
):
4849
str_tree.append({i.name: str(i)})
50+
elif (
51+
str_tree and isinstance(str_tree[-1], str) and str_tree[-1][-1] != "\n"
52+
):
53+
str_tree.append(str_tree.pop() + str(i))
4954
else:
5055
str_tree.append(
5156
{
@@ -65,6 +70,10 @@ def to_list(tex_tree):
6570
str_tree.append({i.name: "\\" + i.name + macro_name + parameter_text})
6671
elif i.name in envs.ignore_envs:
6772
str_tree.append(str(i))
73+
elif (
74+
str_tree and isinstance(str_tree[-1], str) and str_tree[-1][-1] != "\n"
75+
):
76+
str_tree.append(str_tree.pop() + str(i))
6877
else:
6978
str_tree.append({i.name: "\\" + i.name + str(i.args)})
7079
elif isinstance(i, TexText):

0 commit comments

Comments
 (0)