Skip to content
Browse files

Add latest 5 blog posts to homepage.

  • Loading branch information...
1 parent 42606e6 commit 7f4e7838e714281ca5e3474c133baf819ba425f8 @jwage jwage committed
View
5 build/sphinx-contrib/feed/build/lib/sphinxcontrib/feed/directives.py
@@ -45,6 +45,7 @@ class Latest(Directive):
final_argument_whitespace = False
option_spec = {
'maxdepth': int,
+ 'limit': int,
'glob': directives.flag,
'hidden': directives.flag,
'numbered': int_or_nothing,
@@ -55,6 +56,7 @@ def run(self):
env = self.state.document.settings.env
suffix = env.config.source_suffix
glob = 'glob' in self.options
+ limit = 'limit' in self.options
ret = []
# (title, ref) pairs, where ref may be a document, or an external link,
@@ -128,6 +130,9 @@ def run(self):
for date in ordered_keys:
subnode['entries'].append(sorted_entries[date])
+ if limit:
+ del subnode['entries'][self.options.get('limit'):len(subnode['entries'])]
+
# includefiles only entries that are documents
subnode['includefiles'] = includefiles
subnode['maxdepth'] = self.options.get('maxdepth', -1)
View
2 build/sphinx-contrib/feed/build/lib/sphinxcontrib/feed/path.py
@@ -29,7 +29,7 @@
from __future__ import generators
-import sys, warnings, os, fnmatch, glob, shutil, codecs, hashlib
+import sys, warnings, os, fnmatch, glob, shutil, codecs, md5
__version__ = '2.2'
__all__ = ['path']
View
BIN build/sphinx-contrib/feed/dist/feed-0.2dev_20120122-py2.7.egg
Binary file not shown.
View
5 build/sphinx-contrib/feed/sphinxcontrib/feed/directives.py
@@ -45,6 +45,7 @@ class Latest(Directive):
final_argument_whitespace = False
option_spec = {
'maxdepth': int,
+ 'limit': int,
'glob': directives.flag,
'hidden': directives.flag,
'numbered': int_or_nothing,
@@ -55,6 +56,7 @@ def run(self):
env = self.state.document.settings.env
suffix = env.config.source_suffix
glob = 'glob' in self.options
+ limit = 'limit' in self.options
ret = []
# (title, ref) pairs, where ref may be a document, or an external link,
@@ -128,6 +130,9 @@ def run(self):
for date in ordered_keys:
subnode['entries'].append(sorted_entries[date])
+ if limit:
+ del subnode['entries'][self.options.get('limit'):len(subnode['entries'])]
+
# includefiles only entries that are documents
subnode['includefiles'] = includefiles
subnode['maxdepth'] = self.options.get('maxdepth', -1)
View
12 pages/source/index.rst
@@ -12,6 +12,18 @@ You can read more about the projects below or view a list of all projects.
* :doc:`Contribute <contribute>`
* :doc:`Community <community>`
+Latest Blog Posts
+=================
+
+.. latest::
+ :maxdepth: 3
+ :glob:
+ :limit: 5
+
+ blog/*
+
+:doc:`Read older blog posts <blog/index>`
+
.. doctrine-projects::
:file: projects.yml
:type: top

0 comments on commit 7f4e783

Please sign in to comment.
Something went wrong with that request. Please try again.