diff --git a/TODO b/TODO
index 12d011b5..6dc060e7 100644
--- a/TODO
+++ b/TODO
@@ -1,2 +1 @@
-* Add RSS generation
* package it !
diff --git a/pelican/generator.py b/pelican/generator.py
index f54ddf4c..aa441287 100644
--- a/pelican/generator.py
+++ b/pelican/generator.py
@@ -9,6 +9,7 @@ from functools import partial
from operator import attrgetter
from jinja2 import Environment, FileSystemLoader
+from feedgenerator import Atom1Feed
import rstdirectives # import the directives to have pygments support
@@ -20,7 +21,9 @@ _DEFAULT_THEME =\
_DEFAULT_CONFIG = {'PATH': None,
'THEME': _DEFAULT_THEME,
'OUTPUT_PATH': 'output/',
- 'MARKUP': 'rst'}
+ 'MARKUP': 'rst',
+ 'STATIC_PATHS': ['css', 'images'],
+ 'FEED_FILENAME': 'atom.xml'}
def generate_output(path=None, theme=None, output_path=None, markup=None,
settings=None):
@@ -84,12 +87,31 @@ def generate_output(path=None, theme=None, output_path=None, markup=None,
generate('%s' % article.url,
templates['article'], context, article=article)
- # copy css path to output/css
- try:
- shutil.copytree(os.path.join(theme, 'css'),
- os.path.join(output_path, 'css'))
- except OSError:
- pass
+ # generate atom feed
+ feed = Atom1Feed(
+ title=context['BLOGNAME'],
+ link=context['BLOGURL'],
+ feed_url='%s/%s' % (context['BLOGURL'], context['FEED_FILENAME']),
+ description=context['BLOGSUBTITLE'])
+ for article in articles:
+ feed.add_item(
+ title=article.title,
+ link='%s/%s' % (context['BLOGURL'], article.url),
+ description=article.content,
+ author_name=article.author,
+ pubdate=article.date)
+
+ fp = open(os.path.join(output_path, context['FEED_FILENAME']), 'w')
+ feed.write(fp, 'utf-8')
+ fp.close()
+
+ # copy static paths to output
+ for path in context['STATIC_PATHS']:
+ try:
+ shutil.copytree(os.path.join(theme, path),
+ os.path.join(output_path, path))
+ except OSError:
+ pass
def generate_file(path, name, template, context, **kwargs):
diff --git a/samples/themes/notmyidea/base.html b/samples/themes/notmyidea/base.html
deleted file mode 100644
index 5e08829a..00000000
--- a/samples/themes/notmyidea/base.html
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
- {% block title %}{{ BLOGNAME }}{%endblock%}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% block content %}
- {% endblock %}
-
- {% if BLOGROLL %}
-
-
blogroll
-
- {% for name, link in BLOGROLL %}
- - {{ name }}
- {% endfor %}
-
-
- {% endif %}
- {% if SOCIAL %}
-
-
social
-
- - rss
- {% for name, link in SOCIAL %}
- - {{ name }}
- {% endfor %}
-
-
- {% endif %}
-
-
-
-
-
-
diff --git a/samples/themes/notmyidea/css/main.css b/samples/themes/notmyidea/css/main.css
index 2b0d852b..459eafdf 100644
--- a/samples/themes/notmyidea/css/main.css
+++ b/samples/themes/notmyidea/css/main.css
@@ -281,7 +281,7 @@ img.left, figure.left {float: right; margin: 0 0 2em 2em;}
.social a[href*='digg.com'] {background-image: url('../images/icons/digg.png');}
.social a[href*='facebook.com'] {background-image: url('../images/icons/facebook.png');}
.social a[href*='last.fm'], .social a[href*='lastfm.'] {background-image: url('../images/icons/lastfm.png');}
- .social a[href*='/feed/'] {background-image: url('../images/icons/rss.png');}
+ .social a[href*='atom.xml'] {background-image: url('../images/icons/rss.png');}
.social a[href*='twitter.com'] {background-image: url('../images/icons/twitter.png');}
/*
diff --git a/samples/themes/notmyidea/images/icons/delicious.png b/samples/themes/notmyidea/images/icons/delicious.png
new file mode 100644
index 00000000..c6ce246a
Binary files /dev/null and b/samples/themes/notmyidea/images/icons/delicious.png differ
diff --git a/samples/themes/notmyidea/images/icons/lastfm.png b/samples/themes/notmyidea/images/icons/lastfm.png
new file mode 100644
index 00000000..b09c7876
Binary files /dev/null and b/samples/themes/notmyidea/images/icons/lastfm.png differ
diff --git a/samples/themes/notmyidea/images/icons/rss.png b/samples/themes/notmyidea/images/icons/rss.png
new file mode 100644
index 00000000..7d4e85d9
Binary files /dev/null and b/samples/themes/notmyidea/images/icons/rss.png differ
diff --git a/samples/themes/notmyidea/images/icons/twitter.png b/samples/themes/notmyidea/images/icons/twitter.png
new file mode 100644
index 00000000..d6119280
Binary files /dev/null and b/samples/themes/notmyidea/images/icons/twitter.png differ
diff --git a/samples/themes/notmyidea/templates/base.html b/samples/themes/notmyidea/templates/base.html
index 5e08829a..59508385 100644
--- a/samples/themes/notmyidea/templates/base.html
+++ b/samples/themes/notmyidea/templates/base.html
@@ -4,6 +4,8 @@
{% block title %}{{ BLOGNAME }}{%endblock%}
+
+
@@ -45,7 +47,7 @@