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

Method span_bottom

src/__init__.py:2677–2700  ·  view source on GitHub ↗

Find deepest level in stacked spans.

(self)

Source from the content-addressed store, hash-verified

2675 return self
2676
2677 def span_bottom(self):
2678 """Find deepest level in stacked spans."""
2679 parent = self
2680 child = self.last_child
2681 if child is None:
2682 return None
2683 while child.is_text:
2684 child = child.previous
2685 if child is None:
2686 break
2687 if child is None or child.tagname != "span":
2688 return None
2689
2690 while True:
2691 if child is None:
2692 return parent
2693 if child.tagname in ("a", "sub","sup","body") or child.is_text:
2694 child = child.next
2695 continue
2696 if child.tagname == "span":
2697 parent = child
2698 child = child.first_child
2699 else:
2700 return parent
2701
2702 @property
2703 def tagname( self):

Callers 6

add_codeMethod · 0.95
add_linkMethod · 0.95
add_subscriptMethod · 0.95
add_superscriptMethod · 0.95
add_textMethod · 0.95
append_styled_spanMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected