Class: Jekyll::J1Paginator::Generator::CompatibilityPaginationPage

Inherits:
Page
  • Object
show all
Defined in:
lib/j1-paginator/generator/compatibilityUtils.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, base, dir, template_path) ⇒ CompatibilityPaginationPage

Returns a new instance of CompatibilityPaginationPage.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/j1-paginator/generator/compatibilityUtils.rb', line 5

def initialize(site, base, dir, template_path)
  @site = site
  @base = base
  @dir = dir
  @template = template_path
  @name = 'index.html'

  templ_dir = File.dirname(template_path)
  templ_file = File.basename(template_path)

  # Path is only used by the convertible module and accessed below when calling read_yaml
  # in our case we have the path point to the original template instead of our faux new pagination page
  @path = if site.in_theme_dir(base) == base # we're in a theme
            site.in_theme_dir(base, templ_dir, templ_file)
          else
            site.in_source_dir(base, templ_dir, templ_file)
          end
  
  self.process(@name)
  self.read_yaml(templ_dir, templ_file)

  data.default_proc = proc do |_, key|
    site.frontmatter_defaults.find(File.join(templ_dir, templ_file), type, key)
  end

end