-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_workshop_tex.py
executable file
·48 lines (41 loc) · 1.63 KB
/
generate_workshop_tex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
import codecs
import os
import sys
import db
import formatting
import settings
if __name__ == "__main__":
[book_dir, workshop_path] = sys.argv[1:]
# get workshop info
workshop_abbrev = os.path.basename(book_dir)
title = settings.workshop_titles[workshop_abbrev]
location = settings.workshop_locations[workshop_abbrev]
# read db file
days = db.load(book_dir)
# write out tex
with open(workshop_path, 'w') as workshop_file:
write = workshop_file.write
for day in days:
day_short_name = settings.day_short_names[day.title]
# collect abstracts
abstract_items = []
for slot in day.slots:
for session in slot.sessions:
for paper in session.papers:
if abstract_items:
abstract_items.append(formatting.session_abstract_separator)
abstract_items.append(formatting.session_abstract_format(
day=day_short_name,
start=paper.start,
end=paper.end,
location=location,
title=paper.title,
authors=', '.join(paper.authors),
abstract=paper.abstract.strip().replace(r'\\', ' ').replace('\n', ' ')))
# write out session containing abstracts
write(formatting.session_abstracts_format(
title=title,
location=location,
chair='',
abstracts=''.join(abstract_items)))