feeds: clean up html code handling
This commit is contained in:
		@@ -320,8 +320,10 @@ class ParserXML(ParserBase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @staticmethod
 | 
					    @staticmethod
 | 
				
			||||||
    def _clean_node(xml):
 | 
					    def _clean_node(xml):
 | 
				
			||||||
        if xml is not None and len(xml):
 | 
					        if xml is not None:
 | 
				
			||||||
            [xml.remove(child) for child in xml]
 | 
					            if len(xml):
 | 
				
			||||||
 | 
					                [xml.remove(child) for child in xml]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            xml.text = None
 | 
					            xml.text = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def rule_search_all(self, rule):
 | 
					    def rule_search_all(self, rule):
 | 
				
			||||||
@@ -401,9 +403,12 @@ class ParserXML(ParserBase):
 | 
				
			|||||||
        else:
 | 
					        else:
 | 
				
			||||||
            if html_rich:
 | 
					            if html_rich:
 | 
				
			||||||
                # atom stuff
 | 
					                # atom stuff
 | 
				
			||||||
 | 
					                if 'atom' in rule:
 | 
				
			||||||
 | 
					                    match.attrib['type'] = 'xhtml'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                self._clean_node(match)
 | 
					                self._clean_node(match)
 | 
				
			||||||
                match.attrib['type'] = 'xhtml'
 | 
					 | 
				
			||||||
                match.append(lxml.html.fragment_fromstring(value, create_parent='div'))
 | 
					                match.append(lxml.html.fragment_fromstring(value, create_parent='div'))
 | 
				
			||||||
 | 
					                match.find('div').drop_tag()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                if match is not None and len(match):
 | 
					                if match is not None and len(match):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user