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

Method build_html

Lib/pagebot/elements/element.py:873–895  ·  view source on GitHub ↗

Build the HTML/CSS code through WebBuilder (or equivalent) that is the closest representation of self. If there are any child elements, then also included their code, using the level recursive indent. For HTML builder the origin is ignored, as all position is relative.

(self, view, path, **kwargs)

Source from the content-addressed store, hash-verified

871 return d
872
873 def build_html(self, view, path, **kwargs):
874 """Build the HTML/CSS code through WebBuilder (or equivalent) that is
875 the closest representation of self. If there are any child elements,
876 then also included their code, using the level recursive indent. For
877 HTML builder the origin is ignored, as all position is relative."""
878 # Use the current context builder to write the HTML/CSS code.
879 b = view.context.b
880
881 if self.htmlCode is not None:
882 # Add chunk of defined HTML to output.
883 b.addHtml(self.htmlCode)
884 elif self.htmlPaths is not None:
885 for htmlPath in self.htmlPaths:
886 # Add HTML content from file, if path is not None and the file
887 # exists.
888 b.importHtml(htmlPath)
889 else:
890 # No default class, ignore if not defined.
891 b.div(cssClass=self.cssClass, cssId=self.cssId)
892 # Build child elements, dispatch if they implemented generic or
893 # context specific build method.
894 self.buildChildElements(view, path, **kwargs)
895 b._div()
896
897 # D R A W I N G S U P P O R T
898

Callers

nothing calls this directly

Calls 5

buildChildElementsMethod · 0.95
addHtmlMethod · 0.80
importHtmlMethod · 0.80
divMethod · 0.80
_divMethod · 0.80

Tested by

no test coverage detected