Skip to content

Commit aab55d9

Browse files
author
Yusuke Oda
authored
remove expression style (#171)
1 parent b8bd10c commit aab55d9

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/latexify/frontend.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ def expression(
119119
`use_signature=False`.
120120
"""
121121
kwargs["use_signature"] = kwargs.get("use_signature", False)
122+
122123
if fn is not None:
123-
return function(fn, **kwargs)
124-
else:
125-
return function(**kwargs)
124+
return ipython_wrappers.LatexifiedFunction(fn, **kwargs)
125+
126+
def wrapper(f):
127+
return ipython_wrappers.LatexifiedFunction(f, **kwargs)
128+
129+
return wrapper

src/latexify/generate_latex.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class Style(enum.Enum):
1515
"""The style of the generated LaTeX."""
1616

1717
ALGORITHMIC = "algorithmic"
18-
EXPRESSION = "expression"
1918
FUNCTION = "function"
2019
IPYTHON_ALGORITHMIC = "ipython-algorithmic"
2120

@@ -67,11 +66,11 @@ def get_latex(
6766
elif style == Style.IPYTHON_ALGORITHMIC:
6867
# TODO(ZibingZhang): implement algorithmic codegen for ipython
6968
raise exceptions.LatexifyNotSupportedError
70-
else:
71-
if style == Style.EXPRESSION:
72-
kwargs["use_signature"] = kwargs.get("use_signature", False)
69+
elif style == Style.FUNCTION:
7370
return codegen.FunctionCodegen(
7471
use_math_symbols=merged_config.use_math_symbols,
7572
use_signature=merged_config.use_signature,
7673
use_set_symbols=merged_config.use_set_symbols,
7774
).visit(tree)
75+
76+
raise ValueError(f"Unrecognized style: {style}")

0 commit comments

Comments
 (0)