MCPcopy Create free account
hub / github.com/PageBot/PageBot / addHtml

Method addHtml

Lib/pagebot/contexts/htmlcontext/htmlbuilder.py:580–595  ·  view source on GitHub ↗

Add the HTML chunk to self.html, the ordered list of HTML for output. Test if the html is a plain string or of type HtmlString(BabelString). Otherwise raise an error, because we don't want to support BabelString conversion. They should have been created of the right t

(self, html)

Source from the content-addressed store, hash-verified

578 # H T M L
579
580 def addHtml(self, html):
581 """Add the HTML chunk to self.html, the ordered list of HTML for
582 output. Test if the html is a plain string or of type
583 HtmlString(BabelString). Otherwise raise an error, because we don't
584 want to support BabelString conversion. They should have been created
585 of the right type in the context from the start."""
586
587 #if not isinstance(html, str): # It's something else, test on the kind of BabelString.
588 # assert isinstance(html, HtmlString)
589 try:
590 assert isinstance(html.s, str)
591 html = html.s # Get the collected html from the BabelString.
592 except AttributeError:
593
594 html = str(html) # Make sure it is a string
595 self._htmlOut.append(html)
596
597 write = addHtml
598

Callers 15

textBoxMethod · 0.95
importHtmlMethod · 0.95
h1_Method · 0.95
h2_Method · 0.95
h3_Method · 0.95
h4_Method · 0.95
h5_Method · 0.95
h6_Method · 0.95
script_Method · 0.95
button_Method · 0.95
build_htmlMethod · 0.80
build_htmlMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected