Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,6 +86,21 @@ def create_bibtex_entry(data):
|
|
| 86 |
if year and 'year' not in data:
|
| 87 |
data['year'] = year
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
year = data['year']
|
| 90 |
author_words = data.get('author', '').split()
|
| 91 |
first_author = author_words[0] if author_words else 'unknown'
|
|
|
|
| 86 |
if year and 'year' not in data:
|
| 87 |
data['year'] = year
|
| 88 |
|
| 89 |
+
match_year = re.search(r'\b(\d{4})\b', data['year'])
|
| 90 |
+
|
| 91 |
+
if match_year:
|
| 92 |
+
data['year'] = match.group(1)
|
| 93 |
+
else:
|
| 94 |
+
data.pop('year', '')
|
| 95 |
+
|
| 96 |
+
#Pages conformity.
|
| 97 |
+
if 'pages' in data:
|
| 98 |
+
match = re.search(r'\b(\d+(-\d+)?)\b', data['pages'])
|
| 99 |
+
if match:
|
| 100 |
+
data['pages'] = match.group(1)
|
| 101 |
+
else:
|
| 102 |
+
data.pop('pages', '')
|
| 103 |
+
|
| 104 |
year = data['year']
|
| 105 |
author_words = data.get('author', '').split()
|
| 106 |
first_author = author_words[0] if author_words else 'unknown'
|