diff --git a/morss/feeds.py b/morss/feeds.py index f3f8d46..c6249a3 100644 --- a/morss/feeds.py +++ b/morss/feeds.py @@ -294,7 +294,7 @@ class ParserXML(ParserBase): 'rssfake': 'http://purl.org/rss/1.0/'} def parse(self, raw): - parser = etree.XMLParser(recover=True, remove_blank_text=True) # remove_blank_text needed for pretty_print + parser = etree.XMLParser(recover=True, remove_blank_text=True, remove_pis=True) # remove_blank_text needed for pretty_print return etree.fromstring(raw, parser) def remove(self): @@ -698,6 +698,10 @@ class FeedXML(Feed, ParserXML): def tostring(self, encoding='unicode', **k): # override needed due to "getroottree" inclusion + + if self.root.getprevious() is None: + self.root.addprevious(etree.PI('xml-stylesheet', 'type="text/xsl" href="/sheet.xsl"')) + return etree.tostring(self.root.getroottree(), encoding=encoding, **k) diff --git a/www/sheet.xsl b/www/sheet.xsl new file mode 100644 index 0000000..61b224c --- /dev/null +++ b/www/sheet.xsl @@ -0,0 +1,83 @@ + + + + + + + + + RSS feed by morss + + + + + +

RSS feed by morss

+ +

Your RSS feed is ready. You + can enter the url of this page in your newsreader.

+ +
    + +
+ + + +
+ + +
  • + + + + +
      + +
    +
    + + + +
  • +
    + + +
  • +
    ]]>
    +
  • +
    + + +
  • +
    +				
    +			
    +
  • +
    + + + +