autoclasstoc.nodes.details
- class autoclasstoc.nodes.details(open_by_default=False)[source]
A node that can be expanded or collapsed by the user.
This is rendered as a
<details>
element in HTML. It is not currently compatible with non-HTML output formats.Public Data Attributes:
Inherited from
Element
basic_attributes
Tuple of attributes which are defined for every Element-derived class instance and can be safely transferred to a different node.
local_attributes
Tuple of class-specific attributes that should not be copied with the standard attributes when replacing a node.
list_attributes
Tuple of attributes that are automatically initialized to empty lists for all nodes.
known_attributes
Tuple of attributes that are known to the Element base class.
tagname
The element generic identifier.
child_text_separator
Separator for child nodes, used by
astext()
method.Inherited from
Node
parent
Back-reference to the Node immediately containing this Node.
source
Path or description of the input source which generated this Node.
line
The line number (1-based) of the beginning of this Node in
source
.document
Return the
document
node at the root of the tree containing this Node.Public Methods:
__init__
([open_by_default])visit_html
(node)depart_html
(node)Inherited from
Element
__init__
([rawsource])__repr__
()Return repr(self).
shortrepr
()__unicode__
()__str__
()Return str(self).
starttag
([quoteattr])endtag
()emptytag
()__len__
()__contains__
(key)__getitem__
(key)__setitem__
(key, item)__delitem__
(key)__add__
(other)__radd__
(other)__iadd__
(other)Append a node or a list of nodes to
self.children
.astext
()Return a string representation of this Node.
non_default_attributes
()attlist
()get
(key[, failobj])hasattr
(attr)delattr
(attr)setdefault
(key[, failobj])has_key
(attr)get_language_code
([fallback])Return node's language tag.
append
(item)extend
(item)insert
(index, item)pop
([i])remove
(item)index
(item)is_not_default
(key)update_basic_atts
(dict_)Update basic attributes ('ids', 'names', 'classes', 'dupnames', but not 'source') from node or dictionary
dict_
.append_attr_list
(attr, values)For each element in values, if it does not exist in self[attr], append it.
coerce_append_attr_list
(attr, value)First, convert both self[attr] and value to a non-string sequence type; if either is not already a sequence, convert it to a list of one element.
replace_attr
(attr, value[, force])If self[attr] does not exist or force is True or omitted, set self[attr] to value, otherwise do nothing.
copy_attr_convert
(attr, value[, replace])If attr is an attribute of self, set self[attr] to [self[attr], value], otherwise set self[attr] to value.
copy_attr_coerce
(attr, value, replace)If attr is an attribute of self and either self[attr] or value is a list, convert all non-sequence values to a sequence of 1 element and then concatenate the two sequence, setting the result to self[attr].
copy_attr_concatenate
(attr, value, replace)If attr is an attribute of self and both self[attr] and value are lists, concatenate the two sequences, setting the result to self[attr].
copy_attr_consistent
(attr, value, replace)If replace is True or self[attr] is None, replace self[attr] with value.
update_all_atts
(dict_[, update_fun, ...])Updates all attributes from node or dictionary
dict_
.update_all_atts_consistantly
(dict_[, ...])Updates all attributes from node or dictionary
dict_
.update_all_atts_concatenating
(dict_[, ...])Updates all attributes from node or dictionary
dict_
.update_all_atts_coercion
(dict_[, replace, ...])Updates all attributes from node or dictionary
dict_
.update_all_atts_convert
(dict_[, and_source])Updates all attributes from node or dictionary
dict_
.clear
()replace
(old, new)Replace one child
Node
with another child or children.replace_self
(new)Replace
self
node withnew
, wherenew
is a node or a list of nodes.first_child_matching_class
(childclass[, ...])Return the index of the first child whose class exactly matches.
first_child_not_matching_class
(childclass[, ...])Return the index of the first child whose class does not match.
pformat
([indent, level])Return an indented pseudo-XML representation, for test purposes.
copy
()monkey-patch Element.copy to copy the rawsource and line for docutils-0.16 or older versions.
deepcopy
()Return a deep copy of self (also copying children).
set_class
(name)Add a new class to the "classes" attribute.
note_referenced_by
([name, id])Note that this Element has been referenced by its name
name
or idid
.is_not_list_attribute
(attr)Returns True if and only if the given attribute is NOT one of the basic list attributes defined for all Elements.
is_not_known_attribute
(attr)Returns True if and only if the given attribute is NOT recognized by this class.
Inherited from
Node
__bool__
()Node instances are always true, even if they're empty.
asdom
([dom])Return a DOM fragment representation of this Node.
pformat
([indent, level])Return an indented pseudo-XML representation, for test purposes.
copy
()Return a copy of self.
deepcopy
()Return a deep copy of self (also copying children).
astext
()Return a string representation of this Node.
setup_child
(child)walk
(visitor)Traverse a tree of
Node
objects, calling thedispatch_visit()
method ofvisitor
when entering each node.walkabout
(visitor)Perform a tree traversal similarly to
Node.walk()
(which see), except also call thedispatch_departure()
method before exiting each node.traverse
([condition, include_self, descend, ...])Return list of nodes following
self
.findall
([condition, include_self, descend, ...])Return an iterator yielding nodes following
self
:next_node
([condition, include_self, ...])Return the first node in the iterator returned by findall(), or None if the iterable is empty.
previous_sibling
()Return preceding sibling node or
None
.Private Data Attributes:
Inherited from
Node
_document
Private Methods:
Inherited from
Element
_dom_node
(domroot)Inherited from
Node
_fast_findall
(cls)Return iterator that only supports instance checks.
_superfast_findall
()Return iterator that doesn't check for a condition.
Full Documentation:
- __slotnames__ = []
- html = (<function details.visit_html>, <function details.depart_html>)