Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove EXPRESSION style #171

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/latexify/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ def expression(
`use_signature=False`.
"""
kwargs["use_signature"] = kwargs.get("use_signature", False)

if fn is not None:
return function(fn, **kwargs)
else:
return function(**kwargs)
return ipython_wrappers.LatexifiedFunction(fn, **kwargs)

def wrapper(f):
return ipython_wrappers.LatexifiedFunction(f, **kwargs)

return wrapper
7 changes: 3 additions & 4 deletions src/latexify/generate_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Style(enum.Enum):
"""The style of the generated LaTeX."""

ALGORITHMIC = "algorithmic"
EXPRESSION = "expression"
FUNCTION = "function"
IPYTHON_ALGORITHMIC = "ipython-algorithmic"

Expand Down Expand Up @@ -67,11 +66,11 @@ def get_latex(
elif style == Style.IPYTHON_ALGORITHMIC:
# TODO(ZibingZhang): implement algorithmic codegen for ipython
raise exceptions.LatexifyNotSupportedError
else:
if style == Style.EXPRESSION:
kwargs["use_signature"] = kwargs.get("use_signature", False)
elif style == Style.FUNCTION:
return codegen.FunctionCodegen(
use_math_symbols=merged_config.use_math_symbols,
use_signature=merged_config.use_signature,
use_set_symbols=merged_config.use_set_symbols,
).visit(tree)

raise ValueError(f"Unrecognized style: {style}")