algebraixlib.util.html module¶
Utilities that present MathObject
s as HTML pages.
-
class
algebraixlib.util.html.
DataAlgebraHtmlDescriptor
(input_title, data_algebra_construct, description_brief)¶ Bases:
tuple
Named
tuple
for collecting information about aMathObject
. It contains: -input_title
: (Optional) A string that can serve as a name, origin expression or title. -data_algebra_construct
: TheMathObject
or container ofMathObject
s. -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
MathObject
s. - data_algebra_html_descriptors – An array of
DataAlgebraHtmlDescriptor
instances (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_brief
anddata_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
mathobj
converted into a string safe to be used in HTML.- If
mathobj
is aMathObject
, it will be represented as LaTeX markup and wrapped in the mathjax escape token. - If it is a container of
MathObject
s, then each one will be represented as LaTeX markup and displayed on its own line. - If it is not a
MathObject
then thestr
function will be invoked.
- If
-
algebraixlib.util.html.
build_descriptors_from_math_obj
(mathobjects)[source]¶ Return an array of simple
DataAlgebraHtmlDescriptor
of 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
.