Commits

dan mackinlay  committed 05d3a43

non-subclassing version of the Latest directive

  • Participants
  • Parent commits 76b3890

Comments (0)

Files changed (3)

File feed/TODO.txt

   - support microformats for date display
   - rather than ignoring undated articles, include them at the bottom of the list.
   - make sure articles with no date come at the bottom of the list.
-  - flatten everything in the list down to one
+  - support dates on links and subheadings
+  - flatten everything in the list down to one level
   - fix bug with recursive display - atm if you explicitly include subdirs, it will explode when writing HTML in environment.collect_relations 
   - better markup for dates - need a class to attach etc
   
-- write rss at the `html-collect-pages` event
+- write rss at the new `html-collect-pages` event

File feed/sphinxcontrib/feed/feeddirectives.py

 import os
 
 from docutils import nodes
+from docutils.parsers.rst import Directive, directives
 
-from docutils.parsers.rst import Directive, directives
+from sphinx.util.nodes import explicit_title_re, set_source_info
+from sphinx.util import url_re, docname_join
+from sphinx.util.matching import patfilter
 
 from feednodes import latest
 
         env = self.state.document.settings.env
         suffix = env.config.source_suffix
         glob = 'glob' in self.options
-        
-        tocatts = tocnode.non_default_attributes()
-        latestnode = latest()
-        for key, val in tocatts.iteritems():
-            latestnode[key] = val
-
-        ret = []
-        # (title, ref) pairs, where ref may be a document, or an external link,
+                
+        # (title, ref) pairs, where ref may only be a document
+        # external links are forbidden, since we have no way of dating them
         # and title may be None if the document's title is to be used
         entries = []
         includefiles = []
+        
         all_docnames = env.found_docs.copy()
         # don't add the currently visited file in catch-all patterns
         all_docnames.remove(env.docname)
                     includefiles.append(docname)
             else:
                 patname = docname_join(env.docname, entry)
-                docnames = sorted(patfilter(all_docnames, patname))
+                docnames = patfilter(all_docnames, patname)
                 for docname in docnames:
                     all_docnames.remove(docname) # don't include it again
                     entries.append((None, docname))
                     includefiles.append(docname)
                 if not docnames:
                     ret.append(self.state.document.reporter.warning(
-                        'toctree glob pattern %r didn\'t match any documents'
+                        'latest list glob pattern %r didn\'t match any documents'
                         % entry, line=self.lineno))
-        subnode = addnodes.toctree()
+        
+        subnode = latest()
         subnode['parent'] = env.docname
         # entries contains all entries (self references, external links etc.)
         subnode['entries'] = entries
         subnode['includefiles'] = includefiles
         subnode['maxdepth'] = self.options.get('maxdepth', -1)
         subnode['glob'] = glob
-        subnode['hidden'] = 'hidden' in self.options
-        subnode['numbered'] = self.options.get('numbered', 0)
         subnode['titlesonly'] = 'titlesonly' in self.options
+        #what does this do?
         set_source_info(self, subnode)
         wrappernode = nodes.compound(classes=['latest-wrapper'])
-        wrappernode.append(latestnode)
-        ret.append(wrappernode)
-        return ret
+        wrappernode.append(subnode)
+        return [wrappernode]

File feed/tests/root/index.rst

     *
 
 .. latest::
-    :maxdepth: 2
     :glob:
 
     *