MCPcopy Create free account
hub / github.com/commonmark/cmark / handle_data

Method handle_data

test/normalize.py:30–43  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

28 self.output = ""
29 self.last_tag = ""
30 def handle_data(self, data):
31 after_tag = self.last == "endtag" or self.last == "starttag"
32 after_block_tag = after_tag and self.is_block_tag(self.last_tag)
33 if after_tag and self.last_tag == "br":
34 data = data.lstrip('\n')
35 if not self.in_pre:
36 data = whitespace_re.sub(' ', data)
37 if after_block_tag and not self.in_pre:
38 if self.last == "starttag":
39 data = data.lstrip()
40 elif self.last == "endtag":
41 data = data.strip()
42 self.output += data
43 self.last = "data"
44 def handle_endtag(self, tag):
45 if tag == "pre":
46 self.in_pre = False

Callers

nothing calls this directly

Calls 1

is_block_tagMethod · 0.95

Tested by

no test coverage detected