Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
docutils.utils.math.mathml_elements.MathElement Class Reference
Inheritance diagram for docutils.utils.math.mathml_elements.MathElement:
Inheritance graph
[legend]
Collaboration diagram for docutils.utils.math.mathml_elements.MathElement:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, *children, **attributes)
 
 __repr__ (self)
 
 __str__ (self)
 
 set (self, key, value)
 
 __setitem__ (self, key, value)
 
 is_full (self)
 
 close (self)
 
 append (self, element)
 
 extend (self, elements)
 
 pop (self, index=-1)
 
 in_block (self)
 
 indent_xml (self, space=' ', level=0)
 
 unindent_xml (self)
 
 toxml (self, encoding=None)
 

Static Public Member Functions

 a_str (v)
 

Public Attributes

 text
 

Static Public Attributes

 nchildren = None
 
 parent = None
 

Detailed Description

Base class for MathML elements.

Constructor & Destructor Documentation

◆ __init__()

docutils.utils.math.mathml_elements.MathElement.__init__ (   self,
children,
**  attributes 
)
Set up node with `children` and `attributes`.

Attribute names are normalised to lowercase.
You may use "CLASS" to set a "class" attribute.
Attribute values are converted to strings
(with True -> "true" and False -> "false").

>>> math(CLASS='test', level=3, split=True)
math(class='test', level='3', split='true')
>>> math(CLASS='test', level=3, split=True).toxml()
'<math class="test" level="3" split="true"></math>'

Reimplemented in docutils.utils.math.mathml_elements.MathSchema, and docutils.utils.math.mathml_elements.MathToken.

Member Function Documentation

◆ __repr__()

docutils.utils.math.mathml_elements.MathElement.__repr__ (   self)
Return full string representation.

◆ __str__()

docutils.utils.math.mathml_elements.MathElement.__str__ (   self)
Return concise, informal string representation.

◆ append()

docutils.utils.math.mathml_elements.MathElement.append (   self,
  element 
)
Append `element` and return new "current node" (insertion point).

Append as child element and set the internal `parent` attribute.

If self is already full, raise TypeError.

If self is full after appending, call `self.close()`
(returns first non-full anchestor or None) else return `self`.

Reimplemented in docutils.utils.math.mathml_elements.MathSchema.

◆ close()

docutils.utils.math.mathml_elements.MathElement.close (   self)
Close element and return first non-full anchestor or None.

Reimplemented in docutils.utils.math.mathml_elements.mrow.

◆ extend()

docutils.utils.math.mathml_elements.MathElement.extend (   self,
  elements 
)
Sequentially append `elements`. Return new "current node".

Raise TypeError if overfull.

◆ in_block()

docutils.utils.math.mathml_elements.MathElement.in_block (   self)
Return True, if `self` or an ancestor has ``display='block'``.

Used to find out whether we are in inline vs. displayed maths.

◆ indent_xml()

docutils.utils.math.mathml_elements.MathElement.indent_xml (   self,
  space = '  ',
  level = 0 
)
Format XML output with indents.

Use with care:
  Formatting whitespace is permanently added to the
  `text` and `tail` attributes of `self` and anchestors!

◆ is_full()

docutils.utils.math.mathml_elements.MathElement.is_full (   self)
Return boolean indicating whether children may be appended.

◆ toxml()

docutils.utils.math.mathml_elements.MathElement.toxml (   self,
  encoding = None 
)
Return an XML representation of the element.

By default, the return value is a `str` instance. With an explicit
`encoding` argument, the result is a `bytes` instance in the
specified encoding. The XML default encoding is UTF-8, any other
encoding must be specified in an XML document header.

Name and encoding handling match `xml.dom.minidom.Node.toxml()`
while `etree.Element.tostring()` returns `bytes` by default.

◆ unindent_xml()

docutils.utils.math.mathml_elements.MathElement.unindent_xml (   self)
Strip whitespace at the end of `text` and `tail` attributes...

to revert changes made by the `indent_xml()` method.
Use with care, trailing whitespace from the original may be lost.

The documentation for this class was generated from the following file: