json_resume 0.3.2 → 1.0.0

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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -3
  3. data/bin/json_resume +33 -9
  4. data/examples/prateek_cv.json +1 -1
  5. data/extras/resume_html/core-page.html +18 -0
  6. data/extras/resume_html/index.html +33 -0
  7. data/extras/resume_html/public/css/book.png +0 -0
  8. data/extras/resume_html/public/css/bookmark.png +0 -0
  9. data/extras/resume_html/public/css/bootstrap.min.css +7 -0
  10. data/extras/resume_html/public/css/briefcase.png +0 -0
  11. data/extras/resume_html/public/css/edit.png +0 -0
  12. data/extras/resume_html/public/css/envelope.png +0 -0
  13. data/extras/resume_html/public/css/file.png +0 -0
  14. data/extras/resume_html/public/css/gear.png +0 -0
  15. data/extras/resume_html/public/css/github.png +0 -0
  16. data/extras/resume_html/public/css/globe.png +0 -0
  17. data/extras/resume_html/public/css/icons.data.png.css +96 -0
  18. data/extras/resume_html/public/css/icons.data.svg.css +95 -0
  19. data/extras/resume_html/public/css/icons.fallback.css +96 -0
  20. data/extras/resume_html/public/css/institution.png +0 -0
  21. data/extras/resume_html/public/css/mobile.css +27 -0
  22. data/extras/resume_html/public/css/mortar-board.png +0 -0
  23. data/extras/resume_html/public/css/music.png +0 -0
  24. data/extras/resume_html/public/css/phone.png +0 -0
  25. data/extras/resume_html/public/css/screen.css +527 -0
  26. data/extras/resume_html/public/css/star-o.png +0 -0
  27. data/extras/resume_html/public/css/th-list.png +0 -0
  28. data/extras/resume_html/public/css/user.png +0 -0
  29. data/extras/resume_html/public/images/resume.png +0 -0
  30. data/extras/resume_html/public/js/grunticon.js +2 -0
  31. data/json_resume.gemspec +5 -4
  32. data/lib/json_resume/formatter.rb +92 -92
  33. data/lib/json_resume/formatter_html.rb +1 -1
  34. data/lib/json_resume/formatter_latex.rb +12 -1
  35. data/lib/json_resume/json_resume.rb +2 -2
  36. data/lib/json_resume/version.rb +1 -1
  37. data/locale/en.yml +45 -0
  38. data/locale/es.yml +45 -0
  39. data/locale/pt.yml +45 -0
  40. data/templates/classic_tex.mustache +209 -0
  41. data/templates/default_html.mustache +80 -48
  42. data/templates/default_md.mustache +20 -20
  43. data/templates/default_tex.mustache +20 -21
  44. metadata +70 -27
  45. data/extras/resume_html.tar.gz +0 -0
@@ -0,0 +1,2 @@
1
+ window.grunticon=function(e){if(e&&3===e.length){var t=window,n=!!t.document.createElementNS&&!!t.document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect&&!!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1"),A=function(A){var o=t.document.createElement("link"),r=t.document.getElementsByTagName("script")[0];o.rel="stylesheet",o.href=e[A&&n?0:A?1:2],r.parentNode.insertBefore(o,r)},o=new t.Image;o.onerror=function(){A(!1)},o.onload=function(){A(1===o.width&&1===o.height)},o.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}};
2
+ grunticon( [ "public/css/icons.data.svg.css", "public/css/icons.data.png.css", "public/css/icons.fallback.css" ] );
data/json_resume.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = JsonResume::VERSION
9
9
  spec.authors = ["Prateek Agarwal"]
10
10
  spec.email = ["prat0318@gmail.com"]
11
- spec.description = %q{json_resume creates pretty resume formats from a .json input file. Currently, it can cpnvert to html, tex, markdown and pdf. Customizing the templates to your own needs is also super easy.}
11
+ spec.description = %q{json_resume creates pretty resume formats from a .json input file. Currently, it can convert to html, tex, markdown and pdf. Customizing the templates to your own needs is also super easy.}
12
12
  spec.summary = %q{Generates pretty resume formats out of json input file}
13
13
  spec.homepage = "http://github.com/prat0318/json_resume"
14
14
  spec.license = "MIT"
@@ -21,10 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_dependency "pdfkit"
25
- spec.add_dependency "thor"
24
+ spec.add_dependency "i18n"
26
25
  spec.add_dependency "mustache"
27
- spec.add_dependency "archive-tar-minitar"
26
+ spec.add_dependency "pdfkit"
28
27
  spec.add_dependency "rest-client"
28
+ spec.add_dependency "thor"
29
+ spec.add_dependency "wkhtmltopdf-binary"
29
30
 
30
31
  end
@@ -8,121 +8,121 @@ end
8
8
 
9
9
  module JsonResume
10
10
  class Formatter
11
- attr_reader :hash
12
-
11
+ attr_reader :hash
12
+
13
13
  def initialize(hash)
14
- @hash = hash
14
+ @hash = hash
15
15
 
16
- #recursively defined proc
16
+ #recursively defined proc
17
17
  @hash_proc = Proc.new do |k,v|
18
- v = k if v.nil? #hack to make it common for hash and array
19
- v.delete_if(&@hash_proc) if [Hash,Array].any? { |x| v.instance_of? x }
20
- v.empty?
21
- end
18
+ v = k if v.nil? #hack to make it common for hash and array
19
+ v.delete_if(&@hash_proc) if [Hash,Array].any? { |x| v.instance_of? x }
20
+ v.empty?
21
+ end
22
22
  end
23
23
 
24
- def add_linkedin_github_url
25
- @hash["raw_website"] = @hash["bio_data"]["website"].sub(/^https?:\/\//,'') if @hash["bio_data"] && @hash["bio_data"]["website"]
26
- @hash["linkedin_url"] = "http://linkedin.com/in/" + @hash["linkedin_id"] if @hash["linkedin_id"]
27
- @hash["github_url"] = "http://github.com/" + @hash["github_id"] if @hash["github_id"]
28
- end
24
+ def add_linkedin_github_url
25
+ @hash["raw_website"] = @hash["bio_data"]["website"].sub(/^https?:\/\//,'') if @hash["bio_data"] && @hash["bio_data"]["website"]
26
+ @hash["linkedin_url"] = "http://linkedin.com/in/" + @hash["linkedin_id"] if @hash["linkedin_id"]
27
+ @hash["github_url"] = "http://github.com/" + @hash["github_id"] if @hash["github_id"]
28
+ end
29
29
 
30
- def add_last_marker_on_stars
31
- return if @hash['bio_data']['stars'].nil?
30
+ def add_last_marker_on_stars
31
+ return if @hash['bio_data']['stars'].nil?
32
32
  @hash["bio_data"]["stars"] = {
33
- "items" => @hash["bio_data"]["stars"].map{ |i| { "name" => i } }
34
- }
33
+ "items" => @hash["bio_data"]["stars"].map{ |i| { "name" => i } }
34
+ }
35
35
  @hash["bio_data"]["stars"]["items"][-1]["last"] = true
36
- end
37
-
38
- def add_last_marker_on_skills
39
- return if @hash['bio_data']['skills'].nil?
40
- @hash['bio_data']['skills']['details'].each do |item|
41
- item['items'].map!{|x| {'name'=>x} }
42
- item['items'][-1]['last'] = true
43
- end
44
- end
45
-
46
- def add_last_marker_on_tools
47
- return if @hash['bio_data']['other_projects'].nil?
48
- @hash['bio_data']['other_projects']['items'].each do |item|
49
- next if item['technology_used'].nil?
50
- item['technology_used']['tools'].map!{|x| {'name' => x} }
51
- item['technology_used']['tools'][-1]['last'] = true
52
- end
53
- end
54
-
55
- def add_last_marker_on_field field_name
56
- return if @hash['bio_data'][field_name].nil?
57
- @hash['bio_data'][field_name]['items'].each do |item|
58
- next if item['technology_used'].nil?
59
- item['technology_used']['tools'].map!{|x| {'name' => x} }
60
- item['technology_used']['tools'][-1]['last'] = true
61
- end
62
- end
36
+ end
37
+
38
+ def add_last_marker_on_skills
39
+ return if @hash['bio_data']['skills'].nil?
40
+ @hash['bio_data']['skills']['details'].each do |item|
41
+ item['items'].map!{|x| {'name'=>x} }
42
+ item['items'][-1]['last'] = true
43
+ end
44
+ end
45
+
46
+ def add_last_marker_on_tools
47
+ return if @hash['bio_data']['other_projects'].nil?
48
+ @hash['bio_data']['other_projects']['items'].each do |item|
49
+ next if item['technology_used'].nil?
50
+ item['technology_used']['tools'].map!{|x| {'name' => x} }
51
+ item['technology_used']['tools'][-1]['last'] = true
52
+ end
53
+ end
54
+
55
+ def add_last_marker_on_field field_name
56
+ return if @hash['bio_data'][field_name].nil?
57
+ @hash['bio_data'][field_name]['items'].each do |item|
58
+ next if item['technology_used'].nil?
59
+ item['technology_used']['tools'].map!{|x| {'name' => x} }
60
+ item['technology_used']['tools'][-1]['last'] = true
61
+ end
62
+ end
63
63
 
64
64
  def cleanse
65
65
  @hash.delete_if &@hash_proc
66
- self
67
- end
66
+ self
67
+ end
68
68
 
69
- def format_to_output_type
69
+ def format_to_output_type
70
70
  format_proc = Proc.new do |k,v|
71
- v = k if v.nil?
72
- v.each{|x| format_proc.call(x)} if [Hash,Array].any? {|x| v.instance_of? x}
73
- format_string v if v.instance_of? String
74
- end
75
- @hash.each{|x| format_proc.call(x)}
76
- self
77
- end
78
-
79
- def format_string str
80
- raise NotImplementedError.new("format_string not impl in formatter")
81
- end
82
-
83
- def is_false? item
84
- item == false || item == 'false'
85
- end
86
-
87
- def purge_gpa
88
- return if @hash['bio_data']['education'].nil?
89
- @hash["bio_data"]["education"].delete("show_gpa") if is_false?(@hash["bio_data"]["education"]["show_gpa"]) || @hash["bio_data"]["education"]["schools"].all? {|sch| sch["gpa"].nil? || sch["gpa"].empty?}
90
- end
91
-
92
- def add_padding(course)
93
- unless @hash["bio_data"].nil? || @hash["bio_data"][course].nil?
94
- course_hash = @hash["bio_data"][course]
95
- course_hash << {} if course_hash.size % 2 == 1
96
- @hash["bio_data"][course] = {
97
- "rows" => course_hash.each_slice(2).to_a.map{ |i| { "columns" => i } }
98
- }
99
- end
71
+ v = k if v.nil?
72
+ v.each{|x| format_proc.call(x)} if [Hash,Array].any? {|x| v.instance_of? x}
73
+ format_string v if v.instance_of? String
74
+ end
75
+ @hash.each{|x| format_proc.call(x)}
76
+ self
100
77
  end
101
-
78
+
79
+ def format_string str
80
+ raise NotImplementedError.new("format_string not impl in formatter")
81
+ end
82
+
83
+ def is_false? item
84
+ item == false || item == 'false'
85
+ end
86
+
87
+ def purge_gpa
88
+ return if @hash['bio_data']['education'].nil?
89
+ @hash["bio_data"]["education"].delete("show_gpa") if is_false?(@hash["bio_data"]["education"]["show_gpa"]) || @hash["bio_data"]["education"]["schools"].all? {|sch| sch["gpa"].nil? || sch["gpa"].empty?}
90
+ end
91
+
92
+ def add_padding(course)
93
+ unless @hash["bio_data"].nil? || @hash["bio_data"][course].nil?
94
+ course_hash = @hash["bio_data"][course]
95
+ course_hash << {} if course_hash.size % 2 == 1
96
+ @hash["bio_data"][course] = {
97
+ "rows" => course_hash.each_slice(2).to_a.map{ |i| { "columns" => i } }
98
+ }
99
+ end
100
+ end
101
+
102
102
  def format
103
- return if @hash["bio_data"].nil?
104
-
105
- cleanse
103
+ return if @hash["bio_data"].nil?
104
+
105
+ cleanse
106
+
107
+ format_to_output_type
106
108
 
107
- format_to_output_type
109
+ add_last_marker_on_stars
108
110
 
109
- add_last_marker_on_stars
111
+ add_last_marker_on_skills
110
112
 
111
- add_last_marker_on_skills
113
+ add_last_marker_on_field 'experience'
114
+ add_last_marker_on_field 'other_projects'
112
115
 
113
- add_last_marker_on_field 'experience'
114
- add_last_marker_on_field 'other_projects'
115
-
116
- purge_gpa
116
+ purge_gpa
117
117
 
118
- add_linkedin_github_url
118
+ add_linkedin_github_url
119
119
 
120
- #make odd listed courses to even
120
+ #make odd listed courses to even
121
121
  ["grad_courses", "undergrad_courses"].each do |course|
122
- add_padding(course)
123
- end
122
+ add_padding(course)
123
+ end
124
124
 
125
- return self
125
+ return self
126
126
  end
127
127
 
128
128
 
@@ -11,7 +11,7 @@ module JsonResume
11
11
  end
12
12
 
13
13
  def format_emphasis str
14
- str.gsub! /_(.+?)_/, '<i>\1</i>'
14
+ str.gsub! /\b_(.+?)_\b/, '<i>\1</i>'
15
15
  str.gsub! /\*\*(.+?)\*\*/, '<b>\1</b>'
16
16
  end
17
17
 
@@ -3,6 +3,12 @@ require_relative 'formatter'
3
3
  module JsonResume
4
4
  class FormatterLatex < Formatter
5
5
 
6
+ def format_slashes str
7
+ str.gsub!(/\\/, '\textbackslash')
8
+ str.gsub!(/\{/, '\{')
9
+ str.gsub!(/\}/, '\}')
10
+ end
11
+
6
12
  def format_link str
7
13
  str.gsub! /\[(.*?)\]\((.*?)\)/, '{\color{see} \href{\2}{\1}}'
8
14
  end
@@ -12,7 +18,7 @@ module JsonResume
12
18
  end
13
19
 
14
20
  def format_emphasis str
15
- str.gsub! /_(.+?)_/, '\textit{\1}'
21
+ str.gsub! /\b_(.+?)_\b/, '\textit{\1}'
16
22
  str.gsub! /\*\*(.+?)\*\*/, '\textbf{\1}'
17
23
  end
18
24
 
@@ -22,11 +28,16 @@ module JsonResume
22
28
  end
23
29
 
24
30
  def format_symbols str
31
+ str.gsub! /#/, '\#'
32
+ str.gsub! /\$/, '\$'
33
+ str.gsub! /&/, '\\\\&'
34
+ str.gsub! /\|/, '\textbar'
25
35
  str.gsub! /%/, '\%'
26
36
  str.gsub! /_/, '\_'
27
37
  end
28
38
 
29
39
  def format_string str
40
+ format_slashes str
30
41
  format_link str
31
42
  format_autolink str
32
43
  format_emphasis str
@@ -3,14 +3,14 @@ require_relative 'reader'
3
3
  module JsonResume
4
4
  class << self
5
5
  def new(json_input, options = {})
6
- options = options.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
6
+ options = options.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
7
7
  JsonResume::Core.new(json_input, options)
8
8
  end
9
9
  end
10
10
 
11
11
  class Core
12
12
  attr_accessor :reader
13
-
13
+
14
14
  def initialize(json_input, options)
15
15
  @reader = Reader.new(json_input, options)
16
16
  @reader.format!
@@ -1,3 +1,3 @@
1
1
  module JsonResume
2
- VERSION = "0.3.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/locale/en.yml ADDED
@@ -0,0 +1,45 @@
1
+ ---
2
+ en:
3
+ headings:
4
+ # "Academic Achievements"
5
+ acad_achievements: "Academic Achievements"
6
+ # "Degree"
7
+ degree: "Degree"
8
+ # "Education"
9
+ education: "Education"
10
+ # "Professional Experience"
11
+ experience: "Professional Experience"
12
+ # "Extra Curricular Awards"
13
+ extra_curricular: "Extra Curricular Awards"
14
+ # "GitHub Projects"
15
+ github_projects: "GitHub Projects"
16
+ # GPA
17
+ gpa: "GPA"
18
+ # "Graduate Courses Taken"
19
+ grad_courses: "Graduate Courses Taken"
20
+ # "Graduation Year"
21
+ graduation_year: "Graduation Year"
22
+ # "Institution"
23
+ institution: "Institution"
24
+ # "issued on"
25
+ issuance: "issued on"
26
+ # "Major"
27
+ major: "Major"
28
+ # "Memberships"
29
+ memberships: "Memberships"
30
+ # "Other Personal Projects"
31
+ other_projects: "Other Personal Projects"
32
+ # "Publications"
33
+ papers: "Publications"
34
+ # "Patents"
35
+ patents: "Patents"
36
+ # "Research Experience"
37
+ research_experience: "Research Experience"
38
+ # "Technical Skills"
39
+ skills: "Technical Skills"
40
+ # "Qualifications summary"
41
+ summary: "Qualifications summary"
42
+ # "Technologies got to work on"
43
+ technology_used: "Technologies got to work on"
44
+ # "Undergraduate Courses Taken"
45
+ undergrad_courses: "Undergraduate Courses Taken"
data/locale/es.yml ADDED
@@ -0,0 +1,45 @@
1
+ ---
2
+ es:
3
+ headings:
4
+ # "Academic Achievements"
5
+ acad_achievements: "Logros Académicos"
6
+ # "Degree"
7
+ degree: "Grado"
8
+ # "Education"
9
+ education: "Educación"
10
+ # "Professional Experience"
11
+ experience: "Experiencia Profesional"
12
+ # "Extra Curricular Awards"
13
+ extra_curricular: "Premios Extracurriculares"
14
+ # "GitHub Projects"
15
+ github_projects: "Proyectos en GitHub"
16
+ # GPA - Grade point average
17
+ gpa: "GPA"
18
+ # "Graduate Courses Taken"
19
+ grad_courses: "Cursos de Postgrado realizados"
20
+ # "Graduation Year"
21
+ graduation_year: "Año de Graduación"
22
+ # "Institution"
23
+ institution: "Institución"
24
+ # "issued on"
25
+ issuance: "emitido el"
26
+ # "Major"
27
+ major: "Major"
28
+ # "Memberships"
29
+ memberships: "Membresías"
30
+ # "Other Personal Projects"
31
+ other_projects: "Otros Proyectos Personales"
32
+ # "Publications"
33
+ papers: "Publicaciones"
34
+ # "Patents"
35
+ patents: "Patentes"
36
+ # "Research Experience"
37
+ research_experience: "Experiencia en Investigación"
38
+ # "Technical Skills"
39
+ skills: "Habilidades Técnicas"
40
+ # "Qualifications summary"
41
+ summary: "Resumen de Cualificaciones"
42
+ # "Technologies got to work on"
43
+ technology_used: "Tecnologías en las que trabajó"
44
+ # "Undergraduate Courses Taken"
45
+ undergrad_courses: "Pregrado recibido"
data/locale/pt.yml ADDED
@@ -0,0 +1,45 @@
1
+ ---
2
+ pt:
3
+ headings:
4
+ # "Academic Achievements"
5
+ acad_achievements: "Conquistas acadêmicas"
6
+ # "Degree"
7
+ degree: "Grau"
8
+ # "Education"
9
+ education: "Educação"
10
+ # "Professional Experience"
11
+ experience: "Experiência Profissional"
12
+ # "Extra Curricular Awards"
13
+ extra_curricular: "Prêmios extra-curriculares"
14
+ # "GitHub Projects"
15
+ github_projects: "Projetos GitHub"
16
+ # GPA
17
+ gpa: "GPA"
18
+ # "Graduate Courses Taken"
19
+ grad_courses: "Cursos de pós-graduação Taken"
20
+ # "Graduation Year"
21
+ graduation_year: "Ano de Graduação"
22
+ # "Institution"
23
+ institution: "Instituição"
24
+ # "issued on"
25
+ issuance: "emitida em"
26
+ # "Major"
27
+ major: "Curso"
28
+ # "Memberships"
29
+ memberships: "Associações"
30
+ # "Other Personal Projects"
31
+ other_projects: "Outros Projetos Pessoais"
32
+ # "Publications"
33
+ papers: "Publicações"
34
+ # "Patents"
35
+ patents: "Patentes"
36
+ # "Research Experience"
37
+ research_experience: "Experiência de Pesquisa"
38
+ # "Technical Skills"
39
+ skills: "Habilidades Técnicas"
40
+ # "Qualifications summary"
41
+ summary: "Qualificações resumo"
42
+ # "Technologies got to work on"
43
+ technology_used: "Técnologias usadas"
44
+ # "Undergraduate Courses Taken"
45
+ undergrad_courses: "Cursos de graduação Taken"