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

Method add_class

src/__init__.py:2165–2176  ·  view source on GitHub ↗

Set some class via CSS. Replaces complete class spec.

(self, text)

Source from the content-addressed store, hash-verified

2163 return child
2164
2165 def add_class(self, text):
2166 """Set some class via CSS. Replaces complete class spec."""
2167 cls = self.get_attribute_value("class")
2168 if cls is not None and text in cls:
2169 return self
2170 self.remove_attribute("class")
2171 if cls is None:
2172 cls = text
2173 else:
2174 cls += " " + text
2175 self.set_attribute("class", cls)
2176 return self
2177
2178 def add_code(self, text=None):
2179 """Add a "code" tag"""

Callers 1

set_propertiesMethod · 0.95

Calls 3

get_attribute_valueMethod · 0.95
remove_attributeMethod · 0.95
set_attributeMethod · 0.95

Tested by

no test coverage detected