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

Function expr2html

SLiCAP/SLiCAPhtml.py:530–552  ·  view source on GitHub ↗

Inline display of an expression optional with units. :param expr: Expression :type expr: sympy.Expr :param units: Units for this expression, defaults to ''. :type units: str :return: HTML string that will be placed on the page. :rtype: str

(expr, units='')

Source from the content-addressed store, hash-verified

528 return html
529
530def expr2html(expr, units=''):
531 """
532 Inline display of an expression optional with units.
533
534 :param expr: Expression
535 :type expr: sympy.Expr
536
537 :param units: Units for this expression, defaults to ''.
538 :type units: str
539
540 :return: HTML string that will be placed on the page.
541 :rtype: str
542 """
543 if isinstance(expr, sp.Basic):
544 if units != '':
545 units = '\\left[\\mathrm{' + units2TeX(units) + '}\\right]'
546 html = '$' + _latex_ENG(expr) + units + '$'
547 #html = '$' + sp.latex(roundN(expr)) + units + '$'
548 html = _insertHTML(ini.html_path + ini.html_page, html)
549 else:
550 print("Error: expr2html, expected a Sympy expression.")
551 html = ''
552 return html
553
554def eqn2html(arg1, arg2, units='', label='', labelText=''):
555 """

Callers

nothing calls this directly

Calls 3

units2TeXFunction · 0.90
_latex_ENGFunction · 0.85
_insertHTMLFunction · 0.85

Tested by

no test coverage detected