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

Method script

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

The br tag inserts a single line break. Defines a script, such as a JavaScript. Note that if @src is used, then no self._script() must be used. The count attribute is not standard XHTML. It indicates the number of br to repeat. <www href="http://www.w3schoo

(self, charset='UTF-8', scriptType='text/javascript', **args)

Source from the content-addressed store, hash-verified

1611 self.write_tag('embed', False, args)
1612
1613 def script(self, charset='UTF-8', scriptType='text/javascript', **args):
1614 """The br tag inserts a single line break. Defines a script, such as a
1615 JavaScript. Note that if @src is used, then no self._script() must be
1616 used.
1617
1618 The count attribute is not standard XHTML. It indicates the number of
1619 br to repeat.
1620
1621 <www href="http://www.w3schools.com/tags/tag_script.asp" target="external"/>
1622
1623 self.script()
1624 ...
1625 self._script()
1626
1627 """
1628 #
1629 # Build script. Note that if @src is used, then no self._script()
1630 # must be used.
1631 #
1632 self.write('<script')
1633 # Make sure to write "UTF-8" instead of "utf-8" since FireFox 2.0.0.4 will
1634 # ignore the script otherwise.
1635 self.write(' charset="%s"' % charset.upper())
1636 self.write(' type="%s"' % scriptType)
1637 language = args.get('language')
1638 if language is not None:
1639 self.write(' language="%s"' % language)
1640 for key, value in args.items():
1641 self.write(' %s="%s"' % (dataAttribute2Html5Attribute(key), value))
1642 src = args.get('src')
1643 if src is not None:
1644 self.write('></script>\n')
1645 else:
1646 self._pushTag('script')
1647 self.write('>\n')
1648
1649 def _script(self):
1650 self.write('\n')

Callers 2

script_Method · 0.95
write_javascriptMethod · 0.80

Calls 4

writeMethod · 0.80
_pushTagMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected