From: Holger Schurig Date: Wed, 23 Jun 2010 09:02:12 +0000 (+0200) Subject: rss_feed.py: changed XML beatification a but X-Git-Url: https://oss.titaniummirror.com/gitweb?p=webber.git;a=commitdiff_plain;h=081d468ad899679ab2adcfd74ec47bd29a6d4486 rss_feed.py: changed XML beatification a but --- diff --git a/plugins/rss_feed.py b/plugins/rss_feed.py index 79fdae9..a8adbec 100644 --- a/plugins/rss_feed.py +++ b/plugins/rss_feed.py @@ -1,6 +1,6 @@ # -*- coding: iso-8859-1 -*- from webber import * -import os, datetime +import os, datetime, re try: import PyRSS2Gen except ImportError: @@ -76,8 +76,10 @@ def finish(params): pass f = open(os.path.join(cfg.out_dir, cfg.rss_file), "w") # Ugly XML beautification - s = rss.to_xml().replace("<", "\n<").replace("\n\n", "\n")[1:] + s = rss.to_xml() + s = re.sub("<(?!/)", "\n<", s) + s = s.replace("\n\n", "\n") # Step two of self-reference s = s.replace('', '\n' % (cfg.main_url, cfg.rss_file)) - f.write(s) + f.write(s[1:]) f.write("\n")