WhakerPy 0.8

https://sourceforge.net/projects/whakerpy/

Module whakerpy.htmlmaker

Class HTMLHr

Description

Represent a horizontal line with <hr> tag.

The <hr> tag only supports the Global Attributes in HTML.

Constructor

Create a node for <hr> tag.

Parameters
  • parent
View Source
def __init__(self, parent: str):
    """Create a node for &lt;hr&gt; tag.

    """
    super(HTMLHr, self).__init__(parent, None, 'hr')

Public functions

check_attribute

Override.

Returns
  • key(str)
Raises
  • NodeAttributeError: if given key can't be converted to string
  • NodeAttributeError: The attribute can't be assigned to this element.
Parameters
  • key
View Source
def check_attribute(self, key: str) -> str:
    """Override.

        :return: key (str)
        :raises: NodeAttributeError: if given key can't be converted to string
        :raises: NodeAttributeError: The attribute can't be assigned to this element.

        """
    try:
        key = str(key)
    except Exception:
        raise NodeAttributeError(key)
    if key not in HTML_GLOBAL_ATTR and key.startswith('data-') is False:
        raise NodeAttributeError(key)
    return key