-
Notifications
You must be signed in to change notification settings - Fork 2
/
compilereadme.py
31 lines (26 loc) · 956 Bytes
/
compilereadme.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
""" This script simply compiles the main metadata file (data-registry.csv)
into a readable Markdown Table
"""
import csv
import tabulate
header = ["Shelfmark", "Folder", "Biblissima", "Pages", "Type", "Century", "Color", "Script", "Content"]
table = [
header
]
with open("data-registry.csv") as f:
for line in csv.DictReader(f):
print(line)
table.append(
[
f"[{line['Shelfmark ID']}]({line['Link']})",
f"[🔗]({line['Folder']})",
f"[→]({line['Biblissima']})" if line["Biblissima"] else "",
line["Pages"],
line["Type"],
str((int(line["notBefore"]) + int(line["notAfter"])) // 200 + 1 ),
"✓" if line["Status"] == "Color" else "✗",
line["Script"],
line["Content"]
]
)
print(tabulate.tabulate(table, tablefmt="github", headers="firstrow"))