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

Function eqn2html

SLiCAP/SLiCAPhtml.py:554–585  ·  view source on GitHub ↗

Displays an equation on the active HTML page'. :param arg1: left hand side of the equation :type arg1: str, sympy.Symbol, sympy.Expr :param arg2: right hand side of the equation :type arg2: str, sympy.Symbol, sympy.Expr :param label: ID of the label assigned to th

(arg1, arg2, units='', label='', labelText='')

Source from the content-addressed store, hash-verified

552 return html
553
554def eqn2html(arg1, arg2, units='', label='', labelText=''):
555 """
556 Displays an equation on the active HTML page'.
557
558 :param arg1: left hand side of the equation
559 :type arg1: str, sympy.Symbol, sympy.Expr
560
561 :param arg2: right hand side of the equation
562 :type arg2: str, sympy.Symbol, sympy.Expr
563
564 :param label: ID of the label assigned to this equation; defaults to ''.
565 :type label: str
566
567 :param labelText: Label text to be displayed by **links2html()**; defaults to ''
568 :type labelText: str
569
570 :return: HTML string that will be placed on the page.
571 :rtype: str
572 """
573 if arg1 == None or arg2 == None:
574 return
575 arg1 = sp.sympify(str(arg1))
576 arg2 = sp.sympify(str(arg2))
577 if units != '':
578 units = '\\,\\left[ \\mathrm{' + units2TeX(units) + '}\\right]'
579 label = _addLabel(label, caption=labelText, labelType='eqn')
580 value = _latex_ENG(arg2)
581 #value = sp.latex(roundN(arg2))
582 html = label + '\\begin{equation}\n' + sp.latex(roundN(arg1)) + '=' + value + units + '\n'
583 html += '\\end{equation}\n'
584 html = _insertHTML(ini.html_path + ini.html_page, html)
585 return html
586
587def matrices2html(results, label='', labelText=''):
588 """

Callers

nothing calls this directly

Calls 5

units2TeXFunction · 0.90
roundNFunction · 0.90
_addLabelFunction · 0.85
_latex_ENGFunction · 0.85
_insertHTMLFunction · 0.85

Tested by

no test coverage detected