MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / _get_node_tree

Method _get_node_tree

src/__init__.py:2137–2157  ·  view source on GitHub ↗
( self)

Source from the content-addressed store, hash-verified

2135 assert 0, f'Unsupported type for rhs: {type(rhs)}'
2136
2137 def _get_node_tree( self):
2138 def show_node(node, items, shift):
2139 while node is not None:
2140 if node.is_text:
2141 items.append((shift, f'"{node.text}"'))
2142 node = node.next
2143 continue
2144 items.append((shift, f"({node.tagname}"))
2145 for k, v in node.get_attributes().items():
2146 items.append((shift, f"={k} '{v}'"))
2147 child = node.first_child
2148 if child:
2149 items = show_node(child, items, shift + 1)
2150 items.append((shift, f"){node.tagname}"))
2151 node = node.next
2152 return items
2153
2154 shift = 0
2155 items = []
2156 items = show_node(self, items, shift)
2157 return items
2158
2159 def add_bullet_list(self):
2160 """Add bulleted list ("ul" tag)"""

Callers 1

debugMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected