resme 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75fc73b4333ce4f6b51a02625a846fa6a7bdb16b0c53e0dc97bbcd0a1011f681
4
- data.tar.gz: 38b29db1c99a03d07d29036985291f5181e4f0e92225824bf131b5e006faaa92
3
+ metadata.gz: 904cd4f48eff3a4395a4fb5d4bb4a44bf5d9145d61a6aa587e978049274e8d2e
4
+ data.tar.gz: 71696c15cb8b1dca48ce55a1148e7e4c0415fa4ef39127026722ea7e8c80cd37
5
5
  SHA512:
6
- metadata.gz: 83f7f01cdd3c00932b7cdcb6cbe4e169c8f3a5129c06163582dfe6ecbfdd541b951c6812fa87836b26f30ecd4c8789dcea12f6fa8b212b7ef486b9b95cc1906e
7
- data.tar.gz: d148e71395e5abf9b3ab39d4770cbed5da1f66a17ec35c061b194ceabce7f94021d8ac37af678394a4c0bad94329147f761d89b1a52409b96a5a77a0ee0c0450
6
+ metadata.gz: c8dbf46762365ad1d05e6df5045a66dd8b5cffcf9c05e7f0e5344f24a55900ba43fdf6600b60d1626f901ef81ba36b2dbd0801d2585cd5737547cac70ede871c
7
+ data.tar.gz: da737977a8d8c4aab71f1b7cd7d0c19c32d4ac5c8727453ad9856b0517fe5822cd2c5737437e89a708c48f65acc48fe8c6e82282a66d285ab94547052c309605
data/CHANGELOG.org CHANGED
@@ -1,6 +1,15 @@
1
1
  #+TITLE: CHANGELOG
2
2
  #+AUTHOR: Adolfo Villafiorita
3
3
 
4
+ * Version 2.1.1
5
+
6
+ - Remove logos in CSS
7
+
8
+ * Version 2.1.0
9
+
10
+ - Output to HTML
11
+ - Small fixes to documentation
12
+
4
13
  * Version 2.0.1 and 2.0.0
5
14
 
6
15
  - Fully rewritten code (and rubocopped for most part)
data/README.org CHANGED
@@ -3,8 +3,10 @@
3
3
  #+DATE: <2020-07-14 Tue>
4
4
  #+STARTUP: showall
5
5
 
6
- Keep your resume in YAML and output it Org Mode and JSON Resume formats.
7
- Org Mode is flexible enough to export to various other formats.
6
+ Keep your resume in YAML and output it Org Mode, HTML, and JSON Resume. Org
7
+ Mode is flexible enough to export to various other formats.
8
+
9
+ HTML comes with some Europass-inspired CSS, generated by Gemini.
8
10
 
9
11
  The rendering engine is based on ERB. This simplifies the creation of
10
12
  new output formats (and extending/modifying the YML structure to one's
@@ -66,15 +68,16 @@ resme --help
66
68
 
67
69
  #+RESULTS:
68
70
  #+begin_example
69
- resme [options] - Format and manage a resume in YAML
70
- --format FORMAT Output format
71
+ resme [options] # Keep resume in YML, output Org Mode, HTML, and JSON
72
+ --format FORMAT Output format (json, org)
73
+ --theme THEME Choose a css theme
71
74
  --init Init a new resume
72
- --validate FILENAME Validate the resume
75
+ --validate FILENAME Validate the resume in FILENAME
73
76
  --build FILENAME Build the resume in FILENAME
74
77
  --sections FILENAME List sections in FILENAME
75
78
  --list List available templates
76
- --except x,y,z Excluded section
77
- --cat TEMPLATE View a template
79
+ --except x,y,z Exclude section x,y,z
80
+ --cat TEMPLATE View the YAML of a resume
78
81
  --version
79
82
  -h, --help Print this help
80
83
  #+end_example
data/lib/resme/cli.rb CHANGED
@@ -13,7 +13,7 @@ module Resme
13
13
  end
14
14
 
15
15
  def parse
16
- @options = {}
16
+ @options = default_values
17
17
  parser.parse!(@arguments)
18
18
  end
19
19
 
@@ -23,20 +23,33 @@ module Resme
23
23
 
24
24
  private
25
25
 
26
+ def default_values
27
+ { theme: "default" }
28
+ end
29
+
26
30
  # rubocop:disable Metrics
27
31
  def parser
28
32
  OptionParser.new do |parser|
29
- parser.banner = "resme [options] - Format and manage a resume in YAML"
33
+ parser.banner = "resme [options] " \
34
+ "# Keep resume in YML, output Org Mode, HTML, and JSON"
30
35
 
31
- parser.on("--format FORMAT", String, "Output format") do |v|
36
+ parser.on("--format FORMAT", String, "Output format (json, org)") do |v|
32
37
  @options[:format] = v
33
38
  end
34
39
 
40
+ parser.on("--theme THEME", String, "Choose a CSS theme") do |v|
41
+ @options[:theme] = v
42
+ end
43
+
44
+ parser.on("--themes", String, "List all available CSS theme") do |_|
45
+ @options[:cmd] = :themes
46
+ end
47
+
35
48
  parser.on("--init", "Init a new resume") do |_|
36
49
  @options[:cmd] = :init
37
50
  end
38
51
 
39
- parser.on("--validate FILENAME", "Validate the resume") do |v|
52
+ parser.on("--validate FILENAME", "Validate the resume in FILENAME") do |v|
40
53
  @options[:cmd] = :validate
41
54
  @options[:filename] = v
42
55
  end
@@ -55,11 +68,11 @@ module Resme
55
68
  @options[:cmd] = :list
56
69
  end
57
70
 
58
- parser.on("--except x,y,z", Array, "Excluded section") do |v|
71
+ parser.on("--except x,y,z", Array, "Exclude section x,y,z") do |v|
59
72
  @options[:except] = v.map(&:to_sym)
60
73
  end
61
74
 
62
- parser.on("--cat TEMPLATE", "View a template") do |v|
75
+ parser.on("--cat TEMPLATE", "View the YAML of a resume") do |v|
63
76
  @options[:cmd] = :cat
64
77
  @options[:template] = v
65
78
  end
@@ -222,6 +222,7 @@ module Resme
222
222
  ],
223
223
  languages: [:optional,
224
224
  {
225
+ assessment: OPTIONAL_STRING,
225
226
  mother_tongues: [[{
226
227
  code: OPTIONAL_STRING,
227
228
  language: String,
@@ -3,7 +3,7 @@
3
3
  module Resme
4
4
  #
5
5
  # Execute!
6
- #
6
+ #
7
7
  class Executor
8
8
  # include all formatter helpers
9
9
  include Resme::Helper
@@ -44,23 +44,41 @@ module Resme
44
44
  template = File.read(template_name)
45
45
 
46
46
  # add the json format, if specified
47
- if format.to_s == "json"
47
+ if format.to_s.downcase == "json"
48
48
  js = JsonResume.new Document.new(filename)
49
49
  @json_resume = js.build
50
50
  end
51
51
 
52
- output = ERB.new(template, trim_mode: "-").result(binding)
52
+ # copy the theme and set it in data for the tempalte, if output is html
53
+ if format.to_s.downcase == "html"
54
+ css_filename = theme_css_file @options.options[:theme]
55
+ css_template = File.join __dir__, "../../templates/#{css_filename}"
56
+ FileUtils.cp css_template, css_filename
57
+
58
+ @data[:theme] = css_filename
59
+ end
53
60
 
61
+ output = ERB.new(template, trim_mode: "-").result(binding)
54
62
  # it is difficult to write readable ERBs with no empty lines... we use
55
63
  # gsub to replace multiple empty lines with \n\n in the final output
56
64
  output.gsub!(/([\t ]*\n){3,}/, "\n\n")
57
- backup_and_write(output_filename(format), output)
65
+
66
+ output_filename = output_filename(format)
67
+ backup_and_write(output_filename, output)
68
+ puts "Resume generated and saved to #{output_filename}"
58
69
 
59
70
  when :list
60
71
  templates = File.join __dir__, "../../templates/*.erb"
61
72
  files = Dir.glob(templates).map { |x| "#{File.basename(x)} => #{x}" }
62
73
  puts files.join("\n")
63
74
 
75
+ when :themes
76
+ templates = File.join __dir__, "../../templates/*.css"
77
+ files = Dir.glob(templates).map do |x|
78
+ File.basename(x).gsub("resume-", "").gsub(".css", "")
79
+ end
80
+ puts files.join("\n")
81
+
64
82
  when :cat
65
83
  template = @options.options[:template]
66
84
  template_path = File.join __dir__, "../../templates/#{template}"
@@ -78,12 +96,16 @@ module Resme
78
96
 
79
97
  private
80
98
 
99
+ def theme_css_file(theme_name)
100
+ "resume-#{theme_name}.css"
101
+ end
102
+
81
103
  def output_filename(format)
82
104
  "resume-#{Date.today.iso8601}.#{format}"
83
105
  end
84
106
 
85
107
  def backup(filename)
86
- FileUtils.cp "filename, "#{filename}~"
108
+ FileUtils.cp filename, "#{filename}~"
87
109
  puts "Backup copy #{filename} created in #{filename}~."
88
110
  end
89
111
 
data/lib/resme/helper.rb CHANGED
@@ -14,7 +14,7 @@ module Resme
14
14
  [
15
15
  data.dig(:basics, :first_name),
16
16
  data.dig(:basics, :middle_name),
17
- data.dig(:basics, :last_name),
17
+ data.dig(:basics, :last_name)
18
18
  ].compact.join(" ")
19
19
  end
20
20
 
@@ -150,6 +150,11 @@ module Resme
150
150
  contact ? contact[:value] : nil
151
151
  end
152
152
 
153
+ # break text into paragraphs and wrap in <p>
154
+ def html_summary(text)
155
+ text.split("\n\n").map { |x| "<p>#{x}</p>" }.join
156
+ end
157
+
153
158
  #
154
159
  # Utility functions for managing dates in the form 2015-01-01 and partial
155
160
  # dates (e.g., 2015-05, 2015)
@@ -12,7 +12,7 @@ module Resme
12
12
  @data = document.data
13
13
  end
14
14
 
15
- # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize
15
+ # rubocop:disable Metrics
16
16
  def build
17
17
  address = @data[:addresses]&.first || {}
18
18
  education = @data[:education].select { |x| x[:publish] } || []
@@ -145,8 +145,7 @@ module Resme
145
145
  end
146
146
  }.compact
147
147
  end
148
- # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize
149
-
148
+ # rubocop:enable Metrics
150
149
 
151
150
  private
152
151
 
data/lib/resme/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Resme
4
- VERSION = "2.0.1"
4
+ VERSION = "2.1.1"
5
5
  end
@@ -0,0 +1,337 @@
1
+ <html>
2
+ <head>
3
+ <title><%= full_name @data %> Resume</title>
4
+
5
+ <meta name="author" content="<%= full_name @data %>">
6
+ <meta name="created" content="<%= Date.today %>">
7
+ <meta name="generator" content="resme">
8
+
9
+ <link rel="stylesheet" href="./<%= @data[:theme] %>">
10
+ </head>
11
+
12
+ <body>
13
+ <div class="container">
14
+ <div class="contact-information">
15
+ <!-- this is also replicated in the main section, to simplify styling -->
16
+ <!-- you might want to set display:none for one or the other -->
17
+ <div class="fullname-title">
18
+ <%= full_name @data %>, <%= @data[:basics][:title] %>
19
+ </div>
20
+
21
+ <% if @data[:addresses] %>
22
+ <div class="addresses section">
23
+ <h2>Addresses</h2>
24
+
25
+ <% (@data[:addresses] || []).each do |x| %>
26
+ <div class="address item">
27
+ <span class="label"><%= x[:label] %></span>
28
+ <span class="value">
29
+ <span class="street"><%= x[:street] %></span>
30
+ <span class="postal-code"><%= x[:postal_code] %></span>
31
+ <span class="city"><%= x[:city] %></span>
32
+ </span>
33
+ </div>
34
+ <% end %>
35
+ </div>
36
+ <% end %>
37
+
38
+ <% if @data[:contacts] %>
39
+ <div class="contacts section">
40
+ <h2>Contacts</h2>
41
+
42
+ <% (@data[:contacts] || []).each do |x| %>
43
+ <div class="contact item">
44
+ <span class="label"><%= x[:label] %></span>
45
+ <span class="value"><%= x[:value] %></span>
46
+ </div>
47
+ <% end %>
48
+ </div>
49
+ <% end %>
50
+
51
+ <% if @data[:web_presence] %>
52
+ <div class="web-presence section">
53
+ <h2>Web</h2>
54
+
55
+ <% (@data[:web_presence] || []).each do |x| %>
56
+ <div class="web-presence-item item">
57
+ <span class="label"><%= x[:label] %></span>
58
+ <span class="value"><%= x[:value] %></span>
59
+ </div>
60
+ <% end %>
61
+ </div>
62
+ <% end %>
63
+ </div>
64
+
65
+ <div class="main">
66
+ <div class="fullname-title">
67
+ <%= full_name @data %>, <%= @data[:basics][:title] %>
68
+ </div>
69
+
70
+ <% if @data[:summary] %>
71
+ <div class="summary section">
72
+ <h2>Summary</h2>
73
+
74
+ <%= html_summary @data[:summary] %>
75
+ </div>
76
+ <% end %>
77
+
78
+ <% if @data[:skills] %>
79
+ <div class="skills section">
80
+ <h2>Skills</h2>
81
+
82
+ <% (@data[:skills] || []).each do |item| %>
83
+ <div class="skill item">
84
+ <span class="label"><%= item[:name] %></span>
85
+ <span class="value"><%= item[:level] %></span>
86
+ </div>
87
+ <% end %>
88
+ </div>
89
+ <% end %>
90
+
91
+ <% if @data[:work] %>
92
+ <div class="work-experiences section">
93
+ <h2>Work Experience</h2>
94
+
95
+ <% (@data[:work] || []).each do |item| %>
96
+ <div class="work-experience item">
97
+ <div class="period"><%= period item, separator: "&mdash;" %></div>
98
+ <div class="position"><%= item[:position] %></div>
99
+ <div class="name"><%= item[:name] %></div>
100
+ <div class="summary"><%= html_summary item[:summary] %></div>
101
+ </div>
102
+ <% end %>
103
+ </div>
104
+ <% end %>
105
+
106
+ <% if @data[:teaching] %>
107
+ <div class="teachings section">
108
+ <h2>Teaching</h2>
109
+
110
+ <% (@data[:teaching] || []).each do |item| %>
111
+ <div class="teaching item">
112
+ <div class="period"><%= period item, separator: "&mdash;" %></div>
113
+ <div class="subject"><%= item[:subject] %></div>
114
+ <div class="position"><%= item[:position] %></div>
115
+ <div class="school"><%= item[:school] %></div>
116
+ <div class="name"><%= item[:name] %></div>
117
+ </div>
118
+ <% end %>
119
+ </div>
120
+ <% end %>
121
+
122
+ <% if @data[:projects] %>
123
+ <div class="projects section">
124
+ <h2>Projects</h2>
125
+
126
+ <% (@data[:projects] || []).each do |item| %>
127
+ <div class="project item">
128
+ <div class="period"><%= period item, separator: "&mdash;" %></div>
129
+ <div class="position"><%= item[:position] %></div>
130
+ <div class="name"><%= item[:name] %></div>
131
+ <div class="summary"><%= html_summary item[:summary] %></div>
132
+ </div>
133
+ <% end %>
134
+ </div>
135
+ <% end %>
136
+
137
+ <% if @data[:other] -%>
138
+ <div class="other section">
139
+ <h2>Other</h2>
140
+
141
+ <% (@data[:other] || []).each do |item| %>
142
+ <div class="other item">
143
+ <div class="period"><%= period item, separator: "&mdash;" %></div>
144
+ <div class="position"><%= item[:position] %></div>
145
+ <div class="name"><%= item[:name] %></div>
146
+ <div class="summary"><%= html_summary item[:summary] %></div>
147
+ </div>
148
+ <% end %>
149
+ </div>
150
+ <% end %>
151
+
152
+ <% if @data[:committees] %>
153
+ <div class="committees section">
154
+ <h2>Committees</h2>
155
+
156
+ <% (@data[:committees] || []).each do |item| %>
157
+ <div class="committee item">
158
+ <div class="name"><%= item[:name] %></div>
159
+ <div class="position"><%= item[:position] %></div>
160
+ <div class="editions"><%= item[:editions] %></div>
161
+ </div>
162
+ <% end %>
163
+ </div>
164
+ <% end %>
165
+
166
+ <% if @data[:volunteer] -%>
167
+ <div class="volunteer section">
168
+ <h2>Volunteer</h2>
169
+
170
+ <% (@data[:volunteer] || []).each do |item| %>
171
+ <div class="volunteer-item item">
172
+ <div class="period"><%= period item, separator: "&mdash;" %></div>
173
+ <div class="position"><%= item[:position] %></div>
174
+ <div class="name"><%= item[:name] %></div>
175
+ <div class="summary"><%= html_summary item[:summary] %></div>
176
+ </div>
177
+ <% end %>
178
+ </div>
179
+ <% end %>
180
+
181
+ <% if @data[:publications] %>
182
+ <div class="publications section">
183
+ <h2>Publications</h2>
184
+
185
+ <% (@data[:publications] || []).each do |item| %>
186
+ <div class="publication item">
187
+ <div class="authors"><%= item[:authors] %></div>
188
+ <div class="title"><%= item[:title] %></div>
189
+ <div class="publisher"><%= item[:publisher] %></div>
190
+ <div class="date"><%= item[:date] %></div>
191
+ </div>
192
+ <% end %>
193
+ </div>
194
+ <% end -%>
195
+
196
+ <% if @data[:talks] -%>
197
+ <div class="talks section">
198
+ <h2>Talks</h2>
199
+
200
+ <% (@data[:talks] || []).each do |item| -%>
201
+ <div class="talk item">
202
+ <div class="title"><%= item[:title] %></div>
203
+ <div class="venue"><%= item[:venue] %></div>
204
+ <div class="date"><%= item[:date] %></div>
205
+ </div>
206
+ <% end -%>
207
+ </div>
208
+ <% end -%>
209
+
210
+ <% if @data[:visits] -%>
211
+ <div class="visits section">
212
+ <h2>Visits</h2>
213
+
214
+ <% (@data[:visits] || []).each do |item| -%>
215
+ <div class="visit">
216
+ <div class="period"><%= period item, separator: "&mdash;" %></div>
217
+ <div class="position"><%= item[:position] %></div>
218
+ <div class="name"><%= item[:name] %></div>
219
+ <div class="address"><%= item[:address] %></div>
220
+ <div class="summary"><%= html_summary item[:summary] %></div>
221
+ </div>
222
+ <% end -%>
223
+ </div>
224
+ <% end -%>
225
+
226
+ <% if @data[:education] %>
227
+ <div class="education section">
228
+ <h2>Education</h2>
229
+
230
+ <% @data[:education].select { |x| x[:publish] }.each do |item| -%>
231
+ <div class="education-item item">
232
+ <div class="year"><%= year(item[:end_date]) %></div>
233
+ <div class="degree"><%= item[:degree] %></div>
234
+ <div class="school"><%= item[:school] %></div>
235
+ <div class="address"><%= item[:address] %></div>
236
+ </div>
237
+ <% end %>
238
+ </div>
239
+ <% end %>
240
+
241
+ <% [:awards, :achievements].each do |group| %>
242
+ <% if @data[group] -%>
243
+ <div class="<%= group %> section">
244
+ <h2><%= group.capitalize %></h2>
245
+
246
+ <% (@data[group] || []).each do |item| %>
247
+ <div class="<%= group %>-item item">
248
+ <% %w[date title name address summary].each do |element| %>
249
+ <div class="<%= element %>"><%= item[element] %></div>
250
+ <% end %>
251
+ </div>
252
+ <% end %>
253
+ </div>
254
+ <% end %>
255
+ <% end %>
256
+
257
+ <% if @data[:software] %>
258
+ <div class="software section">
259
+ <h2>Software</h2>
260
+
261
+ <% (@data[:software] || []).each do |item| -%>
262
+ <div class="software-item item">
263
+ <div class="title">
264
+ <a href="<%= item[:url] %>"><%= item[:title] %></a>
265
+ </div>
266
+ <div class="position"><%= item[:position] %></div>
267
+ </div>
268
+ <% end -%>
269
+ </div>
270
+ <% end -%>
271
+
272
+ <% if @data[:interests] -%>
273
+ <div class="interests section">
274
+ <h2>Interests</h2>
275
+
276
+ <% (@data[:interests] || []).each do |item| -%>
277
+ <div class="interest item">
278
+ <div class="name"><%= item[:name] %></div>
279
+ <div class="summary"><%= html_summary item[:summary] %></div>
280
+ </div>
281
+ <% end -%>
282
+ </div>
283
+ <% end -%>
284
+
285
+ <% if @data[:languages] %>
286
+ <div class="languages section">
287
+ <h2>Languages</h2>
288
+
289
+ <% if @data[:languages] and @data[:languages][:assessment] %>
290
+ <div class="assessment item">
291
+ <span class="label">Assessment</span>
292
+ <span class="value"><%= @data[:languages][:assessment] %></span>
293
+ </div>
294
+ <% end %>
295
+
296
+ <% if @data[:languages] and @data[:languages][:mother_tongues] %>
297
+ <div class="mother-tongues item">
298
+ <span class="label">Mother Tongues</span>
299
+ <% @data[:languages][:mother_tongues].each do |x| %>
300
+ <div class="mother-tongue">
301
+ <div class="language"><%= x[:language] %></div>
302
+ <div class="level"><%= x[:level] %></div>
303
+ </div>
304
+ <% end %>
305
+ </div>
306
+ <% end -%>
307
+
308
+ <% if @data[:languages] and @data[:languages][:foreign] %>
309
+ <div class="foreign-languages item">
310
+ <span class="label">Foreign Languages</span>
311
+ <% @data[:languages][:foreign].each do |x| %>
312
+ <div class="foreign-language">
313
+ <div class="language"><%= x[:language] %></div>
314
+ <div class="level"><%= x[:level] %></div>
315
+ </div>
316
+ <% end %>
317
+ </div>
318
+ <% end %>
319
+ </div>
320
+ <% end %>
321
+
322
+ <% if @data[:references] %>
323
+ <div class="references">
324
+ <h2>References</h2>
325
+
326
+ <% (@data[:references] || []).each do |item| -%>
327
+ <div class="reference item">
328
+ <div class="name"><%= item[:name] %></div>
329
+ <div class="reference"><%= item[:reference] %></div>
330
+ </div>
331
+ <% end %>
332
+ </div>
333
+ <% end %>
334
+ </div>
335
+ </div>
336
+ </body>
337
+ </html>
data/templates/org.erb CHANGED
@@ -196,6 +196,10 @@
196
196
  <% if @data[:languages] %>
197
197
  * Languages
198
198
 
199
+ <% if @data[:languages] and @data[:languages][:assessment] %>
200
+ Assessment <%= @data[:languages][:assessment] %>
201
+ <% end %>
202
+
199
203
  <% if @data[:languages] and @data[:languages][:mother_tongues] -%>
200
204
  - Mother Tongue(s): <%= @data[:languages][:mother_tongues].map { |x| x[:language] }.join(",") %>
201
205
  <% end -%>