Build the HTML 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.
(self, view, origin=None, **kwargs)
| 904 | # B U I L D H T M L |
| 905 | |
| 906 | def build_html(self, view, origin=None, **kwargs): |
| 907 | """Build the HTML code through WebBuilder (or equivalent) that is |
| 908 | the closest representation of self. If there are any child elements, |
| 909 | then also included their code, using the level recursive indent.""" |
| 910 | |
| 911 | context = view.context # Get current context. |
| 912 | b = context.b |
| 913 | |
| 914 | if self.bs is not None: |
| 915 | html = context.fromBabelString(self.bs) |
| 916 | # Check if there is any content, besides white space. |
| 917 | hasContent = bool(html and html.strip()) |
| 918 | else: |
| 919 | hasContent = False |
| 920 | |
| 921 | # Use self.cssClass if defined, otherwise self class. #id is ignored if None |
| 922 | if hasContent: |
| 923 | b.div(cssClass=self.cssClass or self.__class__.__name__.lower(), cssId=self.cssId) |
| 924 | # Get HTML from BabelString in HtmlString context. |
| 925 | b.addHtml(html) |
| 926 | |
| 927 | for e in self.elements: |
| 928 | e.build_html(view, origin, **kwargs) |
| 929 | |
| 930 | if hasContent: |
| 931 | b._div() # self.cssClass or self.__class__.__name__ |
| 932 | |
| 933 | if __name__ == '__main__': |
| 934 | import doctest |
nothing calls this directly
no test coverage detected