jekyll 3.0.0.pre.beta8 → 3.0.0.pre.beta9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jekyll might be problematic. Click here for more details.

data/lib/jekyll/page.rb CHANGED
@@ -36,7 +36,7 @@ module Jekyll
36
36
  site.frontmatter_defaults.find(File.join(dir, name), type, key)
37
37
  end
38
38
 
39
- Jekyll::Hooks.trigger self, :post_init
39
+ Jekyll::Hooks.trigger :page, :post_init, self
40
40
  end
41
41
 
42
42
  # The generated directory into which the page will be placed
@@ -82,10 +82,10 @@ module Jekyll
82
82
  #
83
83
  # Returns an Array of plugin search paths
84
84
  def plugins_path
85
- if (site.config['plugins'] == Jekyll::Configuration::DEFAULTS['plugins'])
86
- [site.in_source_dir(site.config['plugins'])]
85
+ if (site.config['plugins_dir'] == Jekyll::Configuration::DEFAULTS['plugins_dir'])
86
+ [site.in_source_dir(site.config['plugins_dir'])]
87
87
  else
88
- Array(site.config['plugins']).map { |d| File.expand_path(d) }
88
+ Array(site.config['plugins_dir']).map { |d| File.expand_path(d) }
89
89
  end
90
90
  end
91
91
 
data/lib/jekyll/post.rb CHANGED
@@ -69,7 +69,7 @@ module Jekyll
69
69
  populate_categories
70
70
  populate_tags
71
71
 
72
- Jekyll::Hooks.trigger self, :post_init
72
+ Jekyll::Hooks.trigger :post, :post_init, self
73
73
  end
74
74
 
75
75
  def published?
data/lib/jekyll/reader.rb CHANGED
@@ -16,7 +16,7 @@ module Jekyll
16
16
  @site.layouts = LayoutReader.new(site).read
17
17
  read_directories
18
18
  sort_files!
19
- @site.data = DataReader.new(site).read(site.config['data_source'])
19
+ @site.data = DataReader.new(site).read(site.config['data_dir'])
20
20
  CollectionReader.new(site).read
21
21
  end
22
22
 
@@ -38,11 +38,11 @@ module Jekyll
38
38
  end
39
39
 
40
40
  def layout_directory_inside_source
41
- site.in_source_dir(site.config['layouts'])
41
+ site.in_source_dir(site.config['layouts_dir'])
42
42
  end
43
43
 
44
44
  def layout_directory_in_cwd
45
- dir = Jekyll.sanitized_path(Dir.pwd, site.config['layouts'])
45
+ dir = Jekyll.sanitized_path(Dir.pwd, site.config['layouts_dir'])
46
46
  if File.directory?(dir) && !site.safe
47
47
  dir
48
48
  else
@@ -130,9 +130,7 @@ module Jekyll
130
130
  #
131
131
  # Returns nothing.
132
132
  def write_metadata
133
- File.open(metadata_file, 'wb') do |f|
134
- f.write(Marshal.dump(metadata))
135
- end
133
+ File.binwrite(metadata_file, Marshal.dump(metadata))
136
134
  end
137
135
 
138
136
  # Produce the absolute path of the metadata file
@@ -158,7 +156,7 @@ module Jekyll
158
156
  # Returns the read metadata.
159
157
  def read_metadata
160
158
  @metadata = if !disabled? && File.file?(metadata_file)
161
- content = File.read(metadata_file)
159
+ content = File.binread(metadata_file)
162
160
 
163
161
  begin
164
162
  Marshal.load(content)
@@ -35,7 +35,7 @@ module Jekyll
35
35
  "page" => document.to_liquid
36
36
  }, site_payload || site.site_payload)
37
37
 
38
- Jekyll::Hooks.trigger document, :pre_render, payload
38
+ Jekyll::Hooks.trigger :document, :pre_render, document, payload
39
39
 
40
40
  info = {
41
41
  filters: [Jekyll::Filters],
@@ -138,7 +138,7 @@ module Jekyll
138
138
  layout.content,
139
139
  payload,
140
140
  info,
141
- File.join(site.config['layouts'], layout.name)
141
+ File.join(site.config['layouts_dir'], layout.name)
142
142
  )
143
143
 
144
144
  # Add layout to dependency tree
data/lib/jekyll/site.rb CHANGED
@@ -86,7 +86,7 @@ module Jekyll
86
86
  raise ArgumentError, "limit_posts must be a non-negative number"
87
87
  end
88
88
 
89
- Jekyll::Hooks.trigger self, :after_reset
89
+ Jekyll::Hooks.trigger :site, :after_reset, self
90
90
  end
91
91
 
92
92
  # Load necessary libraries, plugins, converters, and generators.
@@ -144,7 +144,7 @@ module Jekyll
144
144
  def read
145
145
  reader.read
146
146
  limit_posts!
147
- Jekyll::Hooks.trigger self, :post_read
147
+ Jekyll::Hooks.trigger :site, :post_read, self
148
148
  end
149
149
 
150
150
  # Run each of the Generators.
@@ -164,13 +164,13 @@ module Jekyll
164
164
 
165
165
  payload = site_payload
166
166
 
167
- Jekyll::Hooks.trigger self, :pre_render, payload
167
+ Jekyll::Hooks.trigger :site, :pre_render, self, payload
168
168
 
169
169
  collections.each do |label, collection|
170
170
  collection.docs.each do |document|
171
171
  if regenerator.regenerate?(document)
172
172
  document.output = Jekyll::Renderer.new(self, document, payload).run
173
- Jekyll::Hooks.trigger document, :post_render
173
+ Jekyll::Hooks.trigger :document, :post_render, document
174
174
  end
175
175
  end
176
176
  end
@@ -199,7 +199,7 @@ module Jekyll
199
199
  item.write(dest) if regenerator.regenerate?(item)
200
200
  }
201
201
  regenerator.write_metadata
202
- Jekyll::Hooks.trigger self, :post_write
202
+ Jekyll::Hooks.trigger :site, :post_write, self
203
203
  end
204
204
 
205
205
  # Construct a Hash of Posts indexed by the specified Post attribute.
@@ -37,7 +37,7 @@ module Jekyll
37
37
 
38
38
  def destination_rel_dir
39
39
  if @collection
40
- @dir.gsub(/\A_/, '')
40
+ File.dirname(url)
41
41
  else
42
42
  @dir
43
43
  end
@@ -61,9 +61,10 @@ module Jekyll
61
61
 
62
62
  # Whether to write the file to the filesystem
63
63
  #
64
- # Returns true.
64
+ # Returns true unless the defaults for the destination path from
65
+ # _config.yml contain `published: false`.
65
66
  def write?
66
- true
67
+ defaults.fetch('published', true)
67
68
  end
68
69
 
69
70
  # Write the static file to the destination directory (if modified).
@@ -100,5 +101,41 @@ module Jekyll
100
101
  "path" => File.join("", relative_path)
101
102
  }
102
103
  end
104
+
105
+ def placeholders
106
+ {
107
+ collection: @collection.label,
108
+ path: relative_path[
109
+ @collection.relative_directory.size..relative_path.size],
110
+ output_ext: '',
111
+ name: '',
112
+ title: '',
113
+ }
114
+ end
115
+
116
+ # Applies a similar URL-building technique as Jekyll::Document that takes
117
+ # the collection's URL template into account. The default URL template can
118
+ # be overriden in the collection's configuration in _config.yml.
119
+ def url
120
+ @url ||= if @collection.nil?
121
+ relative_path
122
+ else
123
+ ::Jekyll::URL.new({
124
+ template: @collection.url_template,
125
+ placeholders: placeholders,
126
+ })
127
+ end.to_s.gsub /\/$/, ''
128
+ end
129
+
130
+ # Returns the type of the collection if present, nil otherwise.
131
+ def type
132
+ @type ||= @collection.nil? ? nil : @collection.label.to_sym
133
+ end
134
+
135
+ # Returns the front matter defaults defined for the file's URL and/or type
136
+ # as defined in _config.yml.
137
+ def defaults
138
+ @defaults ||= @site.frontmatter_defaults.all url, type
139
+ end
103
140
  end
104
141
  end
@@ -64,7 +64,7 @@ eos
64
64
  if is_safe
65
65
  Hash[[
66
66
  [:startinline, opts.fetch(:startinline, nil)],
67
- [:hl_linenos, opts.fetch(:hl_linenos, nil)],
67
+ [:hl_lines, opts.fetch(:hl_lines, nil)],
68
68
  [:linenos, opts.fetch(:linenos, nil)],
69
69
  [:encoding, opts.fetch(:encoding, 'utf-8')],
70
70
  [:cssclass, opts.fetch(:cssclass, nil)]
@@ -20,7 +20,6 @@ module Jekyll
20
20
 
21
21
  def initialize(tag_name, markup, tokens)
22
22
  super
23
- @includes_dir = tag_includes_dir
24
23
  matched = markup.strip.match(VARIABLE_SYNTAX)
25
24
  if matched
26
25
  @file = matched['variable'].strip
@@ -100,12 +99,13 @@ eos
100
99
  end
101
100
  end
102
101
 
103
- def tag_includes_dir
104
- '_includes'.freeze
102
+ def tag_includes_dir(context)
103
+ context.registers[:site].config['includes_dir'].freeze
105
104
  end
106
105
 
107
106
  def render(context)
108
107
  site = context.registers[:site]
108
+ @includes_dir = tag_includes_dir(context)
109
109
  dir = resolved_includes_dir(context)
110
110
 
111
111
  file = render_variable(context) || @file
@@ -161,7 +161,7 @@ eos
161
161
  end
162
162
 
163
163
  class IncludeRelativeTag < IncludeTag
164
- def tag_includes_dir
164
+ def tag_includes_dir(context)
165
165
  '.'.freeze
166
166
  end
167
167
 
@@ -1,3 +1,3 @@
1
1
  module Jekyll
2
- VERSION = '3.0.0.pre.beta8'
2
+ VERSION = '3.0.0.pre.beta9'
3
3
  end
@@ -14,9 +14,9 @@
14
14
  </a>
15
15
 
16
16
  <div class="trigger">
17
- {% for page in site.pages %}
18
- {% if page.title %}
19
- <a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
17
+ {% for my_page in site.pages %}
18
+ {% if my_page.title %}
19
+ <a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title }}</a>
20
20
  {% endif %}
21
21
  {% endfor %}
22
22
  </div>
@@ -30,7 +30,7 @@ $on-laptop: 800px;
30
30
 
31
31
 
32
32
 
33
- // Using media queries with like this:
33
+ // Use media queries like this:
34
34
  // @include media-query($on-palm) {
35
35
  // .wrapper {
36
36
  // padding-right: $spacing-unit / 2;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre.beta8
4
+ version: 3.0.0.pre.beta9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid