jekyll 2.0.3 → 2.1.0

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.

Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/CONTRIBUTING.markdown +2 -2
  4. data/History.markdown +86 -0
  5. data/README.markdown +5 -30
  6. data/Rakefile +4 -9
  7. data/docs/jp/CONTRIBUTING.jp.markdown +2 -2
  8. data/docs/jp/README.jp.markdown +1 -2
  9. data/features/collections.feature +40 -3
  10. data/features/data.feature +41 -1
  11. data/features/frontmatter_defaults.feature +57 -0
  12. data/features/post_data.feature +12 -0
  13. data/features/rendering.feature +34 -0
  14. data/features/step_definitions/jekyll_steps.rb +5 -1
  15. data/features/support/env.rb +0 -3
  16. data/jekyll.gemspec +6 -5
  17. data/lib/jekyll.rb +18 -1
  18. data/lib/jekyll/cleaner.rb +22 -2
  19. data/lib/jekyll/collection.rb +9 -2
  20. data/lib/jekyll/command.rb +20 -10
  21. data/lib/jekyll/commands/build.rb +10 -47
  22. data/lib/jekyll/commands/serve.rb +1 -0
  23. data/lib/jekyll/configuration.rb +13 -1
  24. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +9 -2
  25. data/lib/jekyll/convertible.rb +31 -2
  26. data/lib/jekyll/deprecator.rb +1 -1
  27. data/lib/jekyll/document.rb +21 -3
  28. data/lib/jekyll/excerpt.rb +1 -1
  29. data/lib/jekyll/filters.rb +16 -12
  30. data/lib/jekyll/frontmatter_defaults.rb +3 -3
  31. data/lib/jekyll/log_adapter.rb +102 -0
  32. data/lib/jekyll/post.rb +5 -5
  33. data/lib/jekyll/renderer.rb +9 -5
  34. data/lib/jekyll/site.rb +38 -18
  35. data/lib/jekyll/static_file.rb +1 -0
  36. data/lib/jekyll/stevenson.rb +54 -98
  37. data/lib/jekyll/tags/highlight.rb +13 -5
  38. data/lib/jekyll/url.rb +2 -2
  39. data/lib/jekyll/utils.rb +15 -7
  40. data/lib/jekyll/version.rb +1 -1
  41. data/lib/site_template/_config.yml +2 -0
  42. data/lib/site_template/_includes/footer.html +8 -8
  43. data/lib/site_template/_includes/header.html +1 -1
  44. data/lib/site_template/css/main.css +7 -2
  45. data/lib/site_template/feed.xml +10 -1
  46. data/site/_config.yml +1 -0
  47. data/site/_data/docs.yml +1 -0
  48. data/site/_includes/anchor_links.html +28 -23
  49. data/site/_includes/css/font-awesome.css +3 -3
  50. data/site/_includes/css/style.css +4 -0
  51. data/site/_includes/news_contents.html +11 -1
  52. data/site/_includes/top.html +0 -1
  53. data/site/_layouts/default.html +1 -0
  54. data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +1 -1
  55. data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +1 -1
  56. data/site/_posts/2014-06-04-jekyll-stickers-1-dollar-stickermule.markdown +19 -0
  57. data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +27 -0
  58. data/site/docs/collections.md +59 -1
  59. data/site/docs/configuration.md +91 -21
  60. data/site/docs/continuous-integration.md +177 -0
  61. data/site/docs/contributing.md +2 -2
  62. data/site/docs/datafiles.md +47 -3
  63. data/site/docs/deployment-methods.md +3 -3
  64. data/site/docs/extras.md +3 -5
  65. data/site/docs/history.md +86 -0
  66. data/site/docs/installation.md +3 -1
  67. data/site/docs/pagination.md +2 -1
  68. data/site/docs/permalinks.md +4 -4
  69. data/site/docs/plugins.md +6 -0
  70. data/site/docs/quickstart.md +0 -6
  71. data/site/docs/resources.md +1 -1
  72. data/site/docs/templates.md +1 -1
  73. data/site/docs/troubleshooting.md +1 -1
  74. data/site/docs/windows.md +2 -2
  75. data/site/fonts/FontAwesome.otf +0 -0
  76. data/site/fonts/fontawesome-webfont.eot +0 -0
  77. data/site/fonts/fontawesome-webfont.svg +469 -379
  78. data/site/fonts/fontawesome-webfont.ttf +0 -0
  79. data/site/fonts/fontawesome-webfont.woff +0 -0
  80. data/site/img/jekyll-sticker.jpg +0 -0
  81. data/test/helper.rb +0 -3
  82. data/test/source/_data/categories/dairy.yaml +6 -0
  83. data/test/source/_data/members.json +12 -0
  84. data/test/source/_methods/site/initialize.md +1 -2
  85. data/test/source/_posts/2009-01-27-no-category.textile +6 -0
  86. data/test/source/_slides/example-slide-1.html +4 -0
  87. data/test/source/_slides/example-slide-2.html +7 -0
  88. data/test/source/_with.dots/all.dots/2.4.0.md +5 -0
  89. data/test/source/_with.dots/file.with.dots.md +0 -0
  90. data/test/source/environment.html +5 -0
  91. data/test/test_cleaner.rb +77 -0
  92. data/test/test_collections.rb +52 -3
  93. data/test/test_command.rb +25 -28
  94. data/test/test_configuration.rb +10 -1
  95. data/test/test_document.rb +123 -0
  96. data/test/test_excerpt.rb +11 -0
  97. data/test/test_filters.rb +28 -2
  98. data/test/test_generated_site.rb +1 -1
  99. data/test/test_log_adapter.rb +59 -0
  100. data/test/test_post.rb +77 -0
  101. data/test/test_site.rb +51 -0
  102. data/test/test_tags.rb +11 -114
  103. data/test/test_utils.rb +2 -2
  104. metadata +76 -39
  105. data/lib/jekyll/generators/pagination.rb +0 -217
  106. data/lib/jekyll/tags/gist.rb +0 -47
  107. data/test/test_pager.rb +0 -118
@@ -0,0 +1,34 @@
1
+ Feature: Rendering
2
+ As a hacker who likes to blog
3
+ I want to be able to make a static site
4
+ In order to share my awesome ideas with the interwebs
5
+ But I want to make it as simply as possible
6
+ So render with Liquid and place in Layouts
7
+
8
+ Scenario: Render Liquid and place in layout
9
+ Given I have a "index.html" page with layout "simple" that contains "Hi there, Jekyll {{ jekyll.environment }}!"
10
+ And I have a simple layout that contains "{{ content }}Ahoy, indeed!"
11
+ When I run jekyll build
12
+ Then the _site directory should exist
13
+ And I should see "Hi there, Jekyll development!\nAhoy, indeed" in "_site/index.html"
14
+
15
+ Scenario: Don't place asset files in layout
16
+ Given I have an "index.scss" page with layout "simple" that contains ".foo-bar { color:black; }"
17
+ And I have an "index.coffee" page with layout "simple" that contains "whatever()"
18
+ And I have a simple layout that contains "{{ content }}Ahoy, indeed!"
19
+ When I run jekyll build
20
+ Then the _site directory should exist
21
+ And I should not see "Ahoy, indeed!" in "_site/index.css"
22
+ And I should not see "Ahoy, indeed!" in "_site/index.js"
23
+
24
+ Scenario: Don't render liquid in Sass
25
+ Given I have an "index.scss" page that contains ".foo-bar { color:{{site.color}}; }"
26
+ When I run jekyll build
27
+ Then the _site directory should not exist
28
+ And I should see "Invalid CSS after" in the build output
29
+
30
+ Scenario: Don't render liquid in CoffeeScript
31
+ Given I have an "index.coffee" page that contains "hey='for {{site.animal}}'"
32
+ When I run jekyll build
33
+ Then the _site directory should exist
34
+ And I should see "hey = 'for {{site.animal}}';" in "_site/index.js"
@@ -141,7 +141,7 @@ end
141
141
 
142
142
  When /^I run jekyll(.*)$/ do |args|
143
143
  status = run_jekyll(args)
144
- if !status || args.include?("--verbose")
144
+ if args.include?("--verbose") || ENV['DEBUG']
145
145
  puts jekyll_run_output
146
146
  end
147
147
  end
@@ -195,3 +195,7 @@ end
195
195
  Then /^I should see today's date in "(.*)"$/ do |file|
196
196
  assert_match Regexp.new(Date.today.to_s), file_contents(file)
197
197
  end
198
+
199
+ Then /^I should see "(.*)" in the build output$/ do |text|
200
+ assert_match Regexp.new(text), jekyll_run_output
201
+ end
@@ -1,6 +1,3 @@
1
- require 'coveralls'
2
- Coveralls.wear_merged!
3
-
4
1
  require 'fileutils'
5
2
  require 'rr'
6
3
  require 'test/unit'
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.authors = ["Tom Preston-Werner"]
20
20
  s.email = 'tom@mojombo.com'
21
- s.homepage = 'http://github.com/jekyll/jekyll'
21
+ s.homepage = 'https://github.com/jekyll/jekyll'
22
22
 
23
23
  s.files = `git ls-files`.split($/)
24
24
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -28,18 +28,20 @@ Gem::Specification.new do |s|
28
28
  s.rdoc_options = ["--charset=UTF-8"]
29
29
  s.extra_rdoc_files = %w[README.markdown LICENSE]
30
30
 
31
- s.add_runtime_dependency('liquid', "~> 2.5.5")
31
+ s.add_runtime_dependency('liquid', "~> 2.6.1")
32
32
  s.add_runtime_dependency('classifier', "~> 1.3")
33
- s.add_runtime_dependency('listen', "~> 2.5")
34
33
  s.add_runtime_dependency('kramdown', "~> 1.3")
35
- s.add_runtime_dependency('pygments.rb', "~> 0.5.0")
34
+ s.add_runtime_dependency('pygments.rb', "~> 0.6.0")
36
35
  s.add_runtime_dependency('mercenary', "~> 0.3.3")
37
36
  s.add_runtime_dependency('safe_yaml', "~> 1.0")
38
37
  s.add_runtime_dependency('colorator', "~> 0.1")
39
38
  s.add_runtime_dependency('redcarpet', "~> 3.1")
40
39
  s.add_runtime_dependency('toml', '~> 0.1.0')
40
+ s.add_runtime_dependency('jekyll-paginate', '~> 1.0')
41
+ s.add_runtime_dependency('jekyll-gist', '~> 1.0')
41
42
  s.add_runtime_dependency('jekyll-coffeescript', '~> 1.0')
42
43
  s.add_runtime_dependency('jekyll-sass-converter', '~> 1.0')
44
+ s.add_runtime_dependency('jekyll-watch', '~> 1.0')
43
45
 
44
46
  s.add_development_dependency('rake', "~> 10.1")
45
47
  s.add_development_dependency('rdoc', "~> 3.11")
@@ -53,7 +55,6 @@ Gem::Specification.new do |s|
53
55
  s.add_development_dependency('launchy', "~> 2.3")
54
56
  s.add_development_dependency('simplecov', "~> 0.7")
55
57
  s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1")
56
- s.add_development_dependency('coveralls', "~> 0.7.0")
57
58
  s.add_development_dependency('mime-types', "~> 1.5")
58
59
  s.add_development_dependency('activesupport', '~> 3.2.13')
59
60
  s.add_development_dependency('jekyll_test_plugin')
@@ -21,6 +21,7 @@ require 'time'
21
21
  require 'safe_yaml/load'
22
22
  require 'English'
23
23
  require 'pathname'
24
+ require 'logger'
24
25
 
25
26
  # 3rd party
26
27
  require 'liquid'
@@ -31,6 +32,7 @@ require 'toml'
31
32
  # internal requires
32
33
  require 'jekyll/version'
33
34
  require 'jekyll/utils'
35
+ require 'jekyll/log_adapter'
34
36
  require 'jekyll/stevenson'
35
37
  require 'jekyll/deprecator'
36
38
  require 'jekyll/configuration'
@@ -72,10 +74,21 @@ require_all 'jekyll/tags'
72
74
  # plugins
73
75
  require 'jekyll-coffeescript'
74
76
  require 'jekyll-sass-converter'
77
+ require 'jekyll-paginate'
78
+ require 'jekyll-gist'
75
79
 
76
80
  SafeYAML::OPTIONS[:suppress_warnings] = true
77
81
 
78
82
  module Jekyll
83
+
84
+ # Public: Tells you which Jekyll environment you are building in so you can skip tasks
85
+ # if you need to. This is useful when doing expensive compression tasks on css and
86
+ # images and allows you to skip that when working in development.
87
+
88
+ def self.env
89
+ ENV["JEKYLL_ENV"] || "development"
90
+ end
91
+
79
92
  # Public: Generate a Jekyll configuration Hash by merging the default
80
93
  # options with anything in _config.yml, and adding the given options on top.
81
94
  #
@@ -106,7 +119,11 @@ module Jekyll
106
119
  end
107
120
 
108
121
  def self.logger
109
- @logger ||= Stevenson.new
122
+ @logger ||= LogAdapter.new(Stevenson.new)
123
+ end
124
+
125
+ def self.logger=(writer)
126
+ @logger = LogAdapter.new(writer)
110
127
  end
111
128
 
112
129
  # Public: File system root
@@ -30,7 +30,7 @@ module Jekyll
30
30
  def existing_files
31
31
  files = Set.new
32
32
  Dir.glob(File.join(site.dest, "**", "*"), File::FNM_DOTMATCH) do |file|
33
- files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex
33
+ files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex || keep_dirs.include?(file)
34
34
  end
35
35
  files
36
36
  end
@@ -49,7 +49,19 @@ module Jekyll
49
49
  #
50
50
  # Returns a Set with the directory paths
51
51
  def new_dirs
52
- new_files.map { |file| File.dirname(file) }.to_set
52
+ new_files.map { |file| parent_dirs(file) }.flatten.to_set
53
+ end
54
+
55
+ # Private: The list of parent directories of a given file
56
+ #
57
+ # Returns an Array with the directory paths
58
+ def parent_dirs(file)
59
+ parent_dir = File.dirname(file)
60
+ if parent_dir == site.dest
61
+ []
62
+ else
63
+ [parent_dir] + parent_dirs(parent_dir)
64
+ end
53
65
  end
54
66
 
55
67
  # Private: The list of existing files that will be replaced by a directory during build
@@ -59,6 +71,14 @@ module Jekyll
59
71
  new_dirs.select { |dir| File.file?(dir) }.to_set
60
72
  end
61
73
 
74
+ # Private: The list of directories that need to be kept because they are parent directories
75
+ # of files specified in keep_files
76
+ #
77
+ # Returns a Set with the directory paths
78
+ def keep_dirs
79
+ site.keep_files.map{|file| parent_dirs(File.join(site.dest, file))}.flatten.to_set
80
+ end
81
+
62
82
  # Private: Creates a regular expression from the config's keep_files array
63
83
  #
64
84
  # Examples
@@ -52,7 +52,7 @@ module Jekyll
52
52
  def filtered_entries
53
53
  return Array.new unless exists?
54
54
  Dir.chdir(directory) do
55
- entry_filter.filter(entries)
55
+ entry_filter.filter(entries).reject { |f| File.directory?(f) }
56
56
  end
57
57
  end
58
58
 
@@ -105,7 +105,7 @@ module Jekyll
105
105
  #
106
106
  # Returns a sanitized version of the label.
107
107
  def sanitize_label(label)
108
- label.gsub(/[^a-z0-9_\-]/i, '')
108
+ label.gsub(/[^a-z0-9_\-\.]/i, '')
109
109
  end
110
110
 
111
111
  # Produce a representation of this Collection for use in Liquid.
@@ -132,6 +132,13 @@ module Jekyll
132
132
  !!metadata['output']
133
133
  end
134
134
 
135
+ # The URL template to render collection's documents at.
136
+ #
137
+ # Returns the URL template to render collection's documents at.
138
+ def url_template
139
+ metadata.fetch('permalink', "/:collection/:path:output_ext")
140
+ end
141
+
135
142
  # Extract options for this collection from the site configuration.
136
143
  #
137
144
  # Returns the metadata for this collection
@@ -19,19 +19,29 @@ module Jekyll
19
19
  super(base)
20
20
  end
21
21
 
22
- # Listing of all directories (globbed to include subfiles and folders)
22
+ # Paths to ignore for the watch option
23
23
  #
24
- # source - the source path
25
- # destination - the destination path
24
+ # options - A Hash of options passed to the command
26
25
  #
27
- # Returns an Array of directory globs in the source, excluding the destination
28
- def globs(source, destination)
29
- Dir.chdir(source) do
30
- dirs = Dir['*'].select { |x| File.directory?(x) }
31
- dirs -= [destination, File.expand_path(destination), File.basename(destination)]
32
- dirs = dirs.map { |x| "#{x}/**/*" }
33
- dirs += ['*']
26
+ # Returns a list of relative paths from source that should be ignored
27
+ def ignore_paths(options)
28
+ source = options['source']
29
+ destination = options['destination']
30
+ config_files = Configuration[options].config_files(options)
31
+ paths = config_files + Array(destination)
32
+ ignored = []
33
+
34
+ source_abs = Pathname.new(source).expand_path
35
+ paths.each do |p|
36
+ path_abs = Pathname.new(p).expand_path
37
+ begin
38
+ rel_path = path_abs.relative_path_from(source_abs).to_s
39
+ ignored << Regexp.new(Regexp.escape(rel_path)) unless rel_path.start_with?('../')
40
+ rescue ArgumentError
41
+ # Could not find a relative path
42
+ end
34
43
  end
44
+ ignored
35
45
  end
36
46
 
37
47
  # Run Site#process and catch errors
@@ -22,19 +22,23 @@ module Jekyll
22
22
  # Build your jekyll site
23
23
  # Continuously watch if `watch` is set to true in the config.
24
24
  def process(options)
25
+ Jekyll.logger.log_level = :error if options['quiet']
26
+
25
27
  options = configuration_from_options(options)
26
28
  site = Jekyll::Site.new(options)
27
29
 
28
- Jekyll.logger.log_level = :error if options['quiet']
29
-
30
- build(site, options)
30
+ if options.fetch('skip_initial_build', false)
31
+ Jekyll.logger.warn "Build Warning:", "Skipping the initial build. This may result in an out-of-date site."
32
+ else
33
+ build(site, options)
34
+ end
31
35
  watch(site, options) if options['watch']
32
36
  end
33
37
 
34
38
  # Build your Jekyll site.
35
39
  #
36
40
  # site - the Jekyll::Site instance to build
37
- # options - the
41
+ # options - A Hash of options passed to the command
38
42
  #
39
43
  # Returns nothing.
40
44
  def build(site, options)
@@ -54,49 +58,8 @@ module Jekyll
54
58
  #
55
59
  # Returns nothing.
56
60
  def watch(site, options)
57
- require 'listen'
58
-
59
- source = options['source']
60
- destination = options['destination']
61
-
62
- begin
63
- dest = Pathname.new(destination).relative_path_from(Pathname.new(source)).to_s
64
- ignored = Regexp.new(Regexp.escape(dest))
65
- rescue ArgumentError
66
- # Destination is outside the source, no need to ignore it.
67
- ignored = nil
68
- end
69
-
70
- listener = Listen.to(
71
- source,
72
- :ignore => ignored,
73
- :force_polling => options['force_polling']
74
- ) do |modified, added, removed|
75
- t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
76
- n = modified.length + added.length + removed.length
77
- print Jekyll.logger.formatted_topic("Regenerating:") + "#{n} files at #{t} "
78
- begin
79
- process_site(site)
80
- puts "...done."
81
- rescue => e
82
- puts "...error:"
83
- Jekyll.logger.warn "Error:", e.message
84
- Jekyll.logger.warn "Error:", "Run jekyll build --trace for more information."
85
- end
86
- end
87
- listener.start
88
-
89
- Jekyll.logger.info "Auto-regeneration:", "enabled"
90
-
91
- unless options['serving']
92
- trap("INT") do
93
- listener.stop
94
- puts " Halting auto-regeneration."
95
- exit 0
96
- end
97
-
98
- loop { sleep 1000 }
99
- end
61
+ require 'jekyll-watch'
62
+ Jekyll::Commands::Watch.watch(site, options)
100
63
  end
101
64
 
102
65
  end # end of class << self
@@ -17,6 +17,7 @@ module Jekyll
17
17
  c.option 'port', '-P', '--port [PORT]', 'Port to listen on'
18
18
  c.option 'host', '-H', '--host [HOST]', 'Host to bind to'
19
19
  c.option 'baseurl', '-b', '--baseurl [URL]', 'Base URL'
20
+ c.option 'skip_initial_build', '--skip-initial-build', 'Skips the initial site build which occurs before the server is started.'
20
21
 
21
22
  c.action do |args, options|
22
23
  options["serving"] ||= true
@@ -40,6 +40,7 @@ module Jekyll
40
40
  'markdown_ext' => 'markdown,mkdown,mkdn,mkd,md',
41
41
  'textile_ext' => 'textile',
42
42
 
43
+ 'quiet' => false,
43
44
  'port' => '4000',
44
45
  'host' => '0.0.0.0',
45
46
 
@@ -103,6 +104,10 @@ module Jekyll
103
104
  override['source'] || self['source'] || DEFAULTS['source']
104
105
  end
105
106
 
107
+ def quiet?(override = {})
108
+ override['quiet'] || self['quiet'] || DEFAULTS['quiet']
109
+ end
110
+
106
111
  def safe_load_file(filename)
107
112
  case File.extname(filename)
108
113
  when '.toml'
@@ -120,10 +125,16 @@ module Jekyll
120
125
  #
121
126
  # Returns an Array of config files
122
127
  def config_files(override)
128
+ # Be quiet quickly.
129
+ Jekyll.logger.log_level = :error if quiet?(override)
130
+
123
131
  # Get configuration from <source>/_config.yml or <source>/<config_file>
124
132
  config_files = override.delete('config')
125
133
  if config_files.to_s.empty?
126
- config_files = File.join(source(override), "_config.yml")
134
+ default = %w[yml yaml].find(Proc.new { 'yml' }) do |ext|
135
+ File.exists? Jekyll.sanitized_path(source(override), "_config.#{ext}")
136
+ end
137
+ config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
127
138
  @default_config_file = true
128
139
  end
129
140
  config_files = [config_files] unless config_files.is_a? Array
@@ -231,6 +242,7 @@ module Jekyll
231
242
  " as a list of comma-separated values."
232
243
  config[option] = csv_to_array(config[option])
233
244
  end
245
+ config[option].map!(&:to_s)
234
246
  end
235
247
 
236
248
  if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
@@ -67,8 +67,15 @@ module Jekyll
67
67
  end
68
68
  when 'rouge'
69
69
  Class.new(Redcarpet::Render::HTML) do
70
- require 'rouge'
71
- require 'rouge/plugins/redcarpet'
70
+ begin
71
+ require 'rouge'
72
+ require 'rouge/plugins/redcarpet'
73
+ rescue LoadError => e
74
+ Jekyll.logger.error "You are missing the 'rouge' gem. Please run:"
75
+ Jekyll.logger.error " $ [sudo] gem install rouge"
76
+ Jekyll.logger.error "Or add 'rouge' to your Gemfile."
77
+ raise FatalException.new("Missing dependency: rouge")
78
+ end
72
79
 
73
80
  if Rouge.version < '1.3.0'
74
81
  abort "Please install Rouge 1.3.0 or greater and try running Jekyll again."
@@ -114,6 +114,10 @@ module Jekyll
114
114
  Utils.deep_merge_hashes defaults, Utils.deep_merge_hashes(data, further_data)
115
115
  end
116
116
 
117
+ # The type of a document,
118
+ # i.e., its classname downcase'd and to_sym'd.
119
+ #
120
+ # Returns the type of self.
117
121
  def type
118
122
  if is_a?(Post)
119
123
  :post
@@ -124,6 +128,31 @@ module Jekyll
124
128
  end
125
129
  end
126
130
 
131
+ # Determine whether the document is an asset file.
132
+ # Asset files include CoffeeScript files and Sass/SCSS files.
133
+ #
134
+ # Returns true if the extname belongs to the set of extensions
135
+ # that asset files use.
136
+ def asset_file?
137
+ %w[.sass .scss .coffee].include?(ext)
138
+ end
139
+
140
+ # Determine whether the file should be rendered with Liquid.
141
+ #
142
+ # Returns false if the document is either an asset file or a yaml file,
143
+ # true otherwise.
144
+ def render_with_liquid?
145
+ !asset_file?
146
+ end
147
+
148
+ # Determine whether the file should be placed into layouts.
149
+ #
150
+ # Returns false if the document is either an asset file or a yaml file,
151
+ # true otherwise.
152
+ def place_in_layout?
153
+ !asset_file?
154
+ end
155
+
127
156
  # Recursively render layouts
128
157
  #
129
158
  # layouts - a list of the layouts
@@ -167,13 +196,13 @@ module Jekyll
167
196
  payload["highlighter_prefix"] = converter.highlighter_prefix
168
197
  payload["highlighter_suffix"] = converter.highlighter_suffix
169
198
 
170
- self.content = render_liquid(content, payload, info)
199
+ self.content = render_liquid(content, payload, info) if render_with_liquid?
171
200
  transform
172
201
 
173
202
  # output keeps track of what will finally be written
174
203
  self.output = content
175
204
 
176
- render_all_layouts(layouts, payload, info)
205
+ render_all_layouts(layouts, payload, info) if place_in_layout?
177
206
  end
178
207
 
179
208
  # Write the generated page file to the destination directory.