Class: Jekyll::Site

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/multiple/languages/plugin.rb

Instance Method Summary collapse

Instance Method Details

#processObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/jekyll/multiple/languages/plugin.rb', line 13

def process
  if !self.config['baseurl']
    self.config['baseurl'] = ""
  end
  #Variables
  config['baseurl_root'] = self.config['baseurl']
  baseurl_org = self.config['baseurl']
  languages = self.config['languages']
  dest_org = self.dest

  #Loop
  self.config['lang'] = languages.first
  puts
  puts "Building site for default language: \"#{self.config['lang']}\" to: #{self.dest}"
  process_org
  languages.drop(1).each do |lang|

    # Build site for language lang
    self.dest = self.dest + "/" + lang
    self.config['baseurl'] = self.config['baseurl'] + "/" + lang
    self.config['lang'] = lang
    puts "Building site for language: \"#{self.config['lang']}\" to: #{self.dest}"
    process_org

    #Reset variables for next language
    self.dest = dest_org
    self.config['baseurl'] = baseurl_org
  end
  Jekyll.setlangs({})
  puts 'Build complete'
end

#process_orgObject



12
# File 'lib/jekyll/multiple/languages/plugin.rb', line 12

alias :process_org :process

#read_posts(dir) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/jekyll/multiple/languages/plugin.rb', line 46

def read_posts(dir)
  if dir == ''
    read_posts("_i18n/#{self.config['lang']}/")
  else
    read_posts_org(dir)
  end
end

#read_posts_orgObject



45
# File 'lib/jekyll/multiple/languages/plugin.rb', line 45

alias :read_posts_org :read_posts