diff --git a/src/hsd/dict.py b/src/hsd/dict.py index 847aab0..65c78af 100644 --- a/src/hsd/dict.py +++ b/src/hsd/dict.py @@ -103,6 +103,13 @@ def open_tag(self, tagname, attrib, hsdattrib): self._parentblocks.append(self._curblock) self._curblock = {} + def retrieve_tag(self, tagname): + tagname = tagname.strip() + key = tagname.lower() if self._lower_tag_names else tagname + for parentblock in self._parentblocks[-1::-1]: + if key in parentblock: + self._curblock.update(parentblock[key]) + break def close_tag(self, tagname): attrib, hsdattrib = self._attribs.pop(-1) diff --git a/src/hsd/parser.py b/src/hsd/parser.py index 4ab36d8..dd89bec 100644 --- a/src/hsd/parser.py +++ b/src/hsd/parser.py @@ -128,6 +128,9 @@ def _parse(self, line): self._closetag() self._after_equal_sign = False elif not self._inside_attrib: + if before.strip().startswith("$"): + self._eventhandler.retrieve_tag(before) + before = "" self._buffer.append(before) elif before.strip(): self._error(SYNTAX_ERROR, (self._currline, self._currline))