Item#
Qualified name: rsm.nodes.Item
- class rsm.nodes.Item(title='', **kwargs)[source]#
Bases:
BaseParagraphMethods
Attributes
Allowed types of parent Nodes.
nodeidNode id - always exists (unlike label), automatically assigned, unique within the tree.
labelUnique identifier.
classesCSS classes for this node.
handrail_depthThe number of ancestors of this node that have a handrail.
numberNode number.
nonumWhether this node should be automatically given a number.
reftext_templateReftext template, or "" to use
classreftext.start_pointThe start point of the corresponding concrete syntax tree node.
end_pointThe end point of the corresponding concrete syntax tree node.
- possible_parents: ClassVar[set[type[NodeWithChildren]]] = {<class 'rsm.nodes.Contents'>, <class 'rsm.nodes.Enumerate'>, <class 'rsm.nodes.Itemize'>}[source]#
Allowed types of parent Nodes.
When setting the parent of a Node, this attribute is checked to see whether the intended parent has an admissible type.
Examples
This is a class variable
>>> nodes.Item.possible_parents == {nodes.Itemize, nodes.Enumerate, nodes.Contents} True
This variable is checked when setting the parent directly.
>>> it = nodes.Item() >>> it.parent = nodes.Paragraph() Traceback (most recent call last): rsm.nodes.RSMNodeError: Node of type <class 'rsm.nodes.Item'> cannot have parent of type <class 'rsm.nodes.Paragraph'>
This is also used when setting the parent in some other indirect way, for example when calling
append()on the desired parent.>>> nodes.Paragraph().append(it) Traceback (most recent call last): rsm.nodes.RSMNodeError: Node of type <class 'rsm.nodes.Item'> cannot have parent of type <class 'rsm.nodes.Paragraph'>
Allowed parents proceed without raising.
>>> nodes.Itemize().append(it) Itemize(parent=None, [Item])