forked from murata1224/Kirokusyo-Machine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecord.rb
248 lines (211 loc) · 7.27 KB
/
record.rb
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# -*- coding: utf-8 -*-
# 記録書クラス
class Record
def output_record(user_name, user_laboratory, user_grade, record_number, research_achievements, laboratory_achievements, university_achievements, job_achievements, research_plans, laboratory_plans, university_plans, job_plans, conference_info, start_date1, end_date1, start_date2)
@user_name = user_name
@user_laboratory = user_laboratory
@user_grade = user_grade
@record_number = record_number
@start_year = start_date1.slice(0..3)
@start_month = start_date1.slice(4..5)
@start_day = start_date1.slice(6..7)
@end_year = end_date1.slice(0..3)
@end_month = end_date1.slice(4..5)
@end_day = end_date1.slice(6..7)
@report_year = start_date2.slice(0..3)
@report_month = start_date2.slice(4..5)
@report_day = start_date2.slice(6..7)
output_header
output_coaching
output_achievements(research_achievements, laboratory_achievements, university_achievements, job_achievements)
output_descriptions
output_plans(research_plans, laboratory_plans, university_plans, job_plans)
output_conference_info(conference_info)
output_other
end
def output_header
end
def output_coaching
end
def output_achievements(research_achievements, laboratory_achievements, university_achievements, job_achievements)
end
def output_descriptions
end
def output_plans(research_achievements, laboratory_plans, university_plans, job_plans)
end
def output_conference_info(conference_info)
end
def output_other
end
end
# Org-mode形式の記録書クラス
class RecordOrg < Record
def output_header
header = ""
header << "#+TITLE: 記録書 No.#{@record_number.to_i + 1}\n"
header << "#+LATEX_HEADER: \\subtitle{(#{@start_year}年#{@start_month}月#{@start_day}日$\\sim$#{@end_year}年#{@end_month}月#{@end_day}日)}\n"
header << "#+AUTHOR: #{@user_laboratory}#{@user_grade}\\\\#{@user_name}\n"
header << "#+DATE: #{@report_year}年#{@report_month}月#{@report_day}日\n"
header << "#+SETUPFILE: options/default.org\n"
print header
end
def output_coaching
coaching = ""
coaching << "* 前回ミーティングからの指導・指摘事項\n"
coaching << " 1. xxx\n"
coaching << " #+latex: \\newline\n"
coaching << " #+latex: \\hfill\n"
coaching << " [日にち, 場所,指導・指摘をくださった方]\n\n"
print coaching
end
# 実績
def output_achievements(research_achievements, laboratory_achievements, university_achievements, job_achievements)
print "* 実績\n"
output_achievements_research(research_achievements)
output_achievements_laboratory(laboratory_achievements)
output_achievements_university(university_achievements)
output_achievements_job(job_achievements)
end
# 研究関連
def output_achievements_research(research_achievements)
print "** 研究関連\n"
print_achievements_copied(research_achievements)
end
# 研究室関連
def output_achievements_laboratory(schedules)
print "** 研究室関連\n"
print_schedules(schedules, "laboratory")
end
# 大学・大学院関連
def output_achievements_university(schedules)
print "** 大学・大学院関連\n"
print_schedules(schedules, "university")
end
# 就職活動関連
def output_achievements_job(schedules)
print "** 就職活動関連\n"
print_schedules(schedules, "job")
end
# 詳細および反省・感想
def output_descriptions
print "* 詳細および反省・感想\n"
output_descriptions_research
output_descriptions_laboratory
output_descriptions_university
output_descriptions_job
end
def output_descriptions_research
print "** 研究関連\n"
print_descriptions
end
# 研究室関連
def output_descriptions_laboratory
print "** 研究室関連\n"
print_descriptions
end
# 大学・大学院関連
def output_descriptions_university
print "** 大学・大学院関連\n"
print_descriptions
end
# 就職活動関連
def output_descriptions_job
print "** 就職活動関連\n"
print_descriptions
end
# 今後の予定
def output_plans(research_plans, laboratory_plans, university_plans, job_plans)
print "* 今後の予定\n"
output_plans_research(research_plans)
output_plans_laboratory(laboratory_plans)
output_plans_university(university_plans)
output_plans_job(job_plans)
end
# 研究関連
def output_plans_research(research_plans)
# 前回の記録書からコピーした部分
print "** 研究関連\n"
print_plans_copied(research_plans)
end
# 研究室関連
def output_plans_laboratory(schedules)
print "** 研究室関連\n"
print_schedules(schedules)
end
# 大学・大学院関連
def output_plans_university(schedules)
print "** 大学・大学院関連\n"
print_schedules(schedules)
end
# 就職活動関連
def output_plans_job(schedules)
print "** 就職活動関連\n"
print_schedules(schedules)
end
# 学会情報
def output_conference_info(conference_info)
print "* 学会情報\n"
print_conference_info(conference_info)
end
# その他
def output_other
print "* その他\n"
print "その他書きたいことを書く."
end
#################################
private
def print_schedules(schedules, type=nil)
number = 1
schedules.each do |s|
if s["date_start"] == s["date_end"]
print " " + "#{number}. " + s["summary"] + "\n"
print " " + "#+latex: \\hfill" + "\n"
print " " + "#+latex: \\label\{enum-#{type}#{number}\}" + "\n"
print " " + "(" + s["date_start"] + ")\n"
number += 1
end
end
end
def print_conference_info(conference_info)
conference_info.each do |info|
print info
end
end
def print_descriptions
descriptions = ""
descriptions << " " + "#+begin_latex\n"
descriptions << " " + "\\begin{itemize}\n"
descriptions << " " + "\\item[(\\ref{enum-research1})]\n"
descriptions << " " + "\\verb|\\item[]| の中に実績の章で貼ったラベルを参照する.\n"
descriptions << " " + "こうすることで,実績の箇条書きを並べ替えても,詳細および反省・感想のほうに自動で反映される\n"
descriptions << " " + "ここの記述は\\verb|#+begin_latex| ,\\verb|#+end_latex| で囲み,\\LaTeX の記法で記述している.\n"
descriptions << " " + "\\end{itemize}\n"
descriptions << " " + "#+end_latex\n"
print descriptions
end
def print_achievements_copied(achievements)
# とりあえずそのまま出力
achievements.each do |achievement|
print achievement
end
# print_each_line_of_array(achievements,0) # 2は*の数
end
def print_plans_copied(plans)
# 1とりあえずそのまま出力
plans.each do |plan|
print plan
end
# print_each_line_of_array(plans,0) # 2は*の数
end
def print_each_line_of_array(ary,depth)
return nil unless ary.instance_of?(Array)
ary.each do |a|
if a.instance_of?(Array)
print_each_line_of_array(a,depth+1)
else
depth.times { print "*" }
print " " + a + "\n"
end
end
end
end