Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70612 - in website/public_html/beta/build: . boost_site templates
From: dnljms_at_[hidden]
Date: 2011-03-27 06:07:51


Author: danieljames
Date: 2011-03-27 06:07:50 EDT (Sun, 27 Mar 2011)
New Revision: 70612
URL: http://svn.boost.org/trac/boost/changeset/70612

Log:
Website: Better method for choosing download items.

Not much better, since they're hardcoded into build.py, but at least
it's more flexible about what gets displayed.
Text files modified:
   website/public_html/beta/build/boost_site/pages.py | 6 +++---
   website/public_html/beta/build/build.py | 10 +++++++++-
   website/public_html/beta/build/templates/download-template.html | 2 +-
   website/public_html/beta/build/templates/index-src.html | 2 --
   4 files changed, 13 insertions(+), 7 deletions(-)

Modified: website/public_html/beta/build/boost_site/pages.py
==============================================================================
--- website/public_html/beta/build/boost_site/pages.py (original)
+++ website/public_html/beta/build/boost_site/pages.py 2011-03-27 06:07:50 EDT (Sun, 27 Mar 2011)
@@ -111,14 +111,14 @@
                     'build/templates/entry-template.html',
                     { 'page': page_data })
 
-
- def match_pages(self, patterns, count = None):
+ def match_pages(self, patterns, count = None, sort = True):
         filtered = set()
         for pattern in patterns:
             filtered = filtered | set(fnmatch.filter(self.pages.keys(), pattern))
 
         entries = [self.pages[x] for x in filtered if self.pages[x].page_state != 'new']
- entries = sorted(entries, key = lambda x: x.last_modified, reverse=True)
+ if sort:
+ entries = sorted(entries, key = lambda x: x.last_modified, reverse=True)
         if count:
             entries = entries[:count]
         return entries

Modified: website/public_html/beta/build/build.py
==============================================================================
--- website/public_html/beta/build/build.py (original)
+++ website/public_html/beta/build/build.py 2011-03-27 06:07:50 EDT (Sun, 27 Mar 2011)
@@ -30,6 +30,9 @@
 ################################################################################
 
 settings = {
+ 'downloads' : [
+ 'feed/history/boost_1_46_1.qbk'
+ ],
     'pages': {
         'users/history/': {
             'src_files' : ['feed/history/*.qbk'],
@@ -158,11 +161,16 @@
 
     # Generate 'Index' pages
 
+ index_page_variables = {
+ 'pages' : pages,
+ 'downloads' : pages.match_pages(settings['downloads'], sort = False)
+ }
+
     for index_page in settings['index-pages']:
         boost_site.templite.write_template(
             index_page,
             settings['index-pages'][index_page],
- { 'pages' : pages })
+ index_page_variables)
 
     # Generate RSS feeds
 

Modified: website/public_html/beta/build/templates/download-template.html
==============================================================================
--- website/public_html/beta/build/templates/download-template.html (original)
+++ website/public_html/beta/build/templates/download-template.html 2011-03-27 06:07:50 EDT (Sun, 27 Mar 2011)
@@ -1,6 +1,6 @@
 ${
 title = 'Boost Downloads'
-entries = pages.match_pages(['feed/history/boost_1_46_1.qbk'], 1)
+entries = downloads
 }$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 

Modified: website/public_html/beta/build/templates/index-src.html
==============================================================================
--- website/public_html/beta/build/templates/index-src.html (original)
+++ website/public_html/beta/build/templates/index-src.html 2011-03-27 06:07:50 EDT (Sun, 27 Mar 2011)
@@ -1,8 +1,6 @@
 ${
 # TODO: This is duplicated from other places, should only be set once?
 news = pages.match_pages(['feed/news/*.qbk', 'feed/history/*.qbk'], 3)
-
-downloads = pages.match_pages(['feed/history/boost_1_46_1.qbk'], 1)
 }$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk