Node for the footer.
Module whakerkit.nodes
Class WhakerKitFooterNode
Description
Constructor
Create the footer node.
Parameters
- parent: (str) The parent node identifier
- content_filename: (str) The HTML content filename
View Source
def __init__(self, parent: str, content_filename: str | None=None):
"""Create the footer node.
:param parent: (str) The parent node identifier
:param content_filename: (str) The HTML content filename
"""
super(WhakerKitFooterNode, self).__init__(parent)
self.reset(content_filename)
self.set_attribute('id', 'footer-content')
Public functions
reset
Reset the footer to its default values.
Parameters
- filename: (str | None) The filename to use for the footer content
View Source
def reset(self, filename: str | None=None):
"""Reset the footer to its default values.
:param filename: (str | None) The filename to use for the footer content
"""
self._children = list()
if filename is not None and os.path.exists(filename) is True:
with open(filename, encoding='utf-8') as html_file:
content = html_file.read()
if len(content.strip()) > 0:
self.set_value(content.strip())
self.append_child(HTMLNode(self.identifier, None, 'hr'))
content = f'<a href="https://whakerkit.sourceforge.io"> <img style="width: 1rem;" src="{whakerkit.sg.path}/statics/icons/favicon.ico" alt="(W) "></a> <p><small>{get_msg(MSG_POWERED_BY)}<small></p>'
power = HTMLNode(self.identifier, None, 'section', value=content, attributes={'class': 'center'})
self.append_child(power)