m1key_gallery_generator 0.3.9 → 0.3.10

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: adc553b9cc6d516831f8013922a725efec39124c421eab37b26657da3353dd6a
4
- data.tar.gz: 6c0391edc647d872df0d877b9071678f324b35ec52f267d01dd8a7a8c3902dcb
3
+ metadata.gz: 9a05edfc5a9ca0d7c63469789151df09ad2e0b25361906e2ce65029e356cdf15
4
+ data.tar.gz: d61e9e6d030bcc057875952485eaddd87e939a2d3a2081d56137d4789f65ecbb
5
5
  SHA512:
6
- metadata.gz: 6fe8d82b5187d4511a773aad9c153603838caadfb5e572b79766e7ee3ff38b4130aa4eeb75e38e0c7685e89e98ff6169b6f50aca996191caf89bb348297d02b1
7
- data.tar.gz: aa17a99e8ec793d444e7557c36cc995c24f00e1b5c7874ff0cf73447d5997b1d6ce30f8b89ed438a7bb69a842f8d7708f108c0110dc42038b96cdd4c48fd91d0
6
+ metadata.gz: f9315fd151a474dfcb8e210c848b9f07bb5246ec546fb60ea0e3e1531f6104351b8c2b7a68f89689d86295d016af364797ed29105fccfccf5b5fd39dc821d9d7
7
+ data.tar.gz: 0f74dd1dfb2e798d657d81e40464db66081d39bdc77decf36dab6c08c43bd680316711155757af1350f92dd39010f6927a2d34f8a0357b47661416925b969aea
data/README.md CHANGED
@@ -74,11 +74,11 @@ Build the gem.
74
74
 
75
75
  Install the gem.
76
76
 
77
- > gem install m1key_gallery_generator-0.3.9.gem
77
+ > gem install m1key_gallery_generator-0.3.10.gem
78
78
 
79
79
  In your gallery directory, have a file called generate.bat that looks like this:
80
80
 
81
- > ruby c:\Ruby34-x64\lib\ruby\gems\3.4.0\gems\m1key_gallery_generator-0.3.9\bin\console . wait_on_error
81
+ > ruby c:\Ruby34-x64\lib\ruby\gems\3.4.0\gems\m1key_gallery_generator-0.3.10\bin\console . wait_on_error
82
82
 
83
83
  ## Development
84
84
 
@@ -95,7 +95,7 @@ To build gem:
95
95
  > gem build m1key_gallery_generator.gemspec
96
96
 
97
97
  To install gem:
98
- > gem install m1key_gallery_generator-0.3.9.gem
98
+ > gem install m1key_gallery_generator-0.3.10.gem
99
99
 
100
100
  To test gem:
101
101
  > irb
data/bin/console CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'm1key_gallery_generator'
4
4
  require 'erb'
5
+ require 'htmlentities'
5
6
 
6
7
  Encoding.default_external = Encoding::UTF_8
7
8
 
@@ -31,7 +32,7 @@ begin
31
32
 
32
33
  gallery = ViewableGallery.new(gallery_config.title, gallery_config.description, gallery_config.slug,
33
34
  gallery_config.sources, gallery_config.upload_date, gallery_config.map_url, gallery_config.map_title,
34
- gallery_config.year, viewable_photos, gallery_config.small_print, gallery_config.blurb).
35
+ gallery_config.year, viewable_photos, gallery_config.small_print, gallery_config.blurb, gallery_config.genre).
35
36
  update_using(
36
37
  add_tabs_before_every_description_line(3),
37
38
  add_links_to_descriptions,
@@ -5,7 +5,7 @@ require_relative 'console_utils'
5
5
  module GalleryGenerator
6
6
  class GalleryConfig
7
7
 
8
- attr_reader :title, :map_url, :map_title, :slug, :upload_date, :description, :sources, :year, :photos, :small_print, :blurb
8
+ attr_reader :title, :map_url, :map_title, :slug, :upload_date, :description, :sources, :year, :photos, :small_print, :blurb, :genre
9
9
 
10
10
  def initialize(yaml_config_file_name)
11
11
  puts "Attempting to parse #{yaml_config_file_name} to read gallery configuration..."
@@ -28,7 +28,13 @@ module GalleryGenerator
28
28
  @small_print = gallery_configuration['small_print']
29
29
  puts "Small print is [#{@small_print}]."
30
30
  @blurb = gallery_configuration['blurb']
31
- puts "Gallery description is [#{compact(@blurb)}]."
31
+ puts "Gallery blurb is [#{compact(@blurb)}]."
32
+ if gallery_configuration['genre'] == nil
33
+ @genre = 'photography'
34
+ else
35
+ @genre = gallery_configuration['genre']
36
+ end
37
+ puts "Gallery genre is [#{compact(@genre)}]."
32
38
 
33
39
  @sources = gallery_configuration['sources']
34
40
 
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width,initial-scale=1" />
7
7
  <title><%= title %> &mdash; Photography and Art Portfolio by Michal Huniewicz</title>
8
8
  <meta name="description" content="<%= blurb %>" />
9
- <link rel="canonical" href="https://www.m1key.me/photography/<%= slug %>" />
9
+ <link rel="canonical" href="https://www.m1key.me/<%= genre %>/<%= slug %>" />
10
10
  <link rel="preconnect" href="https://fonts.googleapis.com" />
11
11
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
12
12
  <link rel="dns-prefetch" href="https://fonts.googleapis.com" />
@@ -23,14 +23,14 @@
23
23
  <meta property="og:type" content="website" />
24
24
  <meta property="og:title" content="<%= title %> by Michal Huniewicz" />
25
25
  <meta property="og:description" content="<%= blurb %>" />
26
- <meta property="og:url" content="https://www.m1key.me/photography/<%= slug %>" />
27
- <meta property="og:image" content="https://www.m1key.me/photography/<%= slug %>/<%= slug %>_01.jpg" />
26
+ <meta property="og:url" content="https://www.m1key.me/<%= genre %>/<%= slug %>" />
27
+ <meta property="og:image" content="https://www.m1key.me/<%= genre %>/<%= slug %>/<%= slug %>_01.jpg" />
28
28
  <meta property="og:image:alt" content="<%= title %> by Michal Huniewicz" />
29
29
 
30
30
  <meta name="twitter:card" content="summary_large_image" />
31
31
  <meta name="twitter:title" content="<%= title %> by Michal Huniewicz" />
32
32
  <meta name="twitter:description" content="<%= blurb %>" />
33
- <meta name="twitter:image" content="https://www.m1key.me/photography/<%= slug %>/<%= slug %>_01.jpg" />
33
+ <meta name="twitter:image" content="https://www.m1key.me/<%= genre %>/<%= slug %>/<%= slug %>_01.jpg" />
34
34
 
35
35
  <!-- Breadcrumb structured data for SEO -->
36
36
  <script type="application/ld+json">
@@ -38,7 +38,7 @@
38
38
  "@context": "https://schema.org",
39
39
  "@type": "ImageGallery",
40
40
  "name": "<%= title %> by Michal Huniewicz",
41
- "url": "https://www.m1key.me/photography/<%= slug %>",
41
+ "url": "https://www.m1key.me/<%= genre %>/<%= slug %>",
42
42
  "datePublished": "<%= upload_date %>",
43
43
  "dateModified": "<%= upload_date %>",
44
44
  "author": {
@@ -52,9 +52,9 @@
52
52
  },
53
53
  "image": [<% photos.each_with_index do |photo, index| %>
54
54
  {
55
- "@type": "ImageObject",
56
- "contentUrl" : "https://www.m1key.me/photography/<%= slug %>/<%= slug %>_<%= photo.id %>.jpg",
57
- "caption": "<%= photo.title %>",
55
+ "@type": "ImageObject",
56
+ "contentUrl" : "https://www.m1key.me/<%= genre %>/<%= slug %>/<%= slug %>_<%= photo.id %>.jpg",
57
+ "caption": "<%= HTMLEntities.new.decode(photo.title) %>",
58
58
  "width": <%= photo.metadata.width %>,
59
59
  "height": <%= photo.metadata.height %>
60
60
  }<% if (index + 1) == photos.size %><% else %>,<% end -%>
@@ -79,14 +79,14 @@
79
79
  {
80
80
  "@type": "ListItem",
81
81
  "position": 2,
82
- "name": "Photography",
83
- "item": "https://www.m1key.me/photography/"
82
+ "name": "<%= genre.capitalize %>",
83
+ "item": "https://www.m1key.me/<%= genre %>/"
84
84
  },
85
85
  {
86
86
  "@type": "ListItem",
87
87
  "position": 3,
88
- "name": "<%= title %>",
89
- "item": "https://www.m1key.me/photography/<%= slug %>"
88
+ "name": "<%= HTMLEntities.new.decode(title) %>",
89
+ "item": "https://www.m1key.me/<%= genre %>/<%= slug %>"
90
90
  }
91
91
  ]
92
92
  }
@@ -98,7 +98,7 @@
98
98
  <main class="bigger-container">
99
99
  <nav class="navigation" aria-label="Gallery navigation">
100
100
  <ul>
101
- <li><a href="../" class="nav-link">&lt; Back to Photography</a></li>
101
+ <li><a href="../" class="nav-link">&lt; Back to <%= genre.capitalize %></a></li>
102
102
  <li><a href="../../" class="nav-link">&lt;&lt; Back to M1key.me</a></li>
103
103
  </ul>
104
104
  </nav>
@@ -133,7 +133,7 @@
133
133
  width="<%= photo.metadata.width %>" height="<%= photo.metadata.height %>" />
134
134
  <figcaption>
135
135
  <span class="description"><%= photo.description %></span>
136
- <span class="technical">ISO <%= photo.metadata.iso %>, <%= photo.metadata.focal_length %>mm, f/<%= photo.metadata.f_number %>, <%= photo.metadata.exposure_time %>s.<% if photo.technical_info.to_s != '' %> <%= photo.technical_info %><% end %></span>
136
+ <% if photo.metadata.iso.to_s != '' %><span class="technical">ISO <%= photo.metadata.iso %>, <%= photo.metadata.focal_length %>mm, f/<%= photo.metadata.f_number %>, <%= photo.metadata.exposure_time %>s.<% if photo.technical_info.to_s != '' %> <%= photo.technical_info %><% end %></span><% end %>
137
137
  </figcaption>
138
138
  </figure>
139
139
  </article>
@@ -147,7 +147,7 @@
147
147
 
148
148
  <nav class="navigation" aria-label="Gallery navigation bottom">
149
149
  <ul>
150
- <li><a href="../" class="nav-link">&lt; Back to Photography</a></li>
150
+ <li><a href="../" class="nav-link">&lt; Back to <%= genre.capitalize %></a></li>
151
151
  <li><a href="../../" class="nav-link">&lt;&lt; Back to M1key.me</a></li>
152
152
  </ul>
153
153
  </nav>
@@ -1,3 +1,3 @@
1
1
  module M1keyGalleryGenerator
2
- VERSION = '0.3.9'
2
+ VERSION = '0.3.10'
3
3
  end
@@ -2,8 +2,8 @@ require_relative 'string_utils'
2
2
 
3
3
  module GalleryGenerator
4
4
  class ViewableGallery
5
- attr_reader :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb
6
- def initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print, blurb)
5
+ attr_reader :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb, :genre
6
+ def initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print, blurb, genre)
7
7
  @title = String.new(title)
8
8
  @description = description
9
9
  @slug = slug
@@ -15,6 +15,7 @@ module GalleryGenerator
15
15
  @photos = viewable_photos
16
16
  @small_print = small_print
17
17
  @blurb = blurb
18
+ @genre = genre
18
19
  end
19
20
 
20
21
  def get_binding
@@ -30,7 +31,7 @@ module GalleryGenerator
30
31
 
31
32
  ViewableGallery.new(updated_gallery.title, updated_gallery.description, updated_gallery.slug,
32
33
  updated_gallery.sources, updated_gallery.upload_date, updated_gallery.map_url,
33
- updated_gallery.map_title, updated_gallery.year, to_viewable_photos(updated_gallery.photos), updated_gallery.small_print, updated_gallery.blurb)
34
+ updated_gallery.map_title, updated_gallery.year, to_viewable_photos(updated_gallery.photos), updated_gallery.small_print, updated_gallery.blurb, updated_gallery.genre)
34
35
  end
35
36
 
36
37
  def to_viewable_photos(mutable_viewable_photos)
@@ -42,7 +43,7 @@ module GalleryGenerator
42
43
  end
43
44
 
44
45
  class MutableViewableGallery
45
- attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb
46
+ attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb, :genre
46
47
  def initialize(viewable_gallery)
47
48
  @title = viewable_gallery.title
48
49
  @description = viewable_gallery.description
@@ -55,6 +56,7 @@ module GalleryGenerator
55
56
  @photos = to_mutable_viewable_photos(viewable_gallery.photos)
56
57
  @small_print = viewable_gallery.small_print
57
58
  @blurb = viewable_gallery.blurb
59
+ @genre = viewable_gallery.genre
58
60
  end
59
61
 
60
62
  def to_mutable_viewable_photos(viewable_photos)
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'minitest', '~> 5.15'
29
29
  spec.add_development_dependency 'rspec', '~> 3.13'
30
30
  spec.add_development_dependency 'fiddle', '~> 1.1.8'
31
+ spec.add_development_dependency 'htmlentities', '~> 4.4.2'
31
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: m1key_gallery_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Huniewicz
@@ -105,6 +105,20 @@ dependencies:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
107
  version: 1.1.8
108
+ - !ruby/object:Gem::Dependency
109
+ name: htmlentities
110
+ requirement: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - "~>"
113
+ - !ruby/object:Gem::Version
114
+ version: 4.4.2
115
+ type: :development
116
+ prerelease: false
117
+ version_requirements: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: 4.4.2
108
122
  description: This gem allows you to generate a m1key.me-style gallery based on the
109
123
  JPG files in the working directory.
110
124
  email: