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 )
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 )