INNER CODE UNIT · Python
_handle_key_value
pingbird/puro · website/pm_attr_list.py:38
def _handle_key_value(_, t):
return t.split('=', 1)
def _handle_word(_, t):
if t.startswith('.'):
return '.', t[1:]
if t.startswith('#'):
return 'id', t[1:]
return t, t
_scanner = re.Scanner([
(r'[^ =]+=".*?"', _handle_double_quote),
(r"[^ =]+='.*?'", _handle_single_quote),
(r'[^ =]+=[^ =]+', _handle_key_value),
(r'[^ =]+', _handle_word),
(r' ', None)