Skip to content

Commit e831ca0

Browse files
Merge pull request #20 from seasidesparrow/fix_t_pages.20231207
Fix t pages.20231207
2 parents 5ac9964 + 6c729b3 commit e831ca0

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

adsenrich/bibcodes.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ def _int_to_letter(self, integer):
4141

4242
def _get_author_init(self, record):
4343
author_init = "."
44+
special_char = {'Ð': 'E',
45+
'ð': 'e',
46+
'Þ': 'TH',
47+
'þ': 'th'}
4448
try:
4549
author_init = record.get("authors", [])[0]["name"]["surname"]
4650
first_auth = record.get("authors", [])[0]
4751
if first_auth:
48-
author_init = first_auth.get("name", {}).get("surname", None)
49-
author_init = author_init.strip()[0]
50-
author_init = u2asc(author_init).upper()
52+
author_last = first_auth.get("name", {}).get("surname", None)
53+
author_last = author_last.strip()
54+
author_last = u2asc(author_last)
55+
for k, v in special_char.items():
56+
author_last = author_last.replace(k, v)
57+
author_init = author_last[0].upper()
5158
except:
5259
pass
5360
return author_init
@@ -116,6 +123,9 @@ def _deletter_page(self, page):
116123
elif "E" in page:
117124
page = page.replace("E", "")
118125
is_letter = "E"
126+
elif "T" in page or "t" in page:
127+
page = page.replace("T", "").replace("t", ".")
128+
is_letter = "T"
119129
return (page, is_letter)
120130

121131
def _get_normal_pagenum(self, record):

adsenrich/data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"ECSSP",
133133
"ECSAd",
134134
"ECSIn",
135+
"MatFu",
135136
]
136137

137138
OUP_BIBSTEMS = ["MNRAS", "PASJ.", "PTEP.", "GeoJI"]

adsenrich/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def u2asc(input):
1919
"""
2020

2121
# TODO If used on anything but author names, add special handling for math symbols and other special chars
22+
output = None
2223
if sys.version_info < (3,):
2324
test_type = unicode
2425
else:

0 commit comments

Comments
 (0)