match year at end of title
This commit is contained in:
parent
c001e6fed7
commit
305699f7ad
1 changed files with 3 additions and 3 deletions
|
@ -33,9 +33,9 @@ for d in api.findDocuments({
|
|||
if title != document['title']:
|
||||
edit['title'] = title
|
||||
|
||||
year = re.compile(' \d{4} ').findall(document['title'])
|
||||
if year and year[0] in ('1', '2') and not document.get('date'):
|
||||
document['date'] = edit['date'] = year[0]
|
||||
year = re.compile(' (\d{4})( |$)').findall(document['title'])
|
||||
if year and year[0][0][0] in ('1', '2') and not document.get('date'):
|
||||
document['date'] = edit['date'] = year[0][0]
|
||||
|
||||
if document.get('date') and document['date'] in title:
|
||||
title = title.replace(document['date'], '').strip()
|
||||
|
|
Loading…
Reference in a new issue