def chunk(line, mapping={None: 'text', '${': 'escape', '#{': 'bless', '&{':
    'args', '%{': 'format', '@{': 'json'}):
    """Chunkify and "tag" a block of text into plain text and code sections.
	
	The first delimeter is blank to represent text sections, and keep the indexes aligned with the tags.
	
	Values are yielded in the form (tag, text).
	"""
    skipping = 0
    start = None
    last = 0
    i = 0
    text = line.line
    while i < len(text):
        if start is not None:
            if text[i] == '{':
                skipping += 1
            elif text[i] == '}':
                if skipping:
                    skipping -= 1
                else:
                    yield line.clone(kind=mapping[text[start - 2:start]],
                        line=text[start:i])
                    start = None
                    last = i = i + 1
                    continue
        elif text[i:i + 2] in mapping:
            if last is not None and last != i:
                yield line.clone(kind=mapping[None], line=text[last:i])
                last = None
            start = i = i + 2
            continue
        i += 1
    if last < len(text):
        yield line.clone(kind=mapping[None], line=text[last:])
