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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 031a4dc86e72946d0fb8673b77738a6cbb3d30c2404c028267a88a78b8ae1463
4
- data.tar.gz: b2ac4623552d0ae8f597f8dd58cb9bcb481b09f201ff899335054767cfcd1620
3
+ metadata.gz: 04b56bee3c092687375a967a44f81464be5f0b34fa3a453499fb4b3ac22fda06
4
+ data.tar.gz: dcaccb9a74c42cf24267201ddd6e95b17c434cbfb955fb8479ec3e88d76f5fab
5
5
  SHA512:
6
- metadata.gz: bcd26c3ab542f8b2ddf18dc894351bab8c1332181609164b47e2b79ef433d83ec6298509844f20907ee91caf1a6aceea43f451e76567dd48afc457fedd74f889
7
- data.tar.gz: d38f99b4d9fab6a4c700628282ef21cc125590d8e4a4a1ab48ad625c5ebbed132cc1c89cc1b1b5cbf306c13bf503d4fa780d0c637c425388d8c0728345706c0f
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: 22,
15
+ header_size: 20,
16
16
  section_font: "Inter",
17
- section_size: 12,
17
+ section_size: 11,
18
18
  body_font: "Lora",
19
- body_size: 10,
20
- page_options: { margin: 36 },
19
+ body_size: 9,
20
+ page_options: { margin: 30 },
21
21
  accent_color: "1F7AE0" # blue
22
22
  )
23
23
 
Binary file
@@ -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
- normal: File.join(fonts_dir, "Inter-Regular.ttf"),
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 12
62
+ pdf.move_down 4
56
63
  pdf.font(@style.body_font)
57
64
  contact = @parsed_cv[:contact] || {}
58
- contact.each_key do |key|
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(contact[key])}", inline_format: true)
69
+ pdf.icon("#{icon} #{Inline.parse(value)}", inline_format: true)
61
70
  end
62
71
 
63
- pdf.move_down 6
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 10
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 10
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 8
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 6
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 4
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 4
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)
@@ -1,3 +1,3 @@
1
1
  module MyLastCV
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
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