Ejemplo n.º 1
0
def top_level_element(tag_name):
    return Style(
        on_start=actions.sequence(
            actions.clear_stack,
            actions.open_element(tag_name)
        ),
        on_end=actions.clear_stack
    )
Ejemplo n.º 2
0
def unordered_list(depth=1):
    descriptions = []
    for i in range(0, depth - 1):
        descriptions.append(actions.ElementDescription("ul"))
        descriptions.append(actions.ElementDescription("li"))
    descriptions.append(actions.ElementDescription("ul"))
    
    return Style(
        on_start=actions.sequence(
            actions.ensure_stack(*descriptions),
            actions.open_element("li")
        ),
        on_end=actions.no_op
    )