INNER CODE UNIT · Python
gather_parents
pingbird/puro · website/pm_attr_list.py:102
def gather_parents(doc):
parents = {}
for elem in doc.findall('.'):
_gather_parents(parents, None, elem)
return parents
class AttrListTreeprocessor(Treeprocessor):
BASE_RE = r'\{\:?[ ]*([^\}\n ][^\}\n]*)[ ]*\}'
HEADER_RE = re.compile(r' +{} *$'.format(BASE_RE))
BLOCK_RE = re.compile(r'\n *{} *$'.format(BASE_RE))
INLINE_RE = re.compile(r'^{}'.format(BASE_RE))
NAME_RE = re.compile(r'[^A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff'
r'\u0370-\u037d\u037f-\u1fff\u200c-\u200d'
r'\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff'
r'\uf900-\ufdcf\ufdf0-\ufffd'
r':\-.0-9\u00b7\u0300-\u036f\u203f-\u2040]+')