def attach_attrs_table(key, value, fmt, meta):
    """Extracts attributes and attaches them to element."""

    # We can't use attach_attrs_factory() because Table is a block-level element
    if key in ['Table']:
        assert len(value) == 5
        caption = value[0]  # caption, align, x, head, body

        # Set n to the index where the attributes start
        n = 0
        while n < len(caption) and not \
          (caption[n]['t'] == 'Str' and caption[n]['c'].startswith('{')):
            n += 1

        try:
            attrs = extract_attrs(caption, n)
            value.insert(0, attrs)
        except (ValueError, IndexError):
            pass
def attach_attrs_table ( key , value , fmt , meta ) : if key in [ 'Table' ] : assert len ( value ) == 5 caption = value [ 0 ] n = 0 while n < len ( caption ) and not ( caption [ n ] [ 't' ] == 'Str' and caption [ n ] [ 'c' ] . startswith ( '{' ) ) : n += 1 try : attrs = extract_attrs ( caption , n ) value . insert ( 0 , attrs ) except ( ValueError , IndexError ) : pass
Extracts attributes and attaches them to element.