def process(tree, profile, level=0): """ Processes simplified tree, making it suitable for output as HTML structure @type tree: ZenNode @type profile: dict @type level: int """ if level == 0: # preformat tree tree = zen_coding.run_filters(tree, profile, '_format') zen_coding.max_tabstop = 0 for item in tree.children: if item.type == 'tag': process_tag(item, profile, level) else: process_snippet(item, profile, level) # replace counters item.start = zen_coding.unescape_text( zen_coding.replace_counter(item.start, item.counter)) item.end = zen_coding.unescape_text( zen_coding.replace_counter(item.end, item.counter)) zen_coding.upgrade_tabstops(item) process(item, profile, level + 1) return tree
def process(tree, profile, level=0): """ Processes simplified tree, making it suitable for output as HTML structure @type tree: ZenNode @type profile: dict @type level: int """ if level == 0: # preformat tree tree = zen_coding.run_filters(tree, profile, '_format') zen_coding.max_tabstop = 0 for item in tree.children: if item.type == 'tag': process_tag(item, profile, level) else: process_snippet(item, profile, level) # replace counters item.start = zen_coding.unescape_text(zen_coding.replace_counter(item.start, item.counter)) item.end = zen_coding.unescape_text(zen_coding.replace_counter(item.end, item.counter)) zen_coding.upgrade_tabstops(item) process(item, profile, level + 1) return tree
def process(tree, profile, level=0): """ Processes simplified tree, making it suitable for output as HTML structure @type tree: ZenNode @type profile: dict @type level: int """ if level == 0: # preformat tree tree = zen_coding.run_filters(tree, profile, "_format") for i, item in enumerate(tree.children): if item.type == "tag": process_tag(item, profile, level) else: process_snippet(item, profile, level) # replace counters item.start = zen_coding.replace_counter(item.start, i + 1) item.end = zen_coding.replace_counter(item.end, i + 1) process(item, profile, level + 1) return tree