Module: ImageGallery
- Defined in:
- lib/gallery/gallery.rb,
lib/gallery/version.rb,
lib/jekyll-image-gallery.rb
Defined Under Namespace
Modules: Filters
Classes: CompressedStaticGalleryFile, GalleryGenerator, GalleryIndexPage, GalleryPage
Constant Summary
collapse
- VERSION =
'1.0.2'
Class Method Summary
collapse
Class Method Details
._config_with_defaults(site) ⇒ Object
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
# File 'lib/gallery/gallery.rb', line 320
def self._config_with_defaults(site)
defaults = {
'path' => 'gallery',
'generate_root_index' => false,
'thumbnail_size' => {
'x' => 512,
'y' => 512,
},
"title_prefix" => 'Photos',
"title_seperator" => '|',
}
config = site.config
unless config
ImageGallery._log_once(:warn, 'No configuration (site.config) found for jekyll-image-gallery, defaults will be used')
return defaults
end
gallery_config = config['gallery']
unless gallery_config
ImageGallery._log_once(:warn, 'No configuration found for jekyll-image-gallery, defaults will be used')
return defaults
end
defaults.merge(gallery_config)
end
|
._log(level, message) ⇒ Object
347
348
349
|
# File 'lib/gallery/gallery.rb', line 347
def self._log(level, message)
Jekyll.logger.public_send(level, "\tjekyll-image-gallery: #{message}")
end
|
._log_once(level, message) ⇒ Object
351
352
353
354
355
356
357
|
# File 'lib/gallery/gallery.rb', line 351
def self._log_once(level, message)
@@seen_log_messages ||= {}
return if @@seen_log_messages.include?(message)
@@seen_log_messages[message] = true
ImageGallery._log(level, message)
end
|
.gallery_path_array(site, year = nil, month = nil) ⇒ Object
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
|
# File 'lib/gallery/gallery.rb', line 359
def self.gallery_path_array(site, year = nil, month = nil)
config = ImageGallery._config_with_defaults(site)
gallery_path = []
gallery_path = config['path'].split('/') if config['path']
gallery_path.push(year.to_s) if year
if month
padded_month = format('%02d', month)
gallery_path.push(padded_month)
end
gallery_path
end
|