my-last-cv 0.0.8 → 0.0.9
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 +8 -3
- data/exe/my_last_cv +4 -4
- data/fonts/Inter-Italic.ttf +0 -0
- data/lib/my_last_cv/renderer.rb +44 -21
- data/lib/my_last_cv/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04b56bee3c092687375a967a44f81464be5f0b34fa3a453499fb4b3ac22fda06
|
|
4
|
+
data.tar.gz: dcaccb9a74c42cf24267201ddd6e95b17c434cbfb955fb8479ec3e88d76f5fab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba6f2f816174ee03ed4f417caca9e65b8cfeec6c684b29166f687d8ca7ac0e8a090026d7f1cafc68fdac27a42cf934126fc339b3efef8e83920d5fdac7b8fd7f
|
|
7
|
+
data.tar.gz: b514c0f500dec9398744f3185295ee350d4deaf9b647a789a9f0f893d9c729716d8235c2c706571bab428785d31a0150f729582f94a8cba2c7354aadff9fed38
|
data/README.md
CHANGED
|
@@ -27,6 +27,7 @@ bundle exec my_last_cv path/to/cv.md output/cv.pdf
|
|
|
27
27
|
|
|
28
28
|
The output directory is created automatically. The CLI uses the bundled Inter and
|
|
29
29
|
Lora fonts. Start from [`sample/cv.md`](sample/cv.md) to create your document.
|
|
30
|
+
Its compact layout is designed to fit typical CVs on a single page.
|
|
30
31
|
|
|
31
32
|
## Markdown format
|
|
32
33
|
|
|
@@ -60,7 +61,9 @@ Introductory paragraph for this role.
|
|
|
60
61
|
```
|
|
61
62
|
|
|
62
63
|
Supported front-matter contact keys are `name`, `title`, `email`, `phone`,
|
|
63
|
-
`linkedin`, `github`, `website`, and `location`. They are rendered with icons
|
|
64
|
+
`linkedin`, `github`, `website`, and `location`. They are rendered with icons;
|
|
65
|
+
`name` and `title` are omitted from the contact list when they duplicate the
|
|
66
|
+
document heading or introduction.
|
|
64
67
|
|
|
65
68
|
Text immediately below the main heading becomes the introduction. Section and
|
|
66
69
|
entry content can contain paragraphs and bullet lists. A `###` entry without a
|
|
@@ -68,7 +71,7 @@ preceding `##` section is placed in a section named `Divers`.
|
|
|
68
71
|
|
|
69
72
|
## Inline Markdown support
|
|
70
73
|
|
|
71
|
-
Contact fields, paragraphs, and bullet items support:
|
|
74
|
+
Contact fields, headings, paragraphs, and bullet items support:
|
|
72
75
|
|
|
73
76
|
- `**bold**`
|
|
74
77
|
- `*italic*`
|
|
@@ -106,7 +109,9 @@ also be supplied.
|
|
|
106
109
|
|
|
107
110
|
Inter and Lora are bundled with the gem. To override them, provide a directory
|
|
108
111
|
containing `Inter-Regular.ttf`, `Inter-Bold.ttf`, `Lora-Regular.ttf`, and
|
|
109
|
-
`Lora-Bold.ttf
|
|
112
|
+
`Lora-Bold.ttf`. Optional `Inter-Italic.ttf`, `Inter-BoldItalic.ttf`,
|
|
113
|
+
`Lora-Italic.ttf`, and `Lora-BoldItalic.ttf` files enable matching italic
|
|
114
|
+
styles; missing variants fall back to their regular or bold face.
|
|
110
115
|
|
|
111
116
|
```ruby
|
|
112
117
|
MyLastCV::Style.new(fonts_dir: "/path/to/fonts")
|
data/exe/my_last_cv
CHANGED
|
@@ -12,12 +12,12 @@ input, output = ARGV
|
|
|
12
12
|
|
|
13
13
|
pro = MyLastCV::Style.new(
|
|
14
14
|
header_font: "Inter",
|
|
15
|
-
header_size:
|
|
15
|
+
header_size: 20,
|
|
16
16
|
section_font: "Inter",
|
|
17
|
-
section_size:
|
|
17
|
+
section_size: 11,
|
|
18
18
|
body_font: "Lora",
|
|
19
|
-
body_size:
|
|
20
|
-
page_options: { margin:
|
|
19
|
+
body_size: 9,
|
|
20
|
+
page_options: { margin: 30 },
|
|
21
21
|
accent_color: "1F7AE0" # blue
|
|
22
22
|
)
|
|
23
23
|
|
|
Binary file
|
data/lib/my_last_cv/renderer.rb
CHANGED
|
@@ -38,29 +38,38 @@ module MyLastCV
|
|
|
38
38
|
fonts_dir = resolved_fonts_dir
|
|
39
39
|
return unless fonts_dir
|
|
40
40
|
|
|
41
|
-
# Example : Inter (Regular / Bold)
|
|
42
41
|
pdf.font_families.update(
|
|
43
|
-
"Inter" =>
|
|
44
|
-
|
|
45
|
-
bold: File.join(fonts_dir, "Inter-Bold.ttf")
|
|
46
|
-
},
|
|
47
|
-
"Lora" => {
|
|
48
|
-
normal: File.join(fonts_dir, "Lora-Regular.ttf"),
|
|
49
|
-
bold: File.join(fonts_dir, "Lora-Bold.ttf")
|
|
50
|
-
}
|
|
42
|
+
"Inter" => font_family_files(fonts_dir, "Inter"),
|
|
43
|
+
"Lora" => font_family_files(fonts_dir, "Lora")
|
|
51
44
|
)
|
|
52
45
|
end
|
|
53
46
|
|
|
47
|
+
def font_family_files(fonts_dir, family)
|
|
48
|
+
regular = File.join(fonts_dir, "#{family}-Regular.ttf")
|
|
49
|
+
bold = File.join(fonts_dir, "#{family}-Bold.ttf")
|
|
50
|
+
italic = File.join(fonts_dir, "#{family}-Italic.ttf")
|
|
51
|
+
bold_italic = File.join(fonts_dir, "#{family}-BoldItalic.ttf")
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
normal: regular,
|
|
55
|
+
bold: bold,
|
|
56
|
+
italic: File.file?(italic) ? italic : regular,
|
|
57
|
+
bold_italic: File.file?(bold_italic) ? bold_italic : bold
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
54
61
|
def render_header(pdf)
|
|
55
|
-
pdf.move_down
|
|
62
|
+
pdf.move_down 4
|
|
56
63
|
pdf.font(@style.body_font)
|
|
57
64
|
contact = @parsed_cv[:contact] || {}
|
|
58
|
-
contact.
|
|
65
|
+
contact.each do |key, value|
|
|
66
|
+
next if redundant_contact_field?(key, value)
|
|
67
|
+
|
|
59
68
|
icon = "<icon size=\"#{@style.body_size}\">#{MyLastCV::Icons::MAP[key.to_sym]}</icon>"
|
|
60
|
-
pdf.icon("#{icon} #{Inline.parse(
|
|
69
|
+
pdf.icon("#{icon} #{Inline.parse(value)}", inline_format: true)
|
|
61
70
|
end
|
|
62
71
|
|
|
63
|
-
pdf.move_down
|
|
72
|
+
pdf.move_down 2
|
|
64
73
|
pdf.font(@style.header_font)
|
|
65
74
|
with_color(pdf, @style.accent_color) do
|
|
66
75
|
pdf.text(@parsed_cv[:title] || '-', size: @style.header_size, align: :center)
|
|
@@ -71,29 +80,43 @@ module MyLastCV
|
|
|
71
80
|
pdf.stroke_horizontal_rule
|
|
72
81
|
|
|
73
82
|
if @parsed_cv[:intro]&.any?
|
|
74
|
-
pdf.move_down
|
|
83
|
+
pdf.move_down 4
|
|
75
84
|
@parsed_cv[:intro].each do |p|
|
|
76
85
|
pdf.text(Inline.parse(p), size: @style.body_size, leading: 2, inline_format: true)
|
|
77
86
|
end
|
|
78
87
|
end
|
|
79
|
-
pdf.move_down
|
|
88
|
+
pdf.move_down 4
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def redundant_contact_field?(key, value)
|
|
92
|
+
case key
|
|
93
|
+
when "name"
|
|
94
|
+
value.to_s.strip.casecmp?(@parsed_cv[:title].to_s.strip)
|
|
95
|
+
when "title"
|
|
96
|
+
title = value.to_s.strip
|
|
97
|
+
Array(@parsed_cv[:intro]).any? do |paragraph|
|
|
98
|
+
paragraph.to_s.sub(/\A\*+/, "").start_with?(title)
|
|
99
|
+
end
|
|
100
|
+
else
|
|
101
|
+
false
|
|
102
|
+
end
|
|
80
103
|
end
|
|
81
104
|
|
|
82
105
|
def render_sections(pdf)
|
|
83
106
|
(@parsed_cv[:sections] || []).each do |section|
|
|
84
|
-
pdf.move_down
|
|
107
|
+
pdf.move_down 4
|
|
85
108
|
pdf.font(@style.section_font)
|
|
86
109
|
|
|
87
110
|
with_color(pdf, @style.accent_color) do
|
|
88
|
-
pdf.text(section[:title], size: @style.section_size, style: :bold)
|
|
111
|
+
pdf.text(Inline.parse(section[:title]), size: @style.section_size, style: :bold, inline_format: true)
|
|
89
112
|
end
|
|
90
113
|
|
|
91
114
|
render_items(pdf, section[:items])
|
|
92
115
|
|
|
93
116
|
(section[:elements] || []).each do |el|
|
|
94
|
-
pdf.move_down
|
|
117
|
+
pdf.move_down 3
|
|
95
118
|
pdf.font(@style.section_font)
|
|
96
|
-
pdf.text(el[:title], size: (@style.section_size - 3), style: :bold)
|
|
119
|
+
pdf.text(Inline.parse(el[:title]), size: (@style.section_size - 3), style: :bold, inline_format: true)
|
|
97
120
|
render_items(pdf, el[:items])
|
|
98
121
|
end
|
|
99
122
|
end
|
|
@@ -102,7 +125,7 @@ module MyLastCV
|
|
|
102
125
|
def render_items(pdf, items)
|
|
103
126
|
return if items.nil? || items.empty?
|
|
104
127
|
|
|
105
|
-
pdf.move_down
|
|
128
|
+
pdf.move_down 1
|
|
106
129
|
pdf.font(@style.body_font)
|
|
107
130
|
|
|
108
131
|
(items || []).each do |item|
|
|
@@ -111,7 +134,7 @@ module MyLastCV
|
|
|
111
134
|
pdf.text("• #{Inline.parse(item[:text])}", size: @style.body_size, indent_paragraphs: 16, inline_format: true)
|
|
112
135
|
when :paragraph
|
|
113
136
|
pdf.text(Inline.parse(item[:text]), size: @style.body_size, leading: 2, inline_format: true)
|
|
114
|
-
pdf.move_down
|
|
137
|
+
pdf.move_down 1
|
|
115
138
|
else
|
|
116
139
|
# fallback (au cas où)
|
|
117
140
|
pdf.text(item.to_s, size: @style.body_size)
|
data/lib/my_last_cv/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: my-last-cv
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maxime Hanicotte
|
|
@@ -77,6 +77,7 @@ files:
|
|
|
77
77
|
- README.md
|
|
78
78
|
- exe/my_last_cv
|
|
79
79
|
- fonts/Inter-Bold.ttf
|
|
80
|
+
- fonts/Inter-Italic.ttf
|
|
80
81
|
- fonts/Inter-Regular.ttf
|
|
81
82
|
- fonts/Lora-Bold.ttf
|
|
82
83
|
- fonts/Lora-Regular.ttf
|