-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathfile_generator.py
126 lines (109 loc) · 3.49 KB
/
file_generator.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
from string import Template
import os
total_week_count = 22
eval_next_to_week_list = [6, 12, 22]
gsoc_year = "2022"
project_name = "Design Challenge 1"
project_tag = "designChallenge1"
author_name = "Utkarsh Tiwari"
base_dir = "./posts/"
os.mkdir(base_dir)
def create_week_file(field_values):
week_file_name = "{count:02d}_week{week_count}.md"
week_header_temaplate = """---
layout: page
title: Week $week_count
author: '$author_name'
tags: ["week","gsoc","gsoc$gsoc_year","$project_tag","week#$week_count","eval#$eval_count"]
---
## Week Summary
Week Work summary goes here
## Daily Work Update
|\#|Day|Date|A short description of the work done|
|--- |--- |--- |--- |
|1 | Monday | 2022/01/01 | |
|2 | Tuesday | 2022/01/01 | |
|3 | Wednesday | 2022/01/01 | |
|4 | Thursday | 2022/01/01 | |
|5 | Friday | 2022/01/01 | |
|6 | Saturday | 2022/01/01 | |
|7 | Sunday | 2022/01/01 | |
"""
file_content = Template(week_header_temaplate).substitute(field_values)
file_name = week_file_name.format_map(field_values)
with open(os.path.join(base_dir,file_name),"w") as f:
f.write(file_content)
# print(file_name)
# print(file_content)
def create_eval_file(field_values):
eval_file_name = "{count:02d}_eval{eval_count}.md"
eval_header_temaplate = """---
layout: page
title: Eval $eval_count
author: "$author_name"
tags: ["eval","gsoc","gsoc$gsoc_year","$project_tag","eval#$eval_count"]
---
## Summary
Evaluation Summary goes here
## Objectives and Deliverables
| \# | Objectives | Associated Deliverables |
| --- | ----------------------------- | ---------------------------------------------- |
| 1 | helo world | hello world |
| 2 | helo world | hello world |
| 3 | helo world | hello world |
| 4 | helo world | hello world |
## Learning and Success
Learning and Success goes here.
## Difficulties
Difficulty goes here.
## Plan update
Plan Update goes here.
"""
file_content = Template(eval_header_temaplate).substitute(field_values)
file_name = eval_file_name.format_map(field_values)
with open(os.path.join(base_dir,file_name),"w") as f:
f.write(file_content)
# print(file_name)
# print(file_content)
eval_index = 0
count = 0
for index in range(total_week_count+1):
if(eval_index < len(eval_next_to_week_list) and index > eval_next_to_week_list[eval_index]):
field_values = {
"project_name": project_name,
"author_name": author_name,
"gsoc_year": gsoc_year,
"project_tag": project_tag,
"week_count": week_count,
"eval_count": eval_count,
"count": count
}
create_eval_file(field_values)
count += 1
eval_index += 1
week_count = index
eval_count = eval_index+1
field_values = {
"project_name": project_name,
"author_name": author_name,
"gsoc_year": gsoc_year,
"project_tag": project_tag,
"week_count": week_count,
"eval_count": eval_count,
"count": count
}
create_week_file(field_values)
count += 1
if(eval_index < len(eval_next_to_week_list)):
field_values = {
"project_name": project_name,
"author_name": author_name,
"gsoc_year": gsoc_year,
"project_tag": project_tag,
"week_count": week_count,
"eval_count": eval_count,
"count": count
}
create_eval_file(field_values)
count += 1
eval_index += 1