json_resume 1.0.3 → 1.0.4
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 +4 -4
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +87 -0
- data/README.md +6 -1
- data/Rakefile +1 -1
- data/bin/json_resume +110 -82
- data/json_resume.gemspec +19 -20
- data/lib/json_resume.rb +2 -2
- data/lib/json_resume/formatter.rb +122 -125
- data/lib/json_resume/formatter_html.rb +9 -10
- data/lib/json_resume/formatter_latex.rb +13 -14
- data/lib/json_resume/formatter_md.rb +6 -7
- data/lib/json_resume/json_resume.rb +13 -13
- data/lib/json_resume/reader.rb +21 -19
- data/lib/json_resume/version.rb +1 -1
- data/locale/pt.yml +3 -3
- data/locale/zh_cn.yml +45 -0
- data/spec/json_resume/formatter_html_spec.rb +20 -20
- data/spec/json_resume/formatter_latex_spec.rb +7 -7
- data/spec/json_resume/formatter_spec.rb +19 -19
- data/spec/json_resume/reader_spec.rb +11 -11
- metadata +5 -2
data/lib/json_resume/version.rb
CHANGED
data/locale/pt.yml
CHANGED
@@ -16,7 +16,7 @@ pt:
|
|
16
16
|
# GPA
|
17
17
|
gpa: "GPA"
|
18
18
|
# "Graduate Courses Taken"
|
19
|
-
grad_courses: "Cursos de pós-graduação
|
19
|
+
grad_courses: "Cursos de pós-graduação"
|
20
20
|
# "Graduation Year"
|
21
21
|
graduation_year: "Ano de Graduação"
|
22
22
|
# "Institution"
|
@@ -38,8 +38,8 @@ pt:
|
|
38
38
|
# "Technical Skills"
|
39
39
|
skills: "Habilidades Técnicas"
|
40
40
|
# "Qualifications summary"
|
41
|
-
summary: "Qualificações
|
41
|
+
summary: "Resumo de Qualificações"
|
42
42
|
# "Technologies got to work on"
|
43
43
|
technology_used: "Técnologias usadas"
|
44
44
|
# "Undergraduate Courses Taken"
|
45
|
-
undergrad_courses: "Cursos de graduação
|
45
|
+
undergrad_courses: "Cursos de graduação"
|
data/locale/zh_cn.yml
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
zh_cn:
|
3
|
+
headings:
|
4
|
+
# "Academic Achievements"
|
5
|
+
acad_achievements: "学术成就"
|
6
|
+
# "Degree"
|
7
|
+
degree: "学位"
|
8
|
+
# "Education"
|
9
|
+
education: "教育经历"
|
10
|
+
# "Professional Experience"
|
11
|
+
experience: "专业经验"
|
12
|
+
# "Extra Curricular Awards"
|
13
|
+
extra_curricular: "课外奖励"
|
14
|
+
# "GitHub Projects"
|
15
|
+
github_projects: "GitHub 项目"
|
16
|
+
# GPA
|
17
|
+
gpa: "GPA"
|
18
|
+
# "Graduate Courses Taken"
|
19
|
+
grad_courses: "研究生课程"
|
20
|
+
# "Graduation Year"
|
21
|
+
graduation_year: "毕业时间"
|
22
|
+
# "Institution"
|
23
|
+
institution: "学校"
|
24
|
+
# "issued on"
|
25
|
+
issuance: "发表作品"
|
26
|
+
# "Major"
|
27
|
+
major: "专业"
|
28
|
+
# "Memberships"
|
29
|
+
memberships: "会员资格"
|
30
|
+
# "Other Personal Projects"
|
31
|
+
other_projects: "其他项目"
|
32
|
+
# "Publications"
|
33
|
+
papers: "论文"
|
34
|
+
# "Patents"
|
35
|
+
patents: "专利"
|
36
|
+
# "Research Experience"
|
37
|
+
research_experience: "科研经验"
|
38
|
+
# "Technical Skills"
|
39
|
+
skills: "专业技能"
|
40
|
+
# "Qualifications summary"
|
41
|
+
summary: "资质汇总"
|
42
|
+
# "Technologies got to work on"
|
43
|
+
technology_used: "涉及技术"
|
44
|
+
# "Undergraduate Courses Taken"
|
45
|
+
undergrad_courses: "本科课程"
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
2
2
|
require 'json_resume/formatter_html'
|
3
3
|
require 'json_resume/formatter'
|
4
4
|
|
5
|
-
describe
|
5
|
+
describe '#padder' do
|
6
6
|
it 'pads a row if items are odd' do
|
7
|
-
hash = {'bio_data' => {'test' => [
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
hash = { 'bio_data' => { 'test' => [
|
8
|
+
{ 'name' => 'sub1', 'url' => 'url1' },
|
9
|
+
{ 'name' => 'sub2', 'url' => 'url2' },
|
10
|
+
{ 'name' => 'sub3', 'url' => 'url3' }
|
11
|
+
] }
|
12
12
|
}
|
13
13
|
formatter = JsonResume::FormatterHtml.new hash
|
14
14
|
formatter.add_padding('test')
|
@@ -18,10 +18,10 @@ describe "#padder" do
|
|
18
18
|
|
19
19
|
it 'doesn\'t pad a row if items are even' do
|
20
20
|
subs = [
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
hash = {'bio_data' => {'test' => subs}}
|
21
|
+
{ 'name' => 'sub1', 'url' => 'url1' },
|
22
|
+
{ 'name' => 'sub2', 'url' => 'url2' }
|
23
|
+
]
|
24
|
+
hash = { 'bio_data' => { 'test' => subs } }
|
25
25
|
formatter = JsonResume::FormatterHtml.new hash
|
26
26
|
formatter.add_padding('test')
|
27
27
|
expect(formatter.hash['bio_data']['test']['rows'].size).to eq(1)
|
@@ -29,7 +29,7 @@ describe "#padder" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'ignores if data is null' do
|
32
|
-
hash = {'bio_data' => {}}
|
32
|
+
hash = { 'bio_data' => {} }
|
33
33
|
formatter = JsonResume::FormatterHtml.new hash
|
34
34
|
formatter.add_padding('test')
|
35
35
|
expect(formatter.hash['bio_data']).to eq({})
|
@@ -40,53 +40,53 @@ describe '#urlformatter' do
|
|
40
40
|
context 'when given a link for html output' do
|
41
41
|
it 'converts link to href' do
|
42
42
|
formatter = JsonResume::FormatterHtml.new({})
|
43
|
-
str =
|
43
|
+
str = 'test [Hello](http://google.com)'
|
44
44
|
formatter.format_link str
|
45
45
|
expect(str).to eq('test <a href="http://google.com">Hello</a>')
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'converts autolink to url' do
|
49
49
|
formatter = JsonResume::FormatterHtml.new({})
|
50
|
-
str =
|
50
|
+
str = 'test <<http://google.com>>'
|
51
51
|
formatter.format_autolink str
|
52
52
|
expect(str).to eq('test <a href="http://google.com">http://google.com</a>')
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'converts links and autolinks to url' do
|
56
56
|
formatter = JsonResume::FormatterHtml.new({})
|
57
|
-
str =
|
57
|
+
str = 'test <<http://google.com>> [Hello](http://google.com) <<http://google.com>>'
|
58
58
|
formatter.format_string str
|
59
59
|
expect(str).to eq('test <a href="http://google.com">http://google.com</a> <a href="http://google.com">Hello</a> <a href="http://google.com">http://google.com</a>')
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe
|
64
|
+
describe '#emphasis_formatting' do
|
65
65
|
it 'italicizes on _text_' do
|
66
66
|
formatter = JsonResume::FormatterHtml.new({})
|
67
|
-
str =
|
67
|
+
str = 'Last word should be _italicized_'
|
68
68
|
formatter.format_emphasis str
|
69
69
|
expect(str).to eq('Last word should be <i>italicized</i>')
|
70
70
|
end
|
71
71
|
|
72
72
|
it 'bolds on **text**' do
|
73
73
|
formatter = JsonResume::FormatterHtml.new({})
|
74
|
-
str =
|
74
|
+
str = 'Last word should be **bold**'
|
75
75
|
formatter.format_emphasis str
|
76
76
|
expect(str).to eq('Last word should be <b>bold</b>')
|
77
77
|
end
|
78
78
|
|
79
79
|
it 'italicizes and bolds if given both' do
|
80
80
|
formatter = JsonResume::FormatterHtml.new({})
|
81
|
-
str =
|
81
|
+
str = 'Last word should _be **bold and italicized**_'
|
82
82
|
formatter.format_emphasis str
|
83
83
|
expect(str).to eq('Last word should <i>be <b>bold and italicized</b></i>')
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
describe
|
87
|
+
describe '#format' do
|
88
88
|
it 'calls parent format method' do
|
89
|
-
formatter = JsonResume::FormatterHtml.new(
|
89
|
+
formatter = JsonResume::FormatterHtml.new('bio_data' => {})
|
90
90
|
expect(formatter).to receive(:cleanse).and_return(nil)
|
91
91
|
formatter.format
|
92
92
|
end
|
@@ -5,45 +5,45 @@ describe '#urlformatter' do
|
|
5
5
|
context 'when given a link for latex output' do
|
6
6
|
it 'converts link to href' do
|
7
7
|
formatter = JsonResume::FormatterLatex.new({})
|
8
|
-
str =
|
8
|
+
str = 'test [Hello](http://google.com)'
|
9
9
|
formatter.format_link str
|
10
10
|
expect(str).to eq('test {\color{see} \href{http://google.com}{Hello}}')
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'converts autolink to url' do
|
14
14
|
formatter = JsonResume::FormatterLatex.new({})
|
15
|
-
str =
|
15
|
+
str = 'test <<http://google.com>>'
|
16
16
|
formatter.format_autolink str
|
17
17
|
expect(str).to eq('test {\color{see} \url{http://google.com}}')
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'converts links and autolinks to url' do
|
21
21
|
formatter = JsonResume::FormatterLatex.new({})
|
22
|
-
str =
|
22
|
+
str = 'test <<http://google.com>> [Hello](http://google.com) <<http://google.com>>'
|
23
23
|
formatter.format_string str
|
24
24
|
expect(str).to eq('test {\color{see} \url{http://google.com}} {\color{see} \href{http://google.com}{Hello}} {\color{see} \url{http://google.com}}')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
describe
|
29
|
+
describe '#emphasis_formatting' do
|
30
30
|
it 'italicizes on _text_' do
|
31
31
|
formatter = JsonResume::FormatterLatex.new({})
|
32
|
-
str =
|
32
|
+
str = 'Last word should be _italicized_'
|
33
33
|
formatter.format_emphasis str
|
34
34
|
expect(str).to eq('Last word should be \textit{italicized}')
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'bolds on **text**' do
|
38
38
|
formatter = JsonResume::FormatterLatex.new({})
|
39
|
-
str =
|
39
|
+
str = 'Last word should be **bold**'
|
40
40
|
formatter.format_emphasis str
|
41
41
|
expect(str).to eq('Last word should be \textbf{bold}')
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'italicizes and bolds if given both' do
|
45
45
|
formatter = JsonResume::FormatterLatex.new({})
|
46
|
-
str =
|
46
|
+
str = 'Last word should _be **bold and italicized**_'
|
47
47
|
formatter.format_emphasis str
|
48
48
|
expect(str).to eq('Last word should \textit{be \textbf{bold and italicized}}')
|
49
49
|
end
|
@@ -1,66 +1,66 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'json_resume/formatter'
|
3
3
|
|
4
|
-
describe
|
5
|
-
context
|
4
|
+
describe '#cleanser' do
|
5
|
+
context 'when given a hash' do
|
6
6
|
it 'removes empty keys in a single level' do
|
7
|
-
hash = {
|
7
|
+
hash = { 'key1' => '', 'key2' => '' }
|
8
8
|
formatter = JsonResume::Formatter.new hash
|
9
9
|
expect(formatter.cleanse.hash).to eq({})
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'removes empty keys in a nested level' do
|
13
|
-
hash = {
|
13
|
+
hash = { 'key1' => 'non-empty', 'key2' => { 'key3' => [], 'key4' => '' } }
|
14
14
|
formatter = JsonResume::Formatter.new hash
|
15
|
-
expect(formatter.cleanse.hash).to eq(
|
15
|
+
expect(formatter.cleanse.hash).to eq('key1' => 'non-empty')
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
20
|
+
describe '#format_to_output_type' do
|
21
21
|
it 'should make format calls to all valid strings' do
|
22
|
-
hash = {
|
22
|
+
hash = { 'key1' => 'non-empty', 'key2' => { 'key3' => ['test [Hello]{http://google.com}'] } }
|
23
23
|
formatter = JsonResume::Formatter.new hash
|
24
|
-
expect(formatter).to receive(:format_string).with(
|
25
|
-
expect(formatter).to receive(:format_string).with(
|
24
|
+
expect(formatter).to receive(:format_string).with('non-empty')
|
25
|
+
expect(formatter).to receive(:format_string).with('test [Hello]{http://google.com}')
|
26
26
|
formatter.format_to_output_type
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
describe
|
30
|
+
describe '#add_linkedin_github_url' do
|
31
31
|
it 'creates linkedin url if id present' do
|
32
|
-
hash = {
|
32
|
+
hash = { 'linkedin_id' => 'xyz' }
|
33
33
|
formatter = JsonResume::Formatter.new hash
|
34
34
|
formatter.add_linkedin_github_url
|
35
|
-
expect(formatter.hash[
|
35
|
+
expect(formatter.hash['linkedin_url']).to eq('http://linkedin.com/in/xyz')
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'creates github url if github id present' do
|
39
|
-
hash = {
|
39
|
+
hash = { 'github_id' => 'xyz' }
|
40
40
|
formatter = JsonResume::Formatter.new hash
|
41
41
|
formatter.add_linkedin_github_url
|
42
|
-
expect(formatter.hash[
|
42
|
+
expect(formatter.hash['github_url']).to eq('http://github.com/xyz')
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'doesnt create url if id isnt present' do
|
46
46
|
hash = {}
|
47
47
|
formatter = JsonResume::Formatter.new hash
|
48
48
|
formatter.add_linkedin_github_url
|
49
|
-
expect(formatter.hash[
|
50
|
-
expect(formatter.hash[
|
49
|
+
expect(formatter.hash['linkedin_url']).to be_nil
|
50
|
+
expect(formatter.hash['github_url']).to be_nil
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
describe
|
54
|
+
describe '#gpa_purger' do
|
55
55
|
it 'removes gpa if not opted for' do
|
56
|
-
hash = {'bio_data' => {'education' => {'show_gpa' => false, 'schools' => []}}}
|
56
|
+
hash = { 'bio_data' => { 'education' => { 'show_gpa' => false, 'schools' => [] } } }
|
57
57
|
formatter = JsonResume::Formatter.new hash
|
58
58
|
formatter.purge_gpa
|
59
59
|
expect(formatter.hash['bio_data']['education']['show_gpa']).to be_nil
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'removes gpa if gpa not mentioned' do
|
63
|
-
hash = {'bio_data' => {'education' => {'show_gpa' => true, 'schools' => [{}]}}}
|
63
|
+
hash = { 'bio_data' => { 'education' => { 'show_gpa' => true, 'schools' => [{}] } } }
|
64
64
|
formatter = JsonResume::Formatter.new hash
|
65
65
|
formatter.purge_gpa
|
66
66
|
expect(formatter.hash['bio_data']['education']['show_gpa']).to be_nil
|
@@ -2,31 +2,31 @@ require 'spec_helper'
|
|
2
2
|
require 'json_resume/reader'
|
3
3
|
require 'json_resume/formatter'
|
4
4
|
|
5
|
-
describe
|
6
|
-
context
|
5
|
+
describe '#reader' do
|
6
|
+
context 'when given a json file name' do
|
7
7
|
it 'reads in the file' do
|
8
|
-
File.
|
8
|
+
expect(File).to receive(:read).with('test.json').and_return("{\"test\":1}")
|
9
9
|
reader = JsonResume::Reader.new 'test.json', {}
|
10
|
-
expect(reader.hash).to eq(
|
10
|
+
expect(reader.hash).to eq('test' => 1)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
14
|
+
context 'when given a json string' do
|
15
15
|
it 'reads in the string' do
|
16
16
|
reader = JsonResume::Reader.new "{\"test\":1}", {}
|
17
|
-
expect(reader.hash).to eq(
|
17
|
+
expect(reader.hash).to eq('test' => 1)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
context
|
21
|
+
context 'when doing a format!' do
|
22
22
|
it 'updates the hash by calling the proper formatter' do
|
23
|
-
expect_any_instance_of(JsonResume::FormatterHtml).to receive(:format).and_return(double(:
|
24
|
-
JsonResume::Reader.new("{\"test\":1}",{}).format!
|
23
|
+
expect_any_instance_of(JsonResume::FormatterHtml).to receive(:format).and_return(double(hash: {}))
|
24
|
+
JsonResume::Reader.new("{\"test\":1}", {}).format!
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'updates the hash by calling the proper formatter(Latex)' do
|
28
|
-
expect_any_instance_of(JsonResume::FormatterLatex).to receive(:format).and_return(double(:
|
29
|
-
JsonResume::Reader.new("{\"test\":1}",
|
28
|
+
expect_any_instance_of(JsonResume::FormatterLatex).to receive(:format).and_return(double(hash: {}))
|
29
|
+
JsonResume::Reader.new("{\"test\":1}", output_type: 'latex').format!
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_resume
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Prateek Agarwal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,6 +133,8 @@ extensions: []
|
|
133
133
|
extra_rdoc_files: []
|
134
134
|
files:
|
135
135
|
- ".gitignore"
|
136
|
+
- ".rubocop.yml"
|
137
|
+
- ".rubocop_todo.yml"
|
136
138
|
- Gemfile
|
137
139
|
- LICENSE.txt
|
138
140
|
- README.md
|
@@ -177,6 +179,7 @@ files:
|
|
177
179
|
- locale/en.yml
|
178
180
|
- locale/es.yml
|
179
181
|
- locale/pt.yml
|
182
|
+
- locale/zh_cn.yml
|
180
183
|
- spec/json_resume/formatter_html_spec.rb
|
181
184
|
- spec/json_resume/formatter_latex_spec.rb
|
182
185
|
- spec/json_resume/formatter_spec.rb
|