Commits

dan mackinlay committed 2a41b0c

Much nicer date markup for feed's latest directive

Comments (0)

Files changed (4)

   - optionally, rather than ignoring undated articles, include them at the bottom of the list.
   - (Blue sky) support dates on links and subheadings rather than just whole
     documents (requires work with sphinx/docutils)
+  - create tests of round-trip date parsing (Are the displayed dates the same
+    as the supplied ones?
   - fix bug with recursive display - ATM if you explicitly include subdirs, it
     will explode when writing HTML in environment.collect_relations
   

feed/sphinxcontrib/feed/__init__.py

           if doc in feed_pub_dates]
         decorated_entries.sort(reverse=True)
         
-        latest_list = nodes.bullet_list('')
+        latest_list = nodes.bullet_list('',
+          classes=['feed-latest-articles'])
         
         for date, title, docname in decorated_entries:
             para = nodes.paragraph()
-            list_item = nodes.list_item('', para)
+            list_item = nodes.list_item('', para,
+              classes=['feed-dated-article'])
             
             if title is None:
                 title = env.titles.get(docname)
             para += newnode
             para += nodes.Text(' ', ' ')
             stringdate = date.strftime('%Y/%m/%d')
-            para += nodes.Text(stringdate, stringdate)
+            date_wrapper = nodes.container(classes=['feed-article-date'])
+            date_wrapper += nodes.Text(stringdate, stringdate)
+            para += date_wrapper
 
             # Insert into the latestlist
             latest_list.append(list_item)

feed/sphinxcontrib/feed/feeddirectives.py

         subnode['titlesonly'] = 'titlesonly' in self.options
         #what does this do?
         set_source_info(self, subnode)
-        wrappernode = nodes.compound(classes=['latest-wrapper'])
+        wrappernode = nodes.compound(classes=['feed-latest-wrapper'])
         wrappernode.append(subnode)
         ret.append(wrappernode)
         return ret

feed/tests/test_feed.py

     
         index_path  = os.path.join(app.outdir, 'index.html')
         soup = BeautifulSoup(open(index_path).read())
-        latest_tree = soup.find('div', 'latest-wrapper')
-        latest_items = latest_tree.findAll('li')
+        latest_tree = soup.find('div', 'feed-latest-wrapper')
+        latest_items = latest_tree.findAll('li', 'feed-dated-article')
         actual_links = [entry.contents[0]['href'] for entry in latest_items]
         ideal_links = [
             u'B_latest.html',