json_resume 1.0.2 → 1.0.3
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/README.md +25 -29
- data/bin/json_resume +28 -26
- data/extras/resume_html/public/css/mobile.css +2 -2
- data/extras/resume_html/public/js/grunticon.js +1 -1
- data/lib/json_resume/formatter.rb +8 -9
- data/lib/json_resume/formatter_html.rb +6 -7
- data/lib/json_resume/formatter_latex.rb +18 -20
- data/lib/json_resume/formatter_md.rb +3 -4
- data/lib/json_resume/reader.rb +2 -3
- data/lib/json_resume/version.rb +1 -1
- data/spec/json_resume/formatter_html_spec.rb +7 -9
- data/spec/json_resume/formatter_latex_spec.rb +4 -5
- data/spec/json_resume/formatter_spec.rb +4 -4
- data/spec/json_resume/reader_spec.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- data/templates/default_html.mustache +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 611619ad281dcba8a17ffa917d97277a9417061a
|
4
|
+
data.tar.gz: b7ca67570ed43f1f6d2b1d2d346e44e47894b294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fab1a474d7a83b60006a117c9c9ff06b5dc8323ae5f53c8581bc484baccddfc90055218b184437d313d7ed158893c218d3b55e9b69f9b00e7e4dd27b0254b81c
|
7
|
+
data.tar.gz: fe42ee34a78d87edf5c6b5b32c6a706acddf4bd6ae5b138cc73dbf81951d84ad12dbac17818618eed5726baa780d171027fd8eb8010fa41cd8123acb6693140f
|
data/README.md
CHANGED
@@ -11,17 +11,17 @@ JsonResume creates pretty versions of resume from a single JSON input file. Outp
|
|
11
11
|
### Create a sample JSON input file to start
|
12
12
|
|
13
13
|
$ json_resume sample
|
14
|
-
|
14
|
+
|
15
15
|
A [sample](https://github.com/prat0318/json_resume/blob/master/examples/prateek_cv.json) `prateek_cv.json` is generated in the current working directory(cwd).
|
16
|
-
|
16
|
+
|
17
17
|
Modify it as per the needs, and remove or keep rest of the fields empty.
|
18
|
-
|
18
|
+
|
19
19
|
### Conversion
|
20
20
|
|
21
21
|
* Syntax
|
22
22
|
|
23
23
|
```
|
24
|
-
json_resume convert [--template=/path/to/custom/template]
|
24
|
+
json_resume convert [--template=/path/to/custom/template]
|
25
25
|
[--out=html|html_pdf|tex|tex_pdf|md]
|
26
26
|
[--locale=es|en|pt]
|
27
27
|
[--theme=default|classic] <json_input>
|
@@ -35,12 +35,12 @@ Modify it as per the needs, and remove or keep rest of the fields empty.
|
|
35
35
|
$ json_resume convert prateek_cv.json
|
36
36
|
```
|
37
37
|
|
38
|
-
A directory `resume/` will be generated in cwd, which can be put hosted on /var/www or on github pages. ([Sample](http://prat0318.github.io/
|
38
|
+
A directory `resume/` will be generated in cwd, which can be put hosted on /var/www or on github pages. ([Sample](http://prat0318.github.io/json_resume/html_version/resume_with_icons/))
|
39
39
|
|
40
40
|
|
41
41
|
* HTML\* version
|
42
42
|
|
43
|
-
`html` version without icons can be generated by giving `icons` as `false` : ([Sample](http://prat0318.github.io/
|
43
|
+
`html` version without icons can be generated by giving `icons` as `false` : ([Sample](http://prat0318.github.io/json_resume/html_version/resume_without_icons/))
|
44
44
|
|
45
45
|
```
|
46
46
|
"settings": {
|
@@ -48,20 +48,21 @@ A directory `resume/` will be generated in cwd, which can be put hosted on /var/
|
|
48
48
|
},
|
49
49
|
```
|
50
50
|
|
51
|
-
* PDF version from HTML ([Sample](http://prat0318.github.io/
|
51
|
+
* PDF version from HTML ([Sample](http://prat0318.github.io/json_resume/html_version/resume_with_icons/resume.pdf))
|
52
52
|
|
53
53
|
```
|
54
54
|
$ json_resume convert --out=html_pdf prateek_cv.json
|
55
55
|
```
|
56
56
|
|
57
|
-
* LaTeX version ([Sample](https://www.writelatex.com/read/
|
57
|
+
* LaTeX version ([Sample](https://www.writelatex.com/read/ynhgbrnmtrbw))
|
58
58
|
|
59
59
|
```
|
60
60
|
$ json_resume convert --out=tex prateek_cv.json
|
61
61
|
```
|
62
|
-
- LaTex also includes a ``classic`` theme. Usage: ``--theme=classic``.
|
63
62
|
|
64
|
-
|
63
|
+
LaTex also includes a ``classic`` theme. Usage: ``--theme=classic`` ([Sample](https://www.writelatex.com/read/xscbhfpxwkqh)).
|
64
|
+
|
65
|
+
* PDF version from LaTeX ([Sample](https://www.writelatex.com/read/ynhgbrnmtrbw))
|
65
66
|
|
66
67
|
```
|
67
68
|
$ json_resume convert --out=tex_pdf prateek_cv.json
|
@@ -84,30 +85,25 @@ Support for ``en``, ``es`` and ``pt`` right now. Pull requests for others are we
|
|
84
85
|
## Markup Language
|
85
86
|
|
86
87
|
JSON is parsed as per the `markdown` standards. This implies all this works-
|
87
|
-
- \*\* **bold** \*\*,
|
88
|
-
- \_ _italics_ \_,
|
88
|
+
- \*\* **bold** \*\*,
|
89
|
+
- \_ _italics_ \_,
|
89
90
|
- script<sup><sup>sup</sup><sup/>,
|
90
|
-
- script<sub><sub>sub</sub><sub/>,
|
91
|
-
- \[[href](#)\]\(#\),
|
91
|
+
- script<sub><sub>sub</sub><sub/>,
|
92
|
+
- \[[href](#)\]\(#\),
|
92
93
|
- <<[http://github.com](http://github.com)>>
|
93
94
|
|
94
|
-
## FAQs
|
95
|
-
|
96
|
-
* I get the following error during `convert` :
|
97
|
-
|
98
|
-
```
|
99
|
-
Error:
|
100
|
-
Generating the html type...
|
101
|
-
/Users/myMac/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/gems/2.0.0/gems/json-1.8.1/lib/json/common.rb:155:in `encode': "\xE2" on US-ASCII (Encoding::InvalidByteSequenceError)
|
102
|
-
from /Users/abhiramk/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/gems/2.0.0/gems/json-1.8.1/lib/json/common.rb:155:in `initialize'
|
103
|
-
from /Users/abhiramk/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/gems/2.0.0/gems/json-1.8.1/lib/json/common.rb:155:in `new'
|
104
|
-
```
|
105
|
-
|
106
|
-
Looks like locale problem. Add the following to the environment : `export LC_CTYPE=en_US.UTF-8` ( Thanks to [@viswamitra](https://github.com/viswamitra) )
|
107
|
-
|
108
95
|
## Customization
|
109
96
|
|
110
|
-
|
97
|
+
#### Mustache Templates
|
98
|
+
* Output is created using mustache templates. They are located in `templates/`. These can be modified and given as `--template=/path/to/template` to `convert`.
|
99
|
+
|
100
|
+
#### Adding your own icons to json_resume
|
101
|
+
1. Download the svg(s) you would like to use from a site like [IcoMoon](https://icomoon.io/app/) or [IconFinder](https://www.iconfinder.com) and chose size as 16X16.
|
102
|
+
2. Download the official ``json_resume`` svgs from [the json_resume_icon repo zip](https://github.com/NoahHines/json_resume_icons/archive/master.zip). Unzip it, svgs are present in `/SVG`.
|
103
|
+
3. Drag all svgs (including yours) onto the [grumpicon](http://www.grumpicon.com/) and then "downlode it".
|
104
|
+
4. Drag all the files (``.css`` and ``.png``) from the ``grunticon`` folder into your local ``json_resume`` gem's folder ``json_resume-1.X.X/extras/resume_html/public/css/``, replacing existing files ([Read this](http://stackoverflow.com/questions/2827496/where-are-my-ruby-gems) to find your gem's location in your machine).
|
105
|
+
5. Modify your HTML [mustache template](#mustache-templates) to include your icons. Specifically, edit the ``div`` class in the template to include your new grunticon (```<div class="icon-user icon-square">```, where "user" is the SVG name). You can also check grunticon's generated ``preview.html`` file to verify the icon class name.
|
106
|
+
6. Run ``json_resume convert --template=/path/to/template <json>``, and you should be able to see the changes in the generated HTML. Also, steps 1-5 are to be done just once and the icons will be stored within your local gem.
|
111
107
|
|
112
108
|
## Changelog
|
113
109
|
|
data/bin/json_resume
CHANGED
@@ -20,13 +20,15 @@ class JsonResumeCLI < Thor
|
|
20
20
|
desc "convert /path/to/json/file", "converts the json to pretty resume format"
|
21
21
|
option :out, :default=>"html", :banner=>"output_type", :desc=>"html|html_pdf|tex|tex_pdf|md"
|
22
22
|
option :template, :banner=>"template_path", :desc=>"path to customized template (optional)"
|
23
|
-
|
24
|
-
|
23
|
+
option :locale, :default=>"en", :banner=>"locale", :desc=>"en|es|pt"
|
24
|
+
option :theme, :default=>"default", :banner=>"theme", :desc=>"default|classic"
|
25
|
+
option :dest_dir, :default=>"current", :banner=>"dest_dir", :desc=>"location of dest. dir (optional)"
|
25
26
|
def convert(json_input)
|
26
27
|
set_i18n(options[:locale])
|
27
28
|
puts "Generating the #{options[:out]} type..."
|
29
|
+
dest = options[:dest_dir] == 'current'? Dir.pwd : options[:dest_dir]
|
28
30
|
begin
|
29
|
-
puts send('convert_to_'+options[:out], json_input, get_template(options))
|
31
|
+
puts send('convert_to_'+options[:out], json_input, get_template(options), dest)
|
30
32
|
rescue Encoding::InvalidByteSequenceError
|
31
33
|
puts "ERROR: You need to 'export LC_CTYPE=en_US.UTF-8' ...".green
|
32
34
|
end
|
@@ -47,24 +49,24 @@ class JsonResumeCLI < Thor
|
|
47
49
|
@@orig_locn = File.expand_path(File.dirname(__FILE__))
|
48
50
|
|
49
51
|
def get_template(options)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
return options[:template] if options[:template]
|
53
|
+
out_type = options[:out].split('_').first #html for both html, html_pdf
|
54
|
+
out_type = 'html' if out_type == 'pdf'
|
55
|
+
theme = options[:theme]
|
56
|
+
template_path = "#{@@orig_locn}/../templates/#{theme}_#{out_type}.mustache"
|
57
|
+
if !(File.exists? template_path) and theme != 'default'
|
58
|
+
puts "Theme #{theme} doesn't exist for #{options[:out]} type yet! Using default...".red
|
59
|
+
template_path = "#{@@orig_locn}/../templates/default_#{out_type}.mustache"
|
60
|
+
end
|
61
|
+
return template_path
|
60
62
|
end
|
61
63
|
|
62
64
|
def convert_to_html(json_input, template, dest=Dir.pwd, dir_name='resume')
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
dest_dir = "#{dest}/#{dir_name}"
|
66
|
+
FileUtils.mkdir_p dest_dir
|
67
|
+
FileUtils.cp_r(Dir["#{@@orig_locn}/../extras/resume_html/*"], dest_dir)
|
68
|
+
msg = generate_file(json_input, template, "html", "#{dest_dir}/page.html")
|
69
|
+
msg += "\nPlace #{dest_dir}/ in /var/www/ to host."
|
68
70
|
end
|
69
71
|
|
70
72
|
def convert_to_pdf(json_input, template, dest=Dir.pwd)
|
@@ -152,15 +154,15 @@ class JsonResumeCLI < Thor
|
|
152
154
|
generate_file(json_input, template, "markdown", "#{dest}/resume.md")
|
153
155
|
end
|
154
156
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
157
|
+
def set_i18n(locale)
|
158
|
+
I18n.load_path = Dir["#{@@orig_locn}/../locale/*.yml"]
|
159
|
+
I18n.enforce_available_locales = true
|
160
|
+
I18n.locale = options[:locale].to_sym
|
161
|
+
end
|
160
162
|
|
161
|
-
|
162
|
-
|
163
|
-
|
163
|
+
def i18n(text)
|
164
|
+
text.gsub(/##(\w*?)##/) { I18n.t! Regexp.last_match[1], :scope => 'headings' }
|
165
|
+
end
|
164
166
|
|
165
167
|
def generate_file(json_input, template, output_type, dest)
|
166
168
|
resume_obj = JsonResume.new(json_input, "output_type" => output_type)
|
@@ -1,2 +1,2 @@
|
|
1
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" ] );
|
2
|
+
grunticon( [ "public/css/icons.data.svg.css", "public/css/icons.data.png.css", "public/css/icons.fallback.css" ] );
|
@@ -14,7 +14,7 @@ module JsonResume
|
|
14
14
|
@hash = hash
|
15
15
|
|
16
16
|
#recursively defined proc
|
17
|
-
@hash_proc = Proc.new do |k,v|
|
17
|
+
@hash_proc = Proc.new do |k,v|
|
18
18
|
v = k if v.nil? #hack to make it common for hash and array
|
19
19
|
v.delete_if(&@hash_proc) if [Hash,Array].any? { |x| v.instance_of? x }
|
20
20
|
v.empty?
|
@@ -39,7 +39,7 @@ module JsonResume
|
|
39
39
|
return if @hash['bio_data']['skills'].nil?
|
40
40
|
@hash['bio_data']['skills']['details'].each do |item|
|
41
41
|
item['items'].map!{|x| {'name'=>x} }
|
42
|
-
item['items'][-1]['last'] = true
|
42
|
+
item['items'][-1]['last'] = true
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -67,7 +67,7 @@ module JsonResume
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def format_to_output_type
|
70
|
-
format_proc = Proc.new do |k,v|
|
70
|
+
format_proc = Proc.new do |k,v|
|
71
71
|
v = k if v.nil?
|
72
72
|
v.each{|x| format_proc.call(x)} if [Hash,Array].any? {|x| v.instance_of? x}
|
73
73
|
format_string v if v.instance_of? String
|
@@ -86,13 +86,13 @@ module JsonResume
|
|
86
86
|
|
87
87
|
def purge_gpa
|
88
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?}
|
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
90
|
end
|
91
91
|
|
92
92
|
def add_padding(course)
|
93
93
|
unless @hash["bio_data"].nil? || @hash["bio_data"][course].nil?
|
94
94
|
course_hash = @hash["bio_data"][course]
|
95
|
-
course_hash << {} if course_hash.size % 2 == 1
|
95
|
+
course_hash << {} if course_hash.size % 2 == 1
|
96
96
|
@hash["bio_data"][course] = {
|
97
97
|
"rows" => course_hash.each_slice(2).to_a.map{ |i| { "columns" => i } }
|
98
98
|
}
|
@@ -104,7 +104,7 @@ module JsonResume
|
|
104
104
|
|
105
105
|
cleanse
|
106
106
|
|
107
|
-
format_to_output_type
|
107
|
+
format_to_output_type
|
108
108
|
|
109
109
|
add_last_marker_on_stars
|
110
110
|
|
@@ -118,7 +118,7 @@ module JsonResume
|
|
118
118
|
add_linkedin_github_url
|
119
119
|
|
120
120
|
#make odd listed courses to even
|
121
|
-
["grad_courses", "undergrad_courses"].each do |course|
|
121
|
+
["grad_courses", "undergrad_courses"].each do |course|
|
122
122
|
add_padding(course)
|
123
123
|
end
|
124
124
|
|
@@ -127,5 +127,4 @@ module JsonResume
|
|
127
127
|
|
128
128
|
|
129
129
|
end
|
130
|
-
end
|
131
|
-
|
130
|
+
end
|
@@ -3,16 +3,16 @@ require_relative 'formatter'
|
|
3
3
|
module JsonResume
|
4
4
|
class FormatterHtml < Formatter
|
5
5
|
def format_link str
|
6
|
-
str.gsub!
|
6
|
+
str.gsub!(/\[(.*?)\]\((.*?)\)/, '<a href="\2">\1</a>')
|
7
7
|
end
|
8
8
|
|
9
9
|
def format_autolink str
|
10
|
-
str.gsub!
|
10
|
+
str.gsub!(/<<(\S*?)>>/, '<a href="\1">\1</a>')
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def format_emphasis str
|
14
|
-
str.gsub!
|
15
|
-
str.gsub!
|
14
|
+
str.gsub!(/\b_(.+?)_\b/, '<i>\1</i>')
|
15
|
+
str.gsub!(/\*\*(.+?)\*\*/, '<b>\1</b>')
|
16
16
|
end
|
17
17
|
|
18
18
|
def format_string str
|
@@ -23,10 +23,9 @@ module JsonResume
|
|
23
23
|
|
24
24
|
def format
|
25
25
|
super
|
26
|
-
|
26
|
+
|
27
27
|
return self
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
@@ -3,41 +3,41 @@ require_relative 'formatter'
|
|
3
3
|
module JsonResume
|
4
4
|
class FormatterLatex < Formatter
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
def format_slashes str
|
7
|
+
str.gsub!(/\\/, '\textbackslash')
|
8
|
+
str.gsub!(/\{/, '\{')
|
9
|
+
str.gsub!(/\}/, '\}')
|
10
|
+
end
|
11
11
|
|
12
12
|
def format_link str
|
13
|
-
str.gsub!
|
13
|
+
str.gsub!(/\[(.*?)\]\((.*?)\)/, '{\color{see} \href{\2}{\1}}')
|
14
14
|
end
|
15
15
|
|
16
16
|
def format_autolink str
|
17
|
-
str.gsub!
|
17
|
+
str.gsub!(/<<(\S*?)>>/, '{\color{see} \url{\1}}')
|
18
18
|
end
|
19
19
|
|
20
20
|
def format_emphasis str
|
21
|
-
str.gsub!
|
22
|
-
str.gsub!
|
21
|
+
str.gsub!(/\b_(.+?)_\b/, '\textit{\1}')
|
22
|
+
str.gsub!(/\*\*(.+?)\*\*/, '\textbf{\1}')
|
23
23
|
end
|
24
24
|
|
25
25
|
def format_superscripts str
|
26
|
-
str.gsub!
|
27
|
-
str.gsub!
|
26
|
+
str.gsub!(/<sup>(.*?)<\/sup>/, '$^{\1}$')
|
27
|
+
str.gsub!(/<sub>(.*?)<\/sub>/, '$_{\1}$')
|
28
28
|
end
|
29
29
|
|
30
30
|
def format_symbols str
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
str.gsub!
|
36
|
-
str.gsub!
|
31
|
+
str.gsub!(/#/, '\#')
|
32
|
+
str.gsub!(/\$/, '\$')
|
33
|
+
str.gsub!(/&/, '\\\\&')
|
34
|
+
str.gsub!(/\|/, '\textbar')
|
35
|
+
str.gsub!(/%/, '\%')
|
36
|
+
str.gsub!(/_/, '\_')
|
37
37
|
end
|
38
38
|
|
39
39
|
def format_string str
|
40
|
-
|
40
|
+
format_slashes str
|
41
41
|
format_link str
|
42
42
|
format_autolink str
|
43
43
|
format_emphasis str
|
@@ -52,5 +52,3 @@ module JsonResume
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
56
|
-
|
@@ -3,19 +3,18 @@ require_relative 'formatter'
|
|
3
3
|
module JsonResume
|
4
4
|
class FormatterMd < Formatter
|
5
5
|
def format_autolink str
|
6
|
-
str.gsub!
|
6
|
+
str.gsub!(/<<(\S*?)>>/, '[\1](\1)')
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def format_string str
|
10
10
|
format_autolink str
|
11
11
|
end
|
12
12
|
|
13
13
|
def format
|
14
14
|
super
|
15
|
-
|
15
|
+
|
16
16
|
return self
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
data/lib/json_resume/reader.rb
CHANGED
@@ -11,8 +11,8 @@ module JsonResume
|
|
11
11
|
def initialize(json_input, options)
|
12
12
|
output_type = options[:output_type] || "html" #default html, others latex, md
|
13
13
|
@json_string = case json_input
|
14
|
-
when /\.json$/i then File.read(json_input)
|
15
14
|
when /^(http|https|www)/ then RestClient.get(json_input)
|
15
|
+
when /\.json$/i then File.read(json_input)
|
16
16
|
else json_input
|
17
17
|
end
|
18
18
|
@output_type = output_type
|
@@ -33,5 +33,4 @@ module JsonResume
|
|
33
33
|
@hash = formatters[type].new(@hash).format.hash
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end
|
37
|
-
|
36
|
+
end
|
data/lib/json_resume/version.rb
CHANGED
@@ -6,8 +6,8 @@ describe "#padder" do
|
|
6
6
|
it 'pads a row if items are odd' do
|
7
7
|
hash = {'bio_data' => {'test' => [
|
8
8
|
{'name'=>'sub1', 'url' => 'url1'},
|
9
|
-
{'name'=>'sub2', 'url' => 'url2'},
|
10
|
-
{'name'=>'sub3', 'url' => 'url3'}
|
9
|
+
{'name'=>'sub2', 'url' => 'url2'},
|
10
|
+
{'name'=>'sub3', 'url' => 'url3'}
|
11
11
|
]}
|
12
12
|
}
|
13
13
|
formatter = JsonResume::FormatterHtml.new hash
|
@@ -34,28 +34,28 @@ describe "#padder" do
|
|
34
34
|
formatter.add_padding('test')
|
35
35
|
expect(formatter.hash['bio_data']).to eq({})
|
36
36
|
end
|
37
|
-
end
|
37
|
+
end
|
38
38
|
|
39
39
|
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
43
|
str = "test [Hello](http://google.com)"
|
44
|
-
formatter.format_link str
|
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
50
|
str = "test <<http://google.com>>"
|
51
|
-
formatter.format_autolink str
|
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
57
|
str = "test <<http://google.com>> [Hello](http://google.com) <<http://google.com>>"
|
58
|
-
formatter.format_string str
|
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
|
@@ -91,5 +91,3 @@ describe "#format" do
|
|
91
91
|
formatter.format
|
92
92
|
end
|
93
93
|
end
|
94
|
-
|
95
|
-
|
@@ -6,21 +6,21 @@ describe '#urlformatter' do
|
|
6
6
|
it 'converts link to href' do
|
7
7
|
formatter = JsonResume::FormatterLatex.new({})
|
8
8
|
str = "test [Hello](http://google.com)"
|
9
|
-
formatter.format_link str
|
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
15
|
str = "test <<http://google.com>>"
|
16
|
-
formatter.format_autolink str
|
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
22
|
str = "test <<http://google.com>> [Hello](http://google.com) <<http://google.com>>"
|
23
|
-
formatter.format_string str
|
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
|
@@ -48,4 +48,3 @@ describe "#emphasis_formatting" do
|
|
48
48
|
expect(str).to eq('Last word should \textit{be \textbf{bold and italicized}}')
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
@@ -20,7 +20,7 @@ end
|
|
20
20
|
describe "#format_to_output_type" do
|
21
21
|
it 'should make format calls to all valid strings' do
|
22
22
|
hash = {"key1"=> "non-empty", "key2" => {"key3" => ["test [Hello]{http://google.com}"]}}
|
23
|
-
formatter = JsonResume::Formatter.new hash
|
23
|
+
formatter = JsonResume::Formatter.new hash
|
24
24
|
expect(formatter).to receive(:format_string).with("non-empty")
|
25
25
|
expect(formatter).to receive(:format_string).with("test [Hello]{http://google.com}")
|
26
26
|
formatter.format_to_output_type
|
@@ -30,18 +30,18 @@ end
|
|
30
30
|
describe "#add_linkedin_github_url" do
|
31
31
|
it 'creates linkedin url if id present' do
|
32
32
|
hash = {"linkedin_id"=>"xyz"}
|
33
|
-
formatter = JsonResume::Formatter.new hash
|
33
|
+
formatter = JsonResume::Formatter.new hash
|
34
34
|
formatter.add_linkedin_github_url
|
35
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
39
|
hash = {"github_id"=>"xyz"}
|
40
|
-
formatter = JsonResume::Formatter.new hash
|
40
|
+
formatter = JsonResume::Formatter.new hash
|
41
41
|
formatter.add_linkedin_github_url
|
42
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
|
data/spec/spec_helper.rb
CHANGED
@@ -17,15 +17,15 @@
|
|
17
17
|
</div>
|
18
18
|
</div>
|
19
19
|
|
20
|
-
<h1 class="emphnext">{{firstname}} {{familyname}}</h1
|
20
|
+
<h1 class="emphnext">{{firstname}} {{familyname}}</h1>
|
21
21
|
{{#stars}}
|
22
|
-
<span class="stars">
|
22
|
+
<span class="stars" style="clear:left">
|
23
23
|
{{#items}}
|
24
24
|
{{name}} {{^last}}<div class="icon-star-o icon-star"></div>{{/last}}
|
25
25
|
{{/items}}
|
26
26
|
</span>
|
27
27
|
{{/stars}}
|
28
|
-
<br/>
|
28
|
+
<br/><br/>
|
29
29
|
|
30
30
|
{{#summary}}
|
31
31
|
<h2><div class="icon-user icon-square"></div> ##summary##</h2>
|
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.3
|
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-08
|
11
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|