m1key_gallery_generator 0.3.10 → 0.3.13

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: 9a05edfc5a9ca0d7c63469789151df09ad2e0b25361906e2ce65029e356cdf15
4
- data.tar.gz: d61e9e6d030bcc057875952485eaddd87e939a2d3a2081d56137d4789f65ecbb
3
+ metadata.gz: 8857fbd8bce88de4d77ca87e9f81e3513c4c2d4152b72cc69107a2fcc7b5c5e9
4
+ data.tar.gz: 12baa606ca2be696e912d917d1a10cf5e74bf96647e726d91f038a8052733c9a
5
5
  SHA512:
6
- metadata.gz: f9315fd151a474dfcb8e210c848b9f07bb5246ec546fb60ea0e3e1531f6104351b8c2b7a68f89689d86295d016af364797ed29105fccfccf5b5fd39dc821d9d7
7
- data.tar.gz: 0f74dd1dfb2e798d657d81e40464db66081d39bdc77decf36dab6c08c43bd680316711155757af1350f92dd39010f6927a2d34f8a0357b47661416925b969aea
6
+ metadata.gz: c6f0994d49ea166e43f7ff628aed26aeb90d28ec55bdd36d905307d91973a0e02b5edadc4a8a77602447f3803a3a16eb0ee96fc6939dc4f8f6c955dbaacbc23a
7
+ data.tar.gz: 01b7c85fb5da457fea4783a3c0d261ff5acbca82cfd9a2502f96d54127d7d49f7915b24f2c5e4d60b5e26bf8150b6baa94285a71bd6c927723ea8ad2beb09029
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.10.gem
77
+ > gem install m1key_gallery_generator-0.3.13.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.10\bin\console . wait_on_error
81
+ > ruby c:\Ruby34-x64\lib\ruby\gems\3.4.0\gems\m1key_gallery_generator-0.3.13\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.10.gem
98
+ > gem install m1key_gallery_generator-0.3.13.gem
99
99
 
100
100
  To test gem:
101
101
  > irb
data/bin/console CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'm1key_gallery_generator'
4
4
  require 'erb'
5
5
  require 'htmlentities'
6
+ require 'date'
6
7
 
7
8
  Encoding.default_external = Encoding::UTF_8
8
9
 
@@ -29,10 +30,14 @@ begin
29
30
  viewable_photos = photos_config_into_viewable_photos(working_directory, gallery_config)
30
31
 
31
32
  puts 'Creating viewable gallery...'
32
-
33
+ update_date = gallery_config.update_date
34
+ if update_date.to_s == ''
35
+ update_date = Date.today.strftime('%Y-%m-%d')
36
+ end
33
37
  gallery = ViewableGallery.new(gallery_config.title, gallery_config.description, gallery_config.slug,
34
38
  gallery_config.sources, gallery_config.upload_date, gallery_config.map_url, gallery_config.map_title,
35
- gallery_config.year, viewable_photos, gallery_config.small_print, gallery_config.blurb, gallery_config.genre).
39
+ gallery_config.year, viewable_photos, gallery_config.small_print, gallery_config.blurb, gallery_config.genre,
40
+ update_date).
36
41
  update_using(
37
42
  add_tabs_before_every_description_line(3),
38
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, :genre
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..."
@@ -15,14 +15,20 @@ module GalleryGenerator
15
15
 
16
16
  @title = gallery_configuration['title']
17
17
  puts "Gallery title is [#{@title}]."
18
- @map_url = gallery_configuration['map']['url']
19
- puts "Map url is [#{@map_url}]."
20
- @map_title = gallery_configuration['map']['title']
18
+ @map_url = nil
19
+ @map_title = nil
20
+ if gallery_configuration['map'] != nil
21
+ @map_url = gallery_configuration['map']['url']
22
+ @map_title = gallery_configuration['map']['title']
23
+ end
24
+ puts "Map url is [#{@map_url}]."
21
25
  puts "Map title is [#{@map_title}]."
22
26
  @slug = gallery_configuration['slug']
23
27
  puts "Gallery slug is [#{@slug}]."
24
28
  @upload_date = gallery_configuration['upload_date']
25
29
  puts "Gallery upload date is [#{@upload_date}]."
30
+ @update_date = gallery_configuration['update_date']
31
+ puts "Gallery updated date is [#{@update_date}]."
26
32
  @description = gallery_configuration['description']
27
33
  puts "Gallery description is [#{compact(@description)}]."
28
34
  @small_print = gallery_configuration['small_print']
@@ -40,7 +40,7 @@
40
40
  "name": "<%= title %> by Michal Huniewicz",
41
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",
@@ -112,9 +112,9 @@
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
+ <% if map_url.to_s != '' %>
118
118
  <figure class="map">
119
119
  <a href="<%= map_url %>"
120
120
  target="_blank" rel="noopener noreferrer">
@@ -122,7 +122,7 @@
122
122
  title="<%= map_title %>" width="320" height="240" />
123
123
  </a>
124
124
  <figcaption class="visually-hidden">Map showing <%= map_title %> location (opens in OpenStreetMap)</figcaption>
125
- </figure>
125
+ </figure><% end %>
126
126
  <% photos.each_with_index do |photo, index| %>
127
127
  <article class="photo" id="<%= photo.id %>">
128
128
  <header>
@@ -137,14 +137,16 @@
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
152
  <li><a href="../" class="nav-link">&lt; Back to <%= genre.capitalize %></a></li>
@@ -1,3 +1,3 @@
1
1
  module M1keyGalleryGenerator
2
- VERSION = '0.3.10'
2
+ VERSION = '0.3.13'
3
3
  end
@@ -2,13 +2,14 @@ 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, :genre
6
- def initialize(title, description, slug, sources, upload_date, map_url, map_title, year, viewable_photos, small_print, blurb, genre)
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
@@ -31,7 +32,7 @@ module GalleryGenerator
31
32
 
32
33
  ViewableGallery.new(updated_gallery.title, updated_gallery.description, updated_gallery.slug,
33
34
  updated_gallery.sources, updated_gallery.upload_date, updated_gallery.map_url,
34
- updated_gallery.map_title, updated_gallery.year, to_viewable_photos(updated_gallery.photos), updated_gallery.small_print, updated_gallery.blurb, updated_gallery.genre)
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)
35
36
  end
36
37
 
37
38
  def to_viewable_photos(mutable_viewable_photos)
@@ -43,7 +44,7 @@ module GalleryGenerator
43
44
  end
44
45
 
45
46
  class MutableViewableGallery
46
- attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb, :genre
47
+ attr_accessor :title, :description, :slug, :sources, :upload_date, :map_url, :map_title, :year, :photos, :small_print, :blurb, :genre, :update_date
47
48
  def initialize(viewable_gallery)
48
49
  @title = viewable_gallery.title
49
50
  @description = viewable_gallery.description
@@ -57,6 +58,7 @@ module GalleryGenerator
57
58
  @small_print = viewable_gallery.small_print
58
59
  @blurb = viewable_gallery.blurb
59
60
  @genre = viewable_gallery.genre
61
+ @update_date = viewable_gallery.update_date
60
62
  end
61
63
 
62
64
  def to_mutable_viewable_photos(viewable_photos)
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.10
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Huniewicz
@@ -167,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubygems_version: 3.7.2
170
+ rubygems_version: 3.6.9
171
171
  specification_version: 4
172
172
  summary: m1key.me-style gallery generator.
173
173
  test_files: []