Fix indent output for html/xml
This commit is contained in:
		@@ -291,7 +291,7 @@ class ParserXML(ParserBase):
 | 
			
		||||
        'rssfake': 'http://purl.org/rss/1.0/'}
 | 
			
		||||
 | 
			
		||||
    def parse(self, raw):
 | 
			
		||||
        parser = etree.XMLParser(recover=True)
 | 
			
		||||
        parser = etree.XMLParser(recover=True, remove_blank_text=True) # remove_blank_text needed for pretty_print
 | 
			
		||||
        return etree.fromstring(raw, parser)
 | 
			
		||||
 | 
			
		||||
    def remove(self):
 | 
			
		||||
@@ -441,7 +441,8 @@ class ParserHTML(ParserXML):
 | 
			
		||||
    mimetype = ['text/html', 'application/xhtml+xml']
 | 
			
		||||
 | 
			
		||||
    def parse(self, raw):
 | 
			
		||||
        return lxml.html.fromstring(raw)
 | 
			
		||||
        parser = etree.HTMLParser(remove_blank_text=True) # remove_blank_text needed for pretty_print
 | 
			
		||||
        return etree.fromstring(raw, parser)
 | 
			
		||||
 | 
			
		||||
    def tostring(self, encoding='unicode', **k):
 | 
			
		||||
        return lxml.html.tostring(self.root, encoding=encoding, **k)
 | 
			
		||||
 
 | 
			
		||||
@@ -448,7 +448,11 @@ def FeedFormat(rss, options):
 | 
			
		||||
        return rss.tocsv(encoding='UTF-8')
 | 
			
		||||
 | 
			
		||||
    elif options.reader:
 | 
			
		||||
        return rss.tohtml(encoding='UTF-8')
 | 
			
		||||
        if options.indent:
 | 
			
		||||
            return rss.tohtml(encoding='UTF-8', pretty_print=True)
 | 
			
		||||
 | 
			
		||||
        else:
 | 
			
		||||
            return rss.tohtml(encoding='UTF-8')
 | 
			
		||||
 | 
			
		||||
    else:
 | 
			
		||||
        if options.indent:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user