

def remove_empty_tags(self):
    "It's common in top_node to exit tags that are filled with data\n        within properties but not within the tags themselves, delete them\n        "
    all_nodes = self.parser.getElementsByTags(self.get_top_node(), ['*'])
    all_nodes.reverse()
    for el in all_nodes:
        tag = self.parser.getTag(el)
        text = self.parser.getText(el)
        if (((tag != 'br') or (text != '\\r')) and (not text) and (len(self.parser.getElementsByTag(el, tag='object')) == 0) and (len(self.parser.getElementsByTag(el, tag='embed')) == 0)):
            self.parser.remove(el)

dataset/ETHPy150Open codelucas/newspaper/newspaper/outputformatters.py OutputFormatter.remove_empty_tags/original