for files in /readme, get date, id and title
This commit is contained in:
parent
1e1bd9689b
commit
adbecb75a2
1 changed files with 6 additions and 1 deletions
|
@ -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('<h1>(.+)</h1>', read_file(file))
|
||||
return match.groups()[0] if match else 'Untitled'
|
||||
|
||||
def read_file(file):
|
||||
print 'reading', file
|
||||
f = open(file)
|
||||
|
|
Loading…
Reference in a new issue