Skip to content

Commit 12b1f98

Browse files
committed
deploy: 912b556
1 parent dc09074 commit 12b1f98

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

bin/issue_to_bibtex.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from bibtexparser.bwriter import BibTexWriter
1212

1313

14-
if __name__ == '__main__':
14+
try:
1515

1616
parser = argparse.ArgumentParser()
1717
parser.add_argument("-b", "--body", help="input issue body here", type=str, default="")
@@ -102,13 +102,24 @@
102102
if not req.status_code == 200:
103103
print(f'Request of {url} could not be processed, got status code {req.status_code}.')
104104
break
105-
106-
data = req.json()
107105

108-
if len(data['author']) > 1:
109-
id = data['author'][0]['family'] + 'EtAl' + str(data['issued']['date-parts'][0][0])
110-
else:
111-
id = data['author'][0]['family'] + str(data['issued']['date-parts'][0][0])
106+
with open("request.txt", "w") as f:
107+
f.write(req.text)
108+
try:
109+
data = req.json()
110+
except:
111+
# in case request did not provide the json data, retrieve it from the bib entry
112+
data = {
113+
e[0].strip(): e[1][1:].split("}")[0]
114+
for e in [e for e in [l.split(" = ") for l in bib.splitlines()] if len(e) == 2]
115+
}
116+
data["author"] = [
117+
{"family": a.split(", ")[0], "given": a.split(", ")[1]}
118+
for a in data["author"].split(" and ")
119+
]
120+
data["issued"] = {"date-parts": [[data["year"]]]}
121+
122+
id = data['author'][0]['family'] + 'EtAl'*(len(data['author']) > 1) + str(data['issued']['date-parts'][0][0])
112123
id = id.replace(" ", "_")
113124

114125
d = db.get_entry_dict()
@@ -162,3 +173,6 @@
162173
line = re.sub(r'%}+', '%', line)
163174
line = line.rstrip('\r\n')
164175
print(line)
176+
177+
except Exception as e:
178+
print(f"ERROR : {e}\n")

sitemap.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -354,34 +354,34 @@
354354
<loc>http://parallel-in-time.org/about/imprint.html</loc>
355355
</url>
356356
<url>
357-
<loc>http://parallel-in-time.org/codes/</loc>
357+
<loc>http://parallel-in-time.org/methods/</loc>
358358
</url>
359359
<url>
360-
<loc>http://parallel-in-time.org/events/upcoming/</loc>
360+
<loc>http://parallel-in-time.org/codes/</loc>
361361
</url>
362362
<url>
363-
<loc>http://parallel-in-time.org/events/past/</loc>
363+
<loc>http://parallel-in-time.org/projects/</loc>
364364
</url>
365365
<url>
366-
<loc>http://parallel-in-time.org/events/</loc>
366+
<loc>http://parallel-in-time.org/references/</loc>
367367
</url>
368368
<url>
369-
<loc>http://parallel-in-time.org/methods/</loc>
369+
<loc>http://parallel-in-time.org/events/past/</loc>
370370
</url>
371371
<url>
372-
<loc>http://parallel-in-time.org/references/</loc>
372+
<loc>http://parallel-in-time.org/events/upcoming/</loc>
373373
</url>
374374
<url>
375-
<loc>http://parallel-in-time.org/projects/</loc>
375+
<loc>http://parallel-in-time.org/events/</loc>
376376
</url>
377377
<url>
378378
<loc>http://parallel-in-time.org/groups/</loc>
379379
</url>
380380
<url>
381-
<loc>http://parallel-in-time.org/about/</loc>
381+
<loc>http://parallel-in-time.org/news/</loc>
382382
</url>
383383
<url>
384-
<loc>http://parallel-in-time.org/news/</loc>
384+
<loc>http://parallel-in-time.org/about/</loc>
385385
</url>
386386
<url>
387387
<loc>http://parallel-in-time.org/</loc>

0 commit comments

Comments
 (0)