-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateCV.py
More file actions
83 lines (70 loc) · 2.57 KB
/
createCV.py
File metadata and controls
83 lines (70 loc) · 2.57 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import json
import os
from configureCV import add_cv_configs
import subprocess
# ----------- Configuring the CV layout -----------
add_cv_configs()
# ----------- Order of sections in CV -----------
cv_sections = ['overview', 'education', 'skills',
'experience', 'awards', 'extracurricular']
# ----------- Create CV Header -----------
with open("sections/personalinfo.json", 'r') as file:
personal_info = json.load(file)
personal_info_section = ""
for tag, value in personal_info.items():
if(value == ""):
pass
elif(tag == "name"):
personal_info_section += r"\name{%s}{%s}" % (
value.split(" ")[0], value.split(" ")[1])
else:
personal_info_section += r"\%s{%s}" % (tag, value)
header_content = r'''
%s
\begin{document}
\makecvheader[C]
\makecvfooter
{\today}
{%s}
{\thepage}
''' % (personal_info_section, personal_info.get("name"))
with open('cv.tex', 'a') as f:
f.write(header_content)
# ----------- Create CV Body -----------
for section_file in cv_sections:
with open(os.path.join("sections", section_file+".json"), 'r') as file:
section_data = json.load(file)
if(section_data.get('records') is None):
section_records = section_data.get('description')
else:
section_records = r''''''
for record in section_data.get('records'):
record_content = r'''
\%s
''' % (section_data.get('tagname'))
for record_data in record:
item_list = ""
if(isinstance(record.get(record_data), list)):
item_list = r'''
{
\begin{cvitems}
'''
for item in record.get(record_data):
item_list += ' \item{%s}' % (item)
item_list += r'''
\end{cvitems}
}'''
else:
record_content = record_content + \
'''{%s}''' % (record.get(record_data))
section_records += record_content+item_list
section_content = r'''
\cvsection{%s}
\begin{%s}
%s
\end{%s}
''' % (section_data.get('title'), section_data.get('sectionname'), section_records, section_data.get('sectionname'))
with open('cv.tex', 'a') as f:
f.write(section_content)
with open('cv.tex', 'a') as f:
f.write(r"\end{document}")