jekyll 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (64) hide show
  1. data/Gemfile +2 -0
  2. data/History.txt +20 -1
  3. data/README.textile +1 -1
  4. data/Rakefile +2 -0
  5. data/bin/jekyll +92 -2
  6. data/doc/output/book.html +574 -0
  7. data/doc/output/ch00-preface.asc +41 -0
  8. data/doc/output/ch01-quick-start.asc +153 -0
  9. data/doc/output/ch02-directory-layout.asc +90 -0
  10. data/doc/output/stylesheets/handbookish-quirks.css +0 -0
  11. data/doc/output/stylesheets/handbookish.css +231 -0
  12. data/doc/output/stylesheets/scribe-quirks.css +0 -0
  13. data/doc/output/stylesheets/scribe.css +177 -0
  14. data/features/post_data.feature +2 -2
  15. data/features/site_configuration.feature +7 -0
  16. data/features/support/env.rb +3 -0
  17. data/g.pl +48 -0
  18. data/jekyll.gemspec +35 -16
  19. data/lib/jekyll.rb +11 -4
  20. data/lib/jekyll/converters/markdown.rb +14 -2
  21. data/lib/jekyll/converters/textile.rb +2 -1
  22. data/lib/jekyll/convertible.rb +34 -19
  23. data/lib/jekyll/filters.rb +66 -1
  24. data/lib/jekyll/generators/pagination.rb +33 -7
  25. data/lib/jekyll/layout.rb +18 -10
  26. data/lib/jekyll/migrators/csv.rb +3 -3
  27. data/lib/jekyll/migrators/drupal.rb +12 -6
  28. data/lib/jekyll/migrators/enki.rb +49 -0
  29. data/lib/jekyll/migrators/marley.rb +0 -1
  30. data/lib/jekyll/migrators/mephisto.rb +17 -12
  31. data/lib/jekyll/migrators/mt.rb +26 -17
  32. data/lib/jekyll/migrators/posterous.rb +68 -0
  33. data/lib/jekyll/migrators/textpattern.rb +15 -8
  34. data/lib/jekyll/migrators/tumblr.rb +119 -0
  35. data/lib/jekyll/migrators/typo.rb +8 -6
  36. data/lib/jekyll/migrators/wordpress.rb +23 -16
  37. data/lib/jekyll/migrators/wordpressdotcom.rb +70 -0
  38. data/lib/jekyll/page.rb +56 -35
  39. data/lib/jekyll/plugin.rb +1 -0
  40. data/lib/jekyll/post.rb +25 -14
  41. data/lib/jekyll/site.rb +138 -80
  42. data/lib/jekyll/static_file.rb +12 -15
  43. data/lib/jekyll/tags/highlight.rb +5 -5
  44. data/output/stylesheets/scribe-quirks.css +0 -0
  45. data/output/stylesheets/scribe.css +177 -0
  46. data/test/helper.rb +3 -3
  47. data/test/source/_posts/2011-04-12-md-extension.md +7 -0
  48. data/test/source/_posts/2011-04-12-text-extension.text +0 -0
  49. data/test/suite.rb +3 -1
  50. data/test/test_configuration.rb +1 -1
  51. data/test/test_core_ext.rb +1 -1
  52. data/test/test_filters.rb +10 -1
  53. data/test/test_generated_site.rb +2 -2
  54. data/test/test_kramdown.rb +1 -1
  55. data/test/test_page.rb +1 -1
  56. data/test/test_pager.rb +1 -1
  57. data/test/test_post.rb +49 -2
  58. data/test/test_rdiscount.rb +1 -1
  59. data/test/test_redcarpet.rb +21 -0
  60. data/test/test_site.rb +1 -1
  61. data/test/test_tags.rb +14 -1
  62. metadata +104 -38
  63. data/lib/jekyll/albino.rb +0 -120
  64. data/lib/jekyll/migrators/wordpress.com.rb +0 -38
@@ -1,15 +1,15 @@
1
1
  module Jekyll
2
2
 
3
3
  class StaticFile
4
- @@mtimes = Hash.new # the cache of last modification times [path] -> mtime
4
+ # The cache of last modification times [path] -> mtime.
5
+ @@mtimes = Hash.new
5
6
 
6
7
  # Initialize a new StaticFile.
7
- # +site+ is the Site
8
- # +base+ is the String path to the <source>
9
- # +dir+ is the String path between <source> and the file
10
- # +name+ is the String filename of the file
11
8
  #
12
- # Returns <StaticFile>
9
+ # site - The Site.
10
+ # base - The String path to the <source>.
11
+ # dir - The String path between <source> and the file.
12
+ # name - The String filename of the file.
13
13
  def initialize(site, base, dir, name)
14
14
  @site = site
15
15
  @base = base
@@ -17,24 +17,21 @@ module Jekyll
17
17
  @name = name
18
18
  end
19
19
 
20
- # Obtains source file path.
21
- #
22
20
  # Returns source file path.
23
21
  def path
24
22
  File.join(@base, @dir, @name)
25
23
  end
26
24
 
27
25
  # Obtain destination path.
28
- # +dest+ is the String path to the destination dir
26
+ #
27
+ # dest - The String path to the destination dir.
29
28
  #
30
29
  # Returns destination file path.
31
30
  def destination(dest)
32
31
  File.join(dest, @dir, @name)
33
32
  end
34
33
 
35
- # Obtain mtime of the source path.
36
- #
37
- # Returns last modifiaction time for this file.
34
+ # Returns last modification time for this file.
38
35
  def mtime
39
36
  File.stat(path).mtime.to_i
40
37
  end
@@ -47,13 +44,14 @@ module Jekyll
47
44
  end
48
45
 
49
46
  # Write the static file to the destination directory (if modified).
50
- # +dest+ is the String path to the destination dir
47
+ #
48
+ # dest - The String path to the destination dir.
51
49
  #
52
50
  # Returns false if the file was not modified since last time (no-op).
53
51
  def write(dest)
54
52
  dest_path = destination(dest)
55
53
 
56
- return false if File.exist? dest_path and !modified?
54
+ return false if File.exist?(dest_path) and !modified?
57
55
  @@mtimes[path] = mtime
58
56
 
59
57
  FileUtils.mkdir_p(File.dirname(dest_path))
@@ -67,7 +65,6 @@ module Jekyll
67
65
  # Returns nothing.
68
66
  def self.reset_cache
69
67
  @@mtimes = Hash.new
70
-
71
68
  nil
72
69
  end
73
70
  end
@@ -3,7 +3,7 @@ module Jekyll
3
3
  class HighlightBlock < Liquid::Block
4
4
  include Liquid::StandardFilters
5
5
 
6
- # we need a language, but the linenos argument is optional.
6
+ # We need a language, but the linenos argument is optional.
7
7
  SYNTAX = /(\w+)\s?([\w\s=]+)*/
8
8
 
9
9
  def initialize(tag_name, markup, tokens)
@@ -24,7 +24,7 @@ module Jekyll
24
24
  tmp_options[key] = value
25
25
  end
26
26
  tmp_options = tmp_options.to_a.collect { |opt| opt.join('=') }
27
- # additional options to pass to Albino.
27
+ # additional options to pass to Albino
28
28
  @options = { 'O' => tmp_options.join(',') }
29
29
  else
30
30
  @options = {}
@@ -50,7 +50,7 @@ module Jekyll
50
50
  end
51
51
 
52
52
  def render_codehighlighter(context, code)
53
- #The div is required because RDiscount blows ass
53
+ #The div is required because RDiscount blows ass
54
54
  <<-HTML
55
55
  <div>
56
56
  <pre>
@@ -59,13 +59,13 @@ module Jekyll
59
59
  </div>
60
60
  HTML
61
61
  end
62
-
62
+
63
63
  def add_code_tags(code, lang)
64
64
  # Add nested <code> tags to code blocks
65
65
  code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
66
66
  code = code.sub(/<\/pre>/,"</code></pre>")
67
67
  end
68
-
68
+
69
69
  end
70
70
 
71
71
  end
File without changes
@@ -0,0 +1,177 @@
1
+ /* ---------------------------------------------------------------------------
2
+ Bare AsciiDoc styles
3
+ Ryan Tomayko <r@tomayko.com>
4
+ --------------------------------------------------------------------------- */
5
+
6
+ body {
7
+ font-family:verdana,helvetica,arial,sans-serif;
8
+ font-size:81.25%; /* 13px */
9
+ line-height:1.538; /* 20px */
10
+ margin:40px auto 50px auto;
11
+ max-width:53.8461538462em; /* 790px */
12
+ color:#333;
13
+ }
14
+
15
+ em {
16
+ font-style:italic;
17
+ }
18
+
19
+ strong {
20
+ font-weight:bold;
21
+ color:#000;
22
+ }
23
+
24
+ tt {
25
+ font-family:consolas, 'lucida console', 'bitstream vera sans mono',
26
+ 'courier new', monospace;
27
+ color:#000;
28
+ }
29
+
30
+ p, ul, ol, dl {
31
+ margin:10px 0
32
+ }
33
+
34
+ dl {
35
+ margin-left:40px
36
+ }
37
+
38
+ dt {
39
+ font-weight:normal;
40
+ color:#000;
41
+ }
42
+
43
+ h1, h2, h3, h4, h5 {
44
+ font-family:'lucida grande',georgia,verdana,helvetica,arial,sans-serif;
45
+ font-weight:normal;
46
+ color:#000;
47
+ }
48
+
49
+ h1 {
50
+ font-size:40px;
51
+ line-height:1.428;
52
+ margin:20px 0;
53
+ }
54
+
55
+ h2 {
56
+ font-size:30px;
57
+ line-height:1.36363636; /* repeating, of course */
58
+ margin:60px 0 20px 0;
59
+ }
60
+
61
+ h2 + .sectionbody {}
62
+
63
+ h3 {
64
+ font-size:24px;
65
+ line-height:1.1;
66
+ margin:30px 0 10px 0;
67
+ }
68
+
69
+ h4 {
70
+ font-size:18px;
71
+ line-height:1.1;
72
+ margin:20px 0 5px 0;
73
+ }
74
+
75
+ h5 {
76
+ font-size:13px;
77
+ font-style:italic;
78
+ line-height:1.1;
79
+ }
80
+
81
+ #header {
82
+ text-align:center;
83
+ margin-bottom:30px;
84
+ }
85
+
86
+ #header h1 { margin-bottom:0 }
87
+
88
+ .title, .sidebar-title {
89
+ font-weight:normal;
90
+ color:#000;
91
+ margin-bottom:0;
92
+ }
93
+
94
+ .admonitionblock .title {
95
+ font-weight:bold;
96
+ }
97
+
98
+ .admonitionblock {
99
+ margin:30px 0px;
100
+ color:#555;
101
+ }
102
+
103
+ .admonitionblock td.icon {
104
+ width:30px;
105
+ padding-right:20px;
106
+ padding-left:20px;
107
+ text-transform:uppercase;
108
+ font-weight:bold;
109
+ color:#888;
110
+ }
111
+
112
+ .listingblock {
113
+ margin: 13px 0;
114
+ }
115
+
116
+ .listingblock .content {
117
+ border:1px solid silver;
118
+ background:#eee;
119
+ padding:5px;
120
+ }
121
+
122
+ .listingblock .content pre {
123
+ margin:0;
124
+ }
125
+
126
+ .literalblock .content {
127
+ margin-left:40px;
128
+ }
129
+
130
+ .verseblock .content {
131
+ white-space:pre
132
+ }
133
+
134
+ .sidebarblock .sidebar-content {
135
+ border:1px solid silver;
136
+ background:#FFFFEE;
137
+ padding:0 10px;
138
+ color:#222;
139
+ font-size:smaller;
140
+ line-height:1.5;
141
+ }
142
+
143
+ .sidebar-title {
144
+ margin:10px 0;
145
+ font-weight:bold;
146
+ color:#442;
147
+ }
148
+
149
+ .quoteblock-content {
150
+ font-style:italic;
151
+ color:#444;
152
+ margin-left:40px;
153
+ }
154
+
155
+ .quoteblock-content .attribution {
156
+ font-style:normal;
157
+ text-align:right;
158
+ color:#000;
159
+ }
160
+
161
+ .exampleblock-content *:first-child { margin-top:0 }
162
+ .exampleblock-content {
163
+ border-left:2px solid silver;
164
+ padding-left:8px;
165
+ }
166
+
167
+ #footer {
168
+ font-size:11px;
169
+ margin-top:40px;
170
+ border-top:1px solid silver;
171
+ color:#555;
172
+ }
173
+
174
+ #author {
175
+ color:#000;
176
+ text-transform:uppercase
177
+ }
data/test/helper.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  require 'rubygems'
2
2
  gem 'RedCloth', '>= 4.2.1'
3
3
 
4
- require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
4
+ require 'jekyll'
5
5
 
6
6
  require 'RedCloth'
7
7
  require 'rdiscount'
8
8
  require 'kramdown'
9
+ require 'redcarpet'
9
10
 
10
- require 'test/unit'
11
- require 'redgreen'
11
+ require 'redgreen' if RUBY_VERSION < '1.9'
12
12
  require 'shoulda'
13
13
  require 'rr'
14
14
 
@@ -0,0 +1,7 @@
1
+ ---
2
+ date: 2011-04-12 13:07:09
3
+ ---
4
+
5
+ under default configuration, this post should get processed by the identity converter. By changing
6
+ textile extension or markdown extension configuration parameters, you should be able to associate
7
+ it with either of those converters
File without changes
data/test/suite.rb CHANGED
@@ -1,9 +1,11 @@
1
+ require 'rubygems'
2
+ gem 'test-unit'
1
3
  require 'test/unit'
2
4
 
3
5
  # for some reason these tests fail when run via TextMate
4
6
  # but succeed when run on the command line.
5
7
 
6
- tests = Dir["#{File.dirname(__FILE__)}/test_*.rb"]
8
+ tests = Dir[File.expand_path("#{File.dirname(__FILE__)}/test_*.rb")]
7
9
  tests.each do |file|
8
10
  require file
9
11
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestConfiguration < Test::Unit::TestCase
4
4
  context "loading configuration" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestCoreExt < Test::Unit::TestCase
4
4
  context "hash" do
data/test/test_filters.rb CHANGED
@@ -1,8 +1,13 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestFilters < Test::Unit::TestCase
4
4
  class JekyllFilter
5
5
  include Jekyll::Filters
6
+
7
+ def initialize
8
+ site = Jekyll::Site.new(Jekyll.configuration({}))
9
+ @context = Liquid::Context.new({}, {}, { :site => site })
10
+ end
6
11
  end
7
12
 
8
13
  context "filters" do
@@ -14,6 +19,10 @@ class TestFilters < Test::Unit::TestCase
14
19
  assert_equal "<p>something <strong>really</strong> simple</p>", @filter.textilize("something *really* simple")
15
20
  end
16
21
 
22
+ should "markdownify with simple string" do
23
+ assert_equal "<p>something <strong>really</strong> simple</p>", @filter.markdownify("something **really** simple")
24
+ end
25
+
17
26
  should "convert array to sentence string with no args" do
18
27
  assert_equal "", @filter.array_to_sentence_string([])
19
28
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestGeneratedSite < Test::Unit::TestCase
4
4
  context "generated sites" do
@@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  should "ensure post count is as expected" do
17
- assert_equal 26, @site.posts.size
17
+ assert_equal 28, @site.posts.size
18
18
  end
19
19
 
20
20
  should "insert site.posts into the index" do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestKramdown < Test::Unit::TestCase
4
4
  context "kramdown" do
data/test/test_page.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestPage < Test::Unit::TestCase
4
4
  def setup_page(file)
data/test/test_pager.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestPager < Test::Unit::TestCase
4
4
 
data/test/test_post.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/helper'
1
+ require 'helper'
2
2
 
3
3
  class TestPost < Test::Unit::TestCase
4
4
  def setup_post(file)
@@ -52,6 +52,12 @@ class TestPost < Test::Unit::TestCase
52
52
  assert_equal "/2008/09/09/foo-bar.html", @post.url
53
53
  end
54
54
 
55
+ should "raise a good error on invalid post date" do
56
+ assert_raise Jekyll::FatalException do
57
+ @post.process("2009-27-03-foo-bar.textile")
58
+ end
59
+ end
60
+
55
61
  should "CGI escape urls" do
56
62
  @post.categories = []
57
63
  @post.process("2009-03-12-hash-#1.markdown")
@@ -391,6 +397,47 @@ class TestPost < Test::Unit::TestCase
391
397
  post = Post.new(@site, File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
392
398
  assert_equal ['foo'], post.categories
393
399
  end
394
-
395
400
  end
401
+
402
+ context "converter file extension settings" do
403
+ setup do
404
+ stub(Jekyll).configuration { Jekyll::DEFAULTS }
405
+ @site = Site.new(Jekyll.configuration)
406
+ end
407
+
408
+ should "process .md as markdown under default configuration" do
409
+ post = setup_post '2011-04-12-md-extension.md'
410
+ conv = post.converter
411
+ assert conv.kind_of? Jekyll::MarkdownConverter
412
+ end
413
+
414
+ should "process .text as indentity under default configuration" do
415
+ post = setup_post '2011-04-12-text-extension.text'
416
+ conv = post.converter
417
+ assert conv.kind_of? Jekyll::IdentityConverter
418
+ end
419
+
420
+ should "process .text as markdown under alternate configuration" do
421
+ @site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text'
422
+ post = setup_post '2011-04-12-text-extension.text'
423
+ conv = post.converter
424
+ assert conv.kind_of? Jekyll::MarkdownConverter
425
+ end
426
+
427
+ should "process .md as markdown under alternate configuration" do
428
+ @site.config['markdown_ext'] = 'markdown,mkd,mkdn,md,text'
429
+ post = setup_post '2011-04-12-text-extension.text'
430
+ conv = post.converter
431
+ assert conv.kind_of? Jekyll::MarkdownConverter
432
+ end
433
+
434
+ should "process .text as textile under alternate configuration" do
435
+ @site.config['textile_ext'] = 'textile,text'
436
+ post = setup_post '2011-04-12-text-extension.text'
437
+ conv = post.converter
438
+ assert conv.kind_of? Jekyll::TextileConverter
439
+ end
440
+
441
+ end
442
+
396
443
  end