m1key_gallery_generator 0.3.9 → 0.3.12

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: '08442ae82a99eb2c9253cd9d0ff798a48cf004627394b1d752473e56f672ce76'
4
+ data.tar.gz: 953a20a23228155023d61c7a3f0d72d094635c797eadde1b312e65c7c9cdda47
5
5
  SHA512:
6
- metadata.gz: 6fe8d82b5187d4511a773aad9c153603838caadfb5e572b79766e7ee3ff38b4130aa4eeb75e38e0c7685e89e98ff6169b6f50aca996191caf89bb348297d02b1
7
- data.tar.gz: aa17a99e8ec793d444e7557c36cc995c24f00e1b5c7874ff0cf73447d5997b1d6ce30f8b89ed438a7bb69a842f8d7708f108c0110dc42038b96cdd4c48fd91d0
6
+ metadata.gz: c1e8f7322aa6036c60856aee438ec1766c3cf29f01608a370c330aa4602558c9d863062537e89e06f8c02216cacb988a4eba43d4d2f48607b766e990c8206faa
7
+ data.tar.gz: 890eef5203fe474eb0048e3ba9810c46051da6ef3b5f787e58a44871f7d57434f6ddd381c22fefdb2dd985a5acbecad33b557e1bfbe37d9041f5203d50a61721
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.12.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.12\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.12.gem
99
99
 
100
100
  To test gem:
101
101
  > irb
data/bin/console CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'm1key_gallery_generator'
4
4
  require 'erb'
5
+ require 'htmlentities'
6
+ require 'date'
5
7
 
6
8
  Encoding.default_external = Encoding::UTF_8
7
9
 
@@ -28,10 +30,14 @@ begin
28
30
  viewable_photos = photos_config_into_viewable_photos(working_directory, gallery_config)
29
31
 
30
32
  puts 'Creating viewable gallery...'
31
-
33
+ update_date = gallery_config.update_date
34
+ if update_date.to_s == ''
35
+ update_date = Date.today.strftime('%Y-%m-%d')
36
+ end
32
37
  gallery = ViewableGallery.new(gallery_config.title, gallery_config.description, gallery_config.slug,
33
38
  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).
39
+ gallery_config.year, viewable_photos, gallery_config.small_print, gallery_config.blurb, gallery_config.genre,
40
+ update_date).
35
41
  update_using(
36
42
  add_tabs_before_every_description_line(3),
37
43
  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, :update_date
9
9
 
10
10
  def initialize(yaml_config_file_name)
11
11
  puts "Attempting to parse #{yaml_config_file_name} to read gallery configuration..."
@@ -23,12 +23,20 @@ module GalleryGenerator
23
23
  puts "Gallery slug is [#{@slug}]."
24
24
  @upload_date = gallery_configuration['upload_date']
25
25
  puts "Gallery upload date is [#{@upload_date}]."
26
+ @update_date = gallery_configuration['update_date']
27
+ puts "Gallery updated date is [#{@update_date}]."
26
28
  @description = gallery_configuration['description']
27
29
  puts "Gallery description is [#{compact(@description)}]."
28
30
  @small_print = gallery_configuration['small_print']
29
31
  puts "Small print is [#{@small_print}]."
30
32
  @blurb = gallery_configuration['blurb']
31
- puts "Gallery description is [#{compact(@blurb)}]."
33
+ puts "Gallery blurb is [#{compact(@blurb)}]."
34
+ if gallery_configuration['genre'] == nil
35
+ @genre = 'photography'
36
+ else
37
+ @genre = gallery_configuration['genre']
38
+ end
39
+ puts "Gallery genre is [#{compact(@genre)}]."
32
40
 
33
41
  @sources = gallery_configuration['sources']
34
42
 
@@ -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,9 +38,9 @@
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
- "dateModified": "<%= upload_date %>",
43
+ "dateModified": "<%= update_date %>",
44
44
  "author": {
45
45
  "@type": "Person",
46
46
  "name": "Michal Huniewicz",
@@ -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>
@@ -112,7 +112,7 @@
112
112
  <%= description -%>
113
113
  <% if small_print.to_s != '' %>
114
114
  <p><%= small_print -%></p><% end %>
115
- <p class="smallprint">Uploaded on: <%= upload_date %>.</p>
115
+ <p class="smallprint">Uploaded on: <%= upload_date %>. Updated on: <%= update_date %>.</p>
116
116
  </section>
117
117
 
118
118
  <figure class="map">
@@ -133,21 +133,23 @@
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>
140
- <% end %>
140
+ <% end -%>
141
+ <% if sources %>
141
142
  <details class="sources" id="sources">
142
143
  <summary>Sources</summary>
143
144
  <ul class="smallprint"><% sources.each_with_index do |source, index| %>
144
145
  <li><%= index + 1 %>: <a href="<%= source %>" rel="noopener noreferrer" class="nav-link"><% if source.length > 100 %><%= source[0..50] %>[...]<%= source[-30..-1] %><% else %><%= source %><% end -%></a></li><% end %>
145
146
  </ul>
146
147
  </details>
147
-
148
+ <% end -%>
149
+
148
150
  <nav class="navigation" aria-label="Gallery navigation bottom">
149
151
  <ul>
150
- <li><a href="../" class="nav-link">&lt; Back to Photography</a></li>
152
+ <li><a href="../" class="nav-link">&lt; Back to <%= genre.capitalize %></a></li>
151
153
  <li><a href="../../" class="nav-link">&lt;&lt; Back to M1key.me</a></li>
152
154
  </ul>
153
155
  </nav>
@@ -1,3 +1,3 @@
1
1
  module M1keyGalleryGenerator
2
- VERSION = '0.3.9'
2
+ VERSION = '0.3.12'
3
3
  end
@@ -2,19 +2,21 @@ 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, :update_date
6
+ def initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print, blurb, genre, update_date)
7
7
  @title = String.new(title)
8
8
  @description = description
9
9
  @slug = slug
10
10
  @sources = sources
11
11
  @upload_date = upload_date
12
+ @update_date = update_date
12
13
  @map_url = map_url
13
14
  @map_title = map_title
14
15
  @year = year
15
16
  @photos = viewable_photos
16
17
  @small_print = small_print
17
18
  @blurb = blurb
19
+ @genre = genre
18
20
  end
19
21
 
20
22
  def get_binding
@@ -30,7 +32,7 @@ module GalleryGenerator
30
32
 
31
33
  ViewableGallery.new(updated_gallery.title, updated_gallery.description, updated_gallery.slug,
32
34
  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)
35
+ updated_gallery.map_title, updated_gallery.year, to_viewable_photos(updated_gallery.photos), updated_gallery.small_print, updated_gallery.blurb, updated_gallery.genre, updated_gallery.update_date)
34
36
  end
35
37
 
36
38
  def to_viewable_photos(mutable_viewable_photos)
@@ -42,7 +44,7 @@ module GalleryGenerator
42
44
  end
43
45
 
44
46
  class MutableViewableGallery
45
- attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb
47
+ attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb, :genre, :update_date
46
48
  def initialize(viewable_gallery)
47
49
  @title = viewable_gallery.title
48
50
  @description = viewable_gallery.description
@@ -55,6 +57,8 @@ module GalleryGenerator
55
57
  @photos = to_mutable_viewable_photos(viewable_gallery.photos)
56
58
  @small_print = viewable_gallery.small_print
57
59
  @blurb = viewable_gallery.blurb
60
+ @genre = viewable_gallery.genre
61
+ @update_date = viewable_gallery.update_date
58
62
  end
59
63
 
60
64
  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.12
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: