Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -116,21 +116,21 @@ def extract_year(text):
|
|
116 |
|
117 |
def create_bibtex_entry(data):
|
118 |
# Determine the entry type
|
119 |
-
if '
|
120 |
entry_type = 'article'
|
121 |
-
elif '
|
122 |
-
entry_type = '
|
123 |
else:
|
124 |
entry_type = 'book'
|
125 |
|
126 |
# Extract year from 'None' if it exists
|
127 |
-
none_content = data.pop('
|
128 |
year = extract_year(none_content)
|
129 |
-
if year and '
|
130 |
-
data['
|
131 |
|
132 |
# Create BibTeX ID
|
133 |
-
author_words = data.get('
|
134 |
first_author = author_words[0] if author_words else 'Unknown'
|
135 |
bibtex_id = f"{first_author}{year}" if year else first_author
|
136 |
|
|
|
116 |
|
117 |
def create_bibtex_entry(data):
|
118 |
# Determine the entry type
|
119 |
+
if 'journal' in data:
|
120 |
entry_type = 'article'
|
121 |
+
elif 'booktitle' in data:
|
122 |
+
entry_type = 'chapter'
|
123 |
else:
|
124 |
entry_type = 'book'
|
125 |
|
126 |
# Extract year from 'None' if it exists
|
127 |
+
none_content = data.pop('none', '')
|
128 |
year = extract_year(none_content)
|
129 |
+
if year and 'year' not in data:
|
130 |
+
data['year'] = year
|
131 |
|
132 |
# Create BibTeX ID
|
133 |
+
author_words = data.get('author', '').split()
|
134 |
first_author = author_words[0] if author_words else 'Unknown'
|
135 |
bibtex_id = f"{first_author}{year}" if year else first_author
|
136 |
|