Example #1
0
    def attr_display(value: str, html_element: HtmlElement):
        """Apply the given display value."""
        if html_element.display == Display.none:
            return

        if value == 'block':
            html_element.display = Display.block
        elif value == 'none':
            html_element.display = Display.none
        else:
            html_element.display = Display.inline
def test_formatting():
    # standard line

    h = HtmlElement()
    assert _get_text(h) == 'firstEhre sei Gott!last'

    h.display = Display.block
    h.margin_before = 1
    h.margin_after = 2
    print(h)
    print(_get_text(h))
    assert _get_text(h) == 'first\n\nEhre sei Gott!\n\n\nlast'

    # list bullet without padding_inline
    h.list_bullet = "* "
    assert _get_text(h) == 'first\n\n* Ehre sei Gott!\n\n\nlast'

    # add a padding_inline
    h.padding_inline = 3
    assert _get_text(h) == 'first\n\n * Ehre sei Gott!\n\n\nlast'

    # and prefixes + suffixes
    h.prefix = '>>'
    h.suffix = '<<'
    assert  _get_text(h)== 'first\n\n * >>Ehre sei Gott!<<\n\n\nlast'