def METHOD_NAME(self, lines: List[str]) -> List[str]:
    done = False
    while not done:
        for line in lines:
            loc = lines.index(line)
            match = REGEXP.search(line)
            if match:
                text = [self.handleMatch(match)]
                # The line that contains the directive to include the macro
                # may be preceded or followed by text or tags, in that case
                # we need to make sure that any preceding or following text
                # stays the same.
                line_split = REGEXP.split(line, maxsplit=0)
                preceding = line_split[0]
                following = line_split[-1]
                text = [preceding, *text, following]
                lines = lines[:loc] + text + lines[loc + 1 :]
                break
        else:
            done = True
    return lines