def attribute_value(state, text, i, formats, user_data):
 ch = text[i]
 if (ch in space_chars):
  return [(1, None)]
 if (ch in {u'"', u"'"}):
  state.parse = (SQ_VAL if (ch == u"'") else DQ_VAL)
  return [(1, formats[u'string'])]
 state.parse = IN_OPENING_TAG
 state.attribute_name = None
 m = unquoted_val_pat.match(text, i)
 if (m is None):
  return [(1, formats[u'no-attr-value'])]
 return [(len(m.group()), formats[u'string'])]

def attribute_value ( state , text , i , formats , user_data ) : ch = text [ i ] if ( ch in space_chars ) : return [ ( 1 , None ) ] if ( ch in { u'"' , u"'" } ) : state . parse = ( SQ_VAL if ( ch == u"'" ) else DQ_VAL ) return [ ( 1 , formats [ u'string' ] ) ] state . parse = IN_OPENING_TAG state . attribute_name = None m = unquoted_val_pat . match ( text , i ) if ( m is None ) : return [ ( 1 , formats [ u'no-attr-value' ] ) ] return [ ( len ( m . group ( ) ) , formats [ u'string' ] ) ]
after attribute = .