From adbecb75a297e0a72c6639a00ce1de80507fafb3 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 7 Apr 2012 16:42:20 +0200 Subject: [PATCH] for files in /readme, get date, id and title --- tools/build/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/build/build.py b/tools/build/build.py index 0cc8531b..0dc7b061 100755 --- a/tools/build/build.py +++ b/tools/build/build.py @@ -161,7 +161,8 @@ def build_oxjs(downloads=False, geo=False): '%Y-%m-%d %H:%M:%S', time.gmtime(os.path.getmtime(root_path + 'readme/html/' + x)) ), - 'name': x.split('.')[0] + 'id': x.split('.')[0], + 'title': get_title(root_path + 'readme/html/' + x) }, filter( lambda x: not re.search('^[\._]', x), @@ -207,6 +208,10 @@ def filter_source(tarinfo): return None return tarinfo +def get_title(file): + match = re.search('

(.+)

', read_file(file)) + return match.groups()[0] if match else 'Untitled' + def read_file(file): print 'reading', file f = open(file)