algebraixlib.util.html module¶
Utilities that present MathObjects as HTML pages.
-
class
algebraixlib.util.html.DataAlgebraHtmlDescriptor(input_title, data_algebra_construct, description_brief)¶ Bases:
tupleNamed
tuplefor collecting information about aMathObject. It contains: -input_title: (Optional) A string that can serve as a name, origin expression or title. -data_algebra_construct: TheMathObjector container ofMathObjects. -description_brief: (Optional) A string to display more detail.-
static
__new__(_cls, input_title, data_algebra_construct, description_brief)¶ Create new instance of DataAlgebraHtmlDescriptor(input_title, data_algebra_construct, description_brief)
-
__repr__()¶ Return a nicely formatted representation string
-
data_algebra_construct¶ Alias for field number 1
-
description_brief¶ Alias for field number 2
-
input_title¶ Alias for field number 0
-
static
-
algebraixlib.util.html.math_object_as_html(title: str, data_algebra_html_descriptors: [], header_template: str = None, footer_template: str = None, mathobject_template: str = None) → str[source]¶ Return the contents of an HTML webpage representing a
MathObject, using templates.Parameters: - title – The title for this page of
MathObjects. - data_algebra_html_descriptors – An array of
DataAlgebraHtmlDescriptorinstances (containing math objects and their related descriptive strings). - header_template – HTML markup that starts the webpage. May contain the template variable
page_title; it is set to the value oftitle. - footer_template – HTML markup that ends the page.
- mathobject_template – The HTML markup that is emited for each math object. May contain
the template variables
input_title,description_briefanddata_algebra_construct, which are replaced with the respective values in the associatedDataAlgebraHtmlDescriptor.
- title – The title for this page of
-
algebraixlib.util.html.as_html_handle_basic_parameter(html_input: str) → str[source]¶ Return the string of
html_input, properly escaped for using it in HTML.
-
algebraixlib.util.html.as_html_handle_data_algebra(mathobj)[source]¶ Return
mathobjconverted into a string safe to be used in HTML.- If
mathobjis aMathObject, it will be represented as LaTeX markup and wrapped in the mathjax escape token. - If it is a container of
MathObjects, then each one will be represented as LaTeX markup and displayed on its own line. - If it is not a
MathObjectthen thestrfunction will be invoked.
- If
-
algebraixlib.util.html.build_descriptors_from_math_obj(mathobjects)[source]¶ Return an array of simple
DataAlgebraHtmlDescriptorof the objects inmathobjects.Parameters: mathobjects – List of objects from which to create descriptors.
-
algebraixlib.util.html.create_simple_web_page(mathobj: algebraixlib.mathobjects.mathobject.MathObject) → str[source]¶ Return an HTML string for a simple HTML page from a single
MathObject.