jekyll 0.11.2 → 0.12.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.

@@ -1,3 +1,22 @@
1
+ == 0.12.0 / 2012-12-22
2
+ * Minor Enhancements
3
+ * Add ability to explicitly specify included files (#261)
4
+ * Add --default-mimetype option (#279)
5
+ * Allow setting of RedCloth options (#284)
6
+ * Add post_url Liquid tag for internal post linking (#369)
7
+ * Allow multiple plugin dirs to be specified (#438)
8
+ * Inline TOC token support for RDiscount (#333)
9
+ * Add the option to specify the paginated url format (#342)
10
+ * Support Redcarpet 2 and fenced code blocks (#619)
11
+ * Better reporting of Liquid errors (#624)
12
+ * Bug Fixes
13
+ * Allow some special characters in highlight names
14
+ * URL escape category names in URL generation (#360)
15
+ * Fix error with limit_posts (#442)
16
+ * Properly select dotfile during directory scan (#363, #431, #377)
17
+ * Allow setting of Kramdown smart_quotes (#482)
18
+ * Ensure front-matter is at start of file (#562)
19
+
1
20
  == 0.11.2 / 2011-12-27
2
21
  * Bug Fixes
3
22
  * Fix gemspec
data/Rakefile CHANGED
@@ -50,10 +50,6 @@ task :default => [:test, :features]
50
50
 
51
51
  require 'rake/testtask'
52
52
  Rake::TestTask.new(:test) do |test|
53
- if `which pygmentize` == ''
54
- puts "You must have Pygments installed to run the tests."
55
- exit 1
56
- end
57
53
  test.libs << 'lib' << 'test'
58
54
  test.pattern = 'test/**/test_*.rb'
59
55
  test.verbose = true
@@ -163,4 +159,4 @@ task :gemspec do
163
159
  spec = [head, manifest, tail].join(" # = MANIFEST =\n")
164
160
  File.open(gemspec_file, 'w') { |io| io.write(spec) }
165
161
  puts "Updated #{gemspec_file}"
166
- end
162
+ end
data/bin/jekyll CHANGED
@@ -71,6 +71,10 @@ opts = OptionParser.new do |opts|
71
71
  options['baseurl'] = baseurl
72
72
  end
73
73
 
74
+ opts.on("--default-mimetype [MT]", "Mimetype to use when no file extension (if --server)") do |mt|
75
+ options['default-mimetype'] = mt
76
+ end
77
+
74
78
  opts.on("--[no-]lsi", "Use LSI for better related posts") do |lsi|
75
79
  options['lsi'] = lsi
76
80
  end
@@ -102,7 +106,7 @@ opts = OptionParser.new do |opts|
102
106
  opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
103
107
  options['permalink'] = style unless style.nil?
104
108
  end
105
-
109
+
106
110
  opts.on("--paginate [POSTS_PER_PAGE]", "Paginate a blog's posts") do |per_page|
107
111
  begin
108
112
  options['paginate'] = per_page.to_i
@@ -113,6 +117,16 @@ opts = OptionParser.new do |opts|
113
117
  end
114
118
  end
115
119
 
120
+ opts.on("--paginate_path [PAGINATED_URL_FORMAT]", "Leave blank for /page<num>") do |paginate_path|
121
+ begin
122
+ options['paginate_path'] = paginate_path
123
+ raise ArgumentError if options['paginate_path'].nil?
124
+ rescue
125
+ puts 'You must specify a pagination url format'
126
+ exit 0
127
+ end
128
+ end
129
+
116
130
  opts.on("--limit_posts [MAX_POSTS]", "Limit the number of posts to publish") do |limit_posts|
117
131
  begin
118
132
  options['limit_posts'] = limit_posts.to_i
@@ -148,12 +162,12 @@ if ARGV.size > 0
148
162
  else
149
163
  migrator = migrator.downcase
150
164
  end
151
-
165
+
152
166
  cmd_options = []
153
167
  ['file', 'dbname', 'user', 'pass', 'host', 'site'].each do |p|
154
168
  cmd_options << "\"#{options[p]}\"" unless options[p].nil?
155
169
  end
156
-
170
+
157
171
  # It's import time
158
172
  puts "Importing..."
159
173
 
@@ -162,7 +176,7 @@ if ARGV.size > 0
162
176
  migrators = {
163
177
  :posterous => 'Posterous',
164
178
  :wordpressdotcom => 'WordpressDotCom',
165
- :wordpress => 'Wordpress',
179
+ :wordpress => 'WordPress',
166
180
  :csv => 'CSV',
167
181
  :drupal => 'Drupal',
168
182
  :enki => 'Enki',
@@ -191,7 +205,7 @@ end
191
205
 
192
206
 
193
207
 
194
- # Get source and destintation from command line
208
+ # Get source and destination from command line
195
209
  case ARGV.size
196
210
  when 0
197
211
  when 1
@@ -267,6 +281,9 @@ if options['server']
267
281
 
268
282
  mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
269
283
  mime_types.store 'js', 'application/javascript'
284
+ if options['default-mimetype']
285
+ mime_types.store(nil, options['default-mimetype'])
286
+ end
270
287
 
271
288
  s = HTTPServer.new(
272
289
  :Port => options['server_port'],
@@ -92,3 +92,21 @@ Feature: Create sites
92
92
  When I debug jekyll
93
93
  Then the _site directory should exist
94
94
  And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
95
+
96
+ Scenario: Basic site with internal post linking
97
+ Given I have an "index.html" page that contains "URL: {% post_url 2020-01-31-entry2 %}"
98
+ And I have a configuration file with "permalink" set to "pretty"
99
+ And I have a _posts directory
100
+ And I have the following posts:
101
+ | title | date | layout | content |
102
+ | entry1 | 12/31/2007 | post | content for entry1. |
103
+ | entry2 | 01/31/2020 | post | content for entry2. |
104
+ When I run jekyll
105
+ Then the _site directory should exist
106
+ And I should see "URL: /2020/01/31/entry2/" in "_site/index.html"
107
+
108
+ Scenario: Basic site with whitelisted dotfile
109
+ Given I have an ".htaccess" file that contains "SomeDirective"
110
+ When I run jekyll
111
+ Then the _site directory should exist
112
+ And I should see "SomeDirective" in "_site/.htaccess"
@@ -19,9 +19,36 @@ Feature: Site pagination
19
19
  And the "_site/page<exist>/index.html" file should exist
20
20
  And I should see "<posts>" in "_site/page<exist>/index.html"
21
21
  And the "_site/page<not_exist>/index.html" file should not exist
22
-
22
+
23
23
  Examples:
24
24
  | num | exist | posts | not_exist |
25
25
  | 1 | 4 | 1 | 5 |
26
26
  | 2 | 2 | 2 | 3 |
27
27
  | 3 | 2 | 1 | 3 |
28
+
29
+ Scenario Outline: Setting a custom pagination path
30
+ Given I have a configuration file with:
31
+ | key | value |
32
+ | paginate | 1 |
33
+ | paginate_path | /blog/page-:num |
34
+ | permalink | /blog/:year/:month/:day/:title |
35
+ And I have a _layouts directory
36
+ And I have an "index.html" page that contains "{{ paginator.posts.size }}"
37
+ And I have a _posts directory
38
+ And I have the following post:
39
+ | title | date | layout | content |
40
+ | Wargames | 3/27/2009 | default | The only winning move is not to play. |
41
+ | Wargames2 | 4/27/2009 | default | The only winning move is not to play2. |
42
+ | Wargames3 | 5/27/2009 | default | The only winning move is not to play3. |
43
+ | Wargames4 | 6/27/2009 | default | The only winning move is not to play4. |
44
+ When I run jekyll
45
+ Then the _site/blog/page-<exist> directory should exist
46
+ And the "_site/blog/page-<exist>/index.html" file should exist
47
+ And I should see "<posts>" in "_site/blog/page-<exist>/index.html"
48
+ And the "_site/blog/page-<not_exist>/index.html" file should not exist
49
+
50
+ Examples:
51
+ | exist | posts | not_exist |
52
+ | 2 | 1 | 5 |
53
+ | 3 | 1 | 6 |
54
+ | 4 | 1 | 7 |
@@ -131,3 +131,36 @@ Feature: Site configuration
131
131
  And the "_site/2009/04/05/bananas.html" file should exist
132
132
  And the "_site/2009/04/01/oranges.html" file should exist
133
133
  And the "_site/2009/03/27/apples.html" file should not exist
134
+
135
+ Scenario: Copy over normally excluded files when they are explicitly included
136
+ Given I have a ".gitignore" file that contains ".DS_Store"
137
+ And I have an ".htaccess" file that contains "SomeDirective"
138
+ And I have a configuration file with "include" set to:
139
+ | value |
140
+ | .gitignore |
141
+ | .foo |
142
+ When I run jekyll
143
+ Then the _site directory should exist
144
+ And I should see ".DS_Store" in "_site/.gitignore"
145
+ And the "_site/.htaccess" file should not exist
146
+
147
+ Scenario: Using a different layouts directory
148
+ Given I have a _theme directory
149
+ And I have a page theme that contains "Page Layout: {{ site.posts.size }} on {{ site.time | date: "%Y-%m-%d" }}"
150
+ And I have a post theme that contains "Post Layout: {{ content }}"
151
+ And I have an "index.html" page with layout "page" that contains "site index page"
152
+ And I have a configuration file with:
153
+ | key | value |
154
+ | time | 2010-01-01 |
155
+ | future | true |
156
+ | layouts | _theme |
157
+ And I have a _posts directory
158
+ And I have the following posts:
159
+ | title | date | layout | content |
160
+ | entry1 | 12/31/2007 | post | content for entry1. |
161
+ | entry2 | 01/31/2020 | post | content for entry2. |
162
+ When I run jekyll
163
+ Then the _site directory should exist
164
+ And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
165
+ And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
166
+ And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
@@ -39,6 +39,13 @@ Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text|
39
39
  end
40
40
  end
41
41
 
42
+ Given /^I have a (.*) theme that contains "(.*)"$/ do |layout, text|
43
+ File.open(File.join('_theme', layout + '.html'), 'w') do |f|
44
+ f.write(text)
45
+ f.close
46
+ end
47
+ end
48
+
42
49
  Given /^I have an? (.*) directory$/ do |dir|
43
50
  FileUtils.mkdir_p(dir)
44
51
  end
@@ -121,7 +128,7 @@ When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
121
128
  end
122
129
 
123
130
  Then /^the (.*) directory should exist$/ do |dir|
124
- assert File.directory?(dir)
131
+ assert File.directory?(dir), "The directory \"#{dir}\" does not exist"
125
132
  end
126
133
 
127
134
  Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
@@ -4,8 +4,9 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'jekyll'
7
- s.version = '0.11.2'
8
- s.date = '2011-12-27'
7
+ s.version = '0.12.0'
8
+ s.license = 'MIT'
9
+ s.date = '2012-12-22'
9
10
  s.rubyforge_project = 'jekyll'
10
11
 
11
12
  s.summary = "A simple, blog aware, static site generator."
@@ -26,8 +27,8 @@ Gem::Specification.new do |s|
26
27
  s.add_runtime_dependency('classifier', "~> 1.3")
27
28
  s.add_runtime_dependency('directory_watcher', "~> 1.1")
28
29
  s.add_runtime_dependency('maruku', "~> 0.5")
29
- s.add_runtime_dependency('kramdown', "~> 0.13")
30
- s.add_runtime_dependency('albino', "~> 1.3")
30
+ s.add_runtime_dependency('kramdown', "~> 0.13.4")
31
+ s.add_runtime_dependency('pygments.rb', "~> 0.3.2")
31
32
 
32
33
  s.add_development_dependency('rake', "~> 0.9")
33
34
  s.add_development_dependency('rdoc', "~> 3.11")
@@ -37,7 +38,7 @@ Gem::Specification.new do |s|
37
38
  s.add_development_dependency('cucumber', "1.1")
38
39
  s.add_development_dependency('RedCloth', "~> 4.2")
39
40
  s.add_development_dependency('rdiscount', "~> 1.6")
40
- s.add_development_dependency('redcarpet', "~> 1.9")
41
+ s.add_development_dependency('redcarpet', "~> 2.1.1")
41
42
 
42
43
  # = MANIFEST =
43
44
  s.files = %w[
@@ -74,10 +75,12 @@ Gem::Specification.new do |s|
74
75
  lib/jekyll/migrators/csv.rb
75
76
  lib/jekyll/migrators/drupal.rb
76
77
  lib/jekyll/migrators/enki.rb
78
+ lib/jekyll/migrators/joomla.rb
77
79
  lib/jekyll/migrators/marley.rb
78
80
  lib/jekyll/migrators/mephisto.rb
79
81
  lib/jekyll/migrators/mt.rb
80
82
  lib/jekyll/migrators/posterous.rb
83
+ lib/jekyll/migrators/rss.rb
81
84
  lib/jekyll/migrators/textpattern.rb
82
85
  lib/jekyll/migrators/tumblr.rb
83
86
  lib/jekyll/migrators/typo.rb
@@ -90,6 +93,9 @@ Gem::Specification.new do |s|
90
93
  lib/jekyll/static_file.rb
91
94
  lib/jekyll/tags/highlight.rb
92
95
  lib/jekyll/tags/include.rb
96
+ lib/jekyll/tags/post_url.rb
97
+ test/fixtures/broken_front_matter1.erb
98
+ test/fixtures/front_matter.erb
93
99
  test/helper.rb
94
100
  test/source/.htaccess
95
101
  test/source/_includes/sig.markdown
@@ -132,6 +138,7 @@ Gem::Specification.new do |s|
132
138
  test/source/z_category/_posts/2008-9-23-categories.textile
133
139
  test/suite.rb
134
140
  test/test_configuration.rb
141
+ test/test_convertible.rb
135
142
  test/test_core_ext.rb
136
143
  test/test_filters.rb
137
144
  test/test_generated_site.rb
@@ -141,6 +148,7 @@ Gem::Specification.new do |s|
141
148
  test/test_post.rb
142
149
  test/test_rdiscount.rb
143
150
  test/test_redcarpet.rb
151
+ test/test_redcloth.rb
144
152
  test/test_site.rb
145
153
  test/test_tags.rb
146
154
  ]
@@ -24,7 +24,7 @@ require 'English'
24
24
  # 3rd party
25
25
  require 'liquid'
26
26
  require 'maruku'
27
- require 'albino'
27
+ require 'pygments'
28
28
 
29
29
  # internal requires
30
30
  require 'jekyll/core_ext'
@@ -46,47 +46,54 @@ require_all 'jekyll/generators'
46
46
  require_all 'jekyll/tags'
47
47
 
48
48
  module Jekyll
49
- VERSION = '0.11.2'
49
+ VERSION = '0.12.0'
50
50
 
51
51
  # Default options. Overriden by values in _config.yml or command-line opts.
52
- # (Strings rather symbols used for compatability with YAML).
52
+ # Strings rather than symbols are used for compatability with YAML.
53
53
  DEFAULTS = {
54
- 'safe' => false,
55
- 'auto' => false,
56
- 'server' => false,
57
- 'server_port' => 4000,
58
-
59
- 'source' => Dir.pwd,
60
- 'destination' => File.join(Dir.pwd, '_site'),
61
- 'plugins' => File.join(Dir.pwd, '_plugins'),
62
-
63
- 'future' => true,
64
- 'lsi' => false,
65
- 'pygments' => false,
66
- 'markdown' => 'maruku',
67
- 'permalink' => 'date',
68
-
69
- 'markdown_ext' => 'markdown,mkd,mkdn,md',
70
- 'textile_ext' => 'textile',
71
-
72
- 'maruku' => {
54
+ 'safe' => false,
55
+ 'auto' => false,
56
+ 'server' => false,
57
+ 'server_port' => 4000,
58
+
59
+ 'source' => Dir.pwd,
60
+ 'destination' => File.join(Dir.pwd, '_site'),
61
+ 'plugins' => File.join(Dir.pwd, '_plugins'),
62
+ 'layouts' => '_layouts',
63
+
64
+ 'future' => true,
65
+ 'lsi' => false,
66
+ 'pygments' => false,
67
+ 'markdown' => 'maruku',
68
+ 'permalink' => 'date',
69
+ 'include' => ['.htaccess'],
70
+ 'paginate_path' => 'page:num',
71
+
72
+ 'markdown_ext' => 'markdown,mkd,mkdn,md',
73
+ 'textile_ext' => 'textile',
74
+
75
+ 'maruku' => {
73
76
  'use_tex' => false,
74
77
  'use_divs' => false,
75
78
  'png_engine' => 'blahtex',
76
79
  'png_dir' => 'images/latex',
77
80
  'png_url' => '/images/latex'
78
81
  },
79
- 'rdiscount' => {
82
+
83
+ 'rdiscount' => {
80
84
  'extensions' => []
81
85
  },
82
- 'redcarpet' => {
86
+
87
+ 'redcarpet' => {
83
88
  'extensions' => []
84
89
  },
85
- 'kramdown' => {
90
+
91
+ 'kramdown' => {
86
92
  'auto_ids' => true,
87
93
  'footnote_nr' => 1,
88
94
  'entity_output' => 'as_char',
89
95
  'toc_levels' => '1..6',
96
+ 'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo',
90
97
  'use_coderay' => false,
91
98
 
92
99
  'coderay' => {
@@ -97,6 +104,10 @@ module Jekyll
97
104
  'coderay_bold_every' => 10,
98
105
  'coderay_css' => 'style'
99
106
  }
107
+ },
108
+
109
+ 'redcloth' => {
110
+ 'hard_breaks' => true
100
111
  }
101
112
  }
102
113
 
@@ -8,12 +8,28 @@ module Jekyll
8
8
 
9
9
  def setup
10
10
  return if @setup
11
- # Set the Markdown interpreter (and Maruku self.config, if necessary)
12
11
  case @config['markdown']
13
12
  when 'redcarpet'
14
13
  begin
15
14
  require 'redcarpet'
16
- @redcarpet_extensions = @config['redcarpet']['extensions'].map { |e| e.to_sym }
15
+
16
+ @renderer ||= Class.new(Redcarpet::Render::HTML) do
17
+ def block_code(code, lang)
18
+ lang = lang && lang.split.first || "text"
19
+ output = add_code_tags(
20
+ Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
21
+ lang
22
+ )
23
+ end
24
+
25
+ def add_code_tags(code, lang)
26
+ code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
27
+ code = code.sub(/<\/pre>/,"</code></pre>")
28
+ end
29
+ end
30
+
31
+ @redcarpet_extensions = {}
32
+ @config['redcarpet']['extensions'].each { |e| @redcarpet_extensions[e.to_sym] = true }
17
33
  rescue LoadError
18
34
  STDERR.puts 'You are missing a library required for Markdown. Please run:'
19
35
  STDERR.puts ' $ [sudo] gem install redcarpet'
@@ -30,8 +46,6 @@ module Jekyll
30
46
  when 'rdiscount'
31
47
  begin
32
48
  require 'rdiscount'
33
-
34
- # Load rdiscount extensions
35
49
  @rdiscount_extensions = @config['rdiscount']['extensions'].map { |e| e.to_sym }
36
50
  rescue LoadError
37
51
  STDERR.puts 'You are missing a library required for Markdown. Please run:'
@@ -88,7 +102,10 @@ module Jekyll
88
102
  setup
89
103
  case @config['markdown']
90
104
  when 'redcarpet'
91
- Redcarpet.new(content, *@redcarpet_extensions).to_html
105
+ @redcarpet_extensions[:fenced_code_blocks] = !@redcarpet_extensions[:no_fenced_code_blocks]
106
+ @renderer.send :include, Redcarpet::Render::SmartyPants if @redcarpet_extensions[:smart]
107
+ markdown = Redcarpet::Markdown.new(@renderer.new(@redcarpet_extensions), @redcarpet_extensions)
108
+ markdown.render(content)
92
109
  when 'kramdown'
93
110
  # Check for use of coderay
94
111
  if @config['kramdown']['use_coderay']
@@ -97,6 +114,7 @@ module Jekyll
97
114
  :footnote_nr => @config['kramdown']['footnote_nr'],
98
115
  :entity_output => @config['kramdown']['entity_output'],
99
116
  :toc_levels => @config['kramdown']['toc_levels'],
117
+ :smart_quotes => @config['kramdown']['smart_quotes'],
100
118
 
101
119
  :coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'],
102
120
  :coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'],
@@ -111,11 +129,17 @@ module Jekyll
111
129
  :auto_ids => @config['kramdown']['auto_ids'],
112
130
  :footnote_nr => @config['kramdown']['footnote_nr'],
113
131
  :entity_output => @config['kramdown']['entity_output'],
114
- :toc_levels => @config['kramdown']['toc_levels']
132
+ :toc_levels => @config['kramdown']['toc_levels'],
133
+ :smart_quotes => @config['kramdown']['smart_quotes']
115
134
  }).to_html
116
135
  end
117
136
  when 'rdiscount'
118
- RDiscount.new(content, *@rdiscount_extensions).to_html
137
+ rd = RDiscount.new(content, *@rdiscount_extensions)
138
+ html = rd.to_html
139
+ if rd.generate_toc and html.include?(@config['rdiscount']['toc_token'])
140
+ html.gsub!(@config['rdiscount']['toc_token'], rd.toc_content)
141
+ end
142
+ html
119
143
  when 'maruku'
120
144
  Maruku.new(content).to_html
121
145
  end