MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / render_expression

Function render_expression

SLiCAP/schematic/latex_label.py:185–198  ·  view source on GitHub ↗

Convert a {…} value string to SVG bytes. Returns cached bytes if available, renders fresh otherwise. Returns None when LaTeX rendering is disabled, the value is not an expression, SLiCAP is unavailable, or any step in the pipeline fails.

(value_str: str)

Source from the content-addressed store, hash-verified

183
184
185def render_expression(value_str: str) -> bytes | None:
186 """
187 Convert a {…} value string to SVG bytes.
188
189 Returns cached bytes if available, renders fresh otherwise.
190 Returns None when LaTeX rendering is disabled, the value is not an
191 expression, SLiCAP is unavailable, or any step in the pipeline fails.
192 """
193 if not LATEX_AVAILABLE:
194 return None
195 if not is_expression(value_str):
196 return None
197 expr_str = value_str.strip()[1:-1].strip()
198 return _render_cached(expr_str)
199
200
201def expression_to_latex(value_str: str) -> str:

Callers 1

update_labelsMethod · 0.85

Calls 2

is_expressionFunction · 0.85
_render_cachedFunction · 0.85

Tested by

no test coverage detected