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

Method write_body

Lib/pagebot/elements/page.py:624–650  ·  view source on GitHub ↗

Build the page body. There are 3 option (all excluding the ... ) 1 As html string (self.bodyCode is defined as not None) 2 As path to a html file, containing the string between ... , including the tags 3 Constructed from view paramete

(self, view, path)

Source from the content-addressed store, hash-verified

622 b.meta(name='keywords', content=self.keyWords)
623 b._head()
624 def write_body(self, view, path):
625 """
626 Build the page body. There are 3 option (all excluding the <body>...</body>)
627
628 1 As html string (self.bodyCode is defined as not None)
629 2 As path to a html file, containing the string between
630 <body>...</body>, including the tags
631 3 Constructed from view parameter context, page attributes and styles.
632 """
633 context = view.context
634 b = context.b
635
636 if self.bodyCode is not None:
637 b.addHtml(self.bodyCode)
638 elif self.bodyPath is not None:
639 b.importHtml(self.bodyPath) # Add HTML content of file, if path is not None and the file exists.
640 else:
641 b.body()
642
643 for e in self.elements:
644 e.build_html(view, path)
645
646 self.write_javascript(view)
647
648 # Close the page body
649 b._body()
650 b._html()
651
652 def write_javascript(self, view):
653 """Builds the JS body. There are 4 option (all not including the

Callers 1

write_htmlMethod · 0.95

Calls 7

write_javascriptMethod · 0.95
addHtmlMethod · 0.80
importHtmlMethod · 0.80
bodyMethod · 0.80
_bodyMethod · 0.80
_htmlMethod · 0.80
build_htmlMethod · 0.45

Tested by

no test coverage detected