jekyll 0.12.1 → 1.0.0.beta1

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 (124) hide show
  1. data/CONTRIBUTING.md +67 -0
  2. data/Gemfile +1 -1
  3. data/History.txt +50 -6
  4. data/README.textile +10 -6
  5. data/Rakefile +74 -36
  6. data/bin/jekyll +78 -276
  7. data/cucumber.yml +3 -1
  8. data/features/create_sites.feature +1 -1
  9. data/features/drafts.feature +25 -0
  10. data/features/site_configuration.feature +1 -1
  11. data/features/step_definitions/jekyll_steps.rb +13 -3
  12. data/features/support/env.rb +3 -1
  13. data/jekyll.gemspec +73 -17
  14. data/lib/jekyll.rb +31 -21
  15. data/lib/jekyll/command.rb +12 -0
  16. data/lib/jekyll/commands/build.rb +81 -0
  17. data/lib/jekyll/commands/serve.rb +28 -0
  18. data/lib/jekyll/converter.rb +1 -3
  19. data/lib/jekyll/converters/identity.rb +13 -14
  20. data/lib/jekyll/converters/markdown.rb +128 -128
  21. data/lib/jekyll/converters/textile.rb +37 -37
  22. data/lib/jekyll/convertible.rb +6 -4
  23. data/lib/jekyll/core_ext.rb +9 -1
  24. data/lib/jekyll/draft.rb +35 -0
  25. data/lib/jekyll/errors.rb +1 -3
  26. data/lib/jekyll/filters.rb +13 -4
  27. data/lib/jekyll/generator.rb +1 -4
  28. data/lib/jekyll/generators/pagination.rb +46 -46
  29. data/lib/jekyll/layout.rb +0 -2
  30. data/lib/jekyll/mime.types +1588 -0
  31. data/lib/jekyll/page.rb +24 -8
  32. data/lib/jekyll/plugin.rb +0 -2
  33. data/lib/jekyll/post.rb +66 -40
  34. data/lib/jekyll/site.rb +96 -20
  35. data/lib/jekyll/static_file.rb +0 -2
  36. data/lib/jekyll/tags/gist.rb +19 -0
  37. data/lib/jekyll/tags/highlight.rb +63 -62
  38. data/lib/jekyll/tags/include.rb +25 -25
  39. data/lib/jekyll/tags/post_url.rb +30 -25
  40. data/script/bootstrap +2 -0
  41. data/site/.gitignore +4 -0
  42. data/site/CNAME +1 -0
  43. data/site/README +1 -0
  44. data/site/_config.yml +5 -0
  45. data/site/_includes/analytics.html +32 -0
  46. data/site/_includes/docs_contents.html +82 -0
  47. data/site/_includes/footer.html +15 -0
  48. data/site/_includes/header.html +26 -0
  49. data/site/_includes/section_nav.html +22 -0
  50. data/site/_includes/top.html +14 -0
  51. data/site/_layouts/default.html +12 -0
  52. data/site/_layouts/docs.html +21 -0
  53. data/site/_posts/2012-07-01-configuration.md +277 -0
  54. data/site/_posts/2012-07-01-contributing.md +66 -0
  55. data/site/_posts/2012-07-01-deployment-methods.md +108 -0
  56. data/site/_posts/2012-07-01-extras.md +103 -0
  57. data/site/_posts/2012-07-01-frontmatter.md +120 -0
  58. data/site/_posts/2012-07-01-github-pages.md +34 -0
  59. data/site/_posts/2012-07-01-heroku.md +8 -0
  60. data/site/_posts/2012-07-01-home.md +47 -0
  61. data/site/_posts/2012-07-01-installation.md +43 -0
  62. data/site/_posts/2012-07-01-migrations.md +180 -0
  63. data/site/_posts/2012-07-01-pages.md +62 -0
  64. data/site/_posts/2012-07-01-pagination.md +116 -0
  65. data/site/_posts/2012-07-01-permalinks.md +163 -0
  66. data/site/_posts/2012-07-01-plugins.md +384 -0
  67. data/site/_posts/2012-07-01-posts.md +106 -0
  68. data/site/_posts/2012-07-01-resources.md +49 -0
  69. data/site/_posts/2012-07-01-sites.md +28 -0
  70. data/site/_posts/2012-07-01-structure.md +95 -0
  71. data/site/_posts/2012-07-01-templates.md +217 -0
  72. data/site/_posts/2012-07-01-troubleshooting.md +108 -0
  73. data/site/_posts/2012-07-01-usage.md +38 -0
  74. data/site/_posts/2012-07-01-variables.md +166 -0
  75. data/site/css/grid.css +62 -0
  76. data/site/css/normalize.css +504 -0
  77. data/site/css/pygments.css +70 -0
  78. data/site/css/style.css +697 -0
  79. data/site/docs/index.html +11 -0
  80. data/site/favicon.png +0 -0
  81. data/site/img/article-footer.png +0 -0
  82. data/site/img/footer-arrow.png +0 -0
  83. data/site/img/footer-logo.png +0 -0
  84. data/site/img/logo-2x.png +0 -0
  85. data/site/img/octojekyll.png +0 -0
  86. data/site/img/tube.png +0 -0
  87. data/site/img/tube1x.png +0 -0
  88. data/site/index.html +77 -0
  89. data/site/js/modernizr-2.5.3.min.js +4 -0
  90. data/test/fixtures/broken_front_matter2.erb +4 -0
  91. data/test/fixtures/broken_front_matter3.erb +7 -0
  92. data/test/fixtures/exploit_front_matter.erb +4 -0
  93. data/test/helper.rb +16 -0
  94. data/test/source/_posts/2013-01-12-nil-layout.textile +6 -0
  95. data/test/source/_posts/2013-01-12-no-layout.textile +5 -0
  96. data/test/source/contacts/bar.html +5 -0
  97. data/test/source/contacts/index.html +5 -0
  98. data/test/test_configuration.rb +7 -8
  99. data/test/test_convertible.rb +29 -0
  100. data/test/test_core_ext.rb +22 -0
  101. data/test/test_generated_site.rb +1 -1
  102. data/test/test_kramdown.rb +3 -3
  103. data/test/test_page.rb +88 -2
  104. data/test/test_post.rb +42 -6
  105. data/test/test_rdiscount.rb +1 -1
  106. data/test/test_redcarpet.rb +1 -1
  107. data/test/test_redcloth.rb +6 -6
  108. data/test/test_site.rb +73 -8
  109. data/test/test_tags.rb +36 -13
  110. metadata +150 -19
  111. data/lib/jekyll/migrators/csv.rb +0 -26
  112. data/lib/jekyll/migrators/drupal.rb +0 -103
  113. data/lib/jekyll/migrators/enki.rb +0 -49
  114. data/lib/jekyll/migrators/joomla.rb +0 -53
  115. data/lib/jekyll/migrators/marley.rb +0 -52
  116. data/lib/jekyll/migrators/mephisto.rb +0 -84
  117. data/lib/jekyll/migrators/mt.rb +0 -86
  118. data/lib/jekyll/migrators/posterous.rb +0 -67
  119. data/lib/jekyll/migrators/rss.rb +0 -47
  120. data/lib/jekyll/migrators/textpattern.rb +0 -58
  121. data/lib/jekyll/migrators/tumblr.rb +0 -195
  122. data/lib/jekyll/migrators/typo.rb +0 -51
  123. data/lib/jekyll/migrators/wordpress.rb +0 -294
  124. data/lib/jekyll/migrators/wordpressdotcom.rb +0 -70
@@ -1,5 +1,4 @@
1
1
  module Jekyll
2
-
3
2
  class StaticFile
4
3
  # The cache of last modification times [path] -> mtime.
5
4
  @@mtimes = Hash.new
@@ -68,5 +67,4 @@ module Jekyll
68
67
  nil
69
68
  end
70
69
  end
71
-
72
70
  end
@@ -0,0 +1,19 @@
1
+ # Gist Liquid Tag
2
+ #
3
+ # Example:
4
+ # {% gist 1234567 %}
5
+
6
+ module Jekyll
7
+ class GistTag < Liquid::Tag
8
+ def initialize(tag_name, gist, tokens)
9
+ super
10
+ @gist = gist.strip
11
+ end
12
+
13
+ def render(context)
14
+ "<script src=\"https://gist.github.com/#{@gist}.js\"> </script>"
15
+ end
16
+ end
17
+ end
18
+
19
+ Liquid::Template.register_tag('gist', Jekyll::GistTag)
@@ -1,82 +1,83 @@
1
1
  module Jekyll
2
+ module Tags
3
+ class HighlightBlock < Liquid::Block
4
+ include Liquid::StandardFilters
2
5
 
3
- class HighlightBlock < Liquid::Block
4
- include Liquid::StandardFilters
6
+ # The regular expression syntax checker. Start with the language specifier.
7
+ # Follow that by zero or more space separated options that take one of two
8
+ # forms:
9
+ #
10
+ # 1. name
11
+ # 2. name=value
12
+ SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=\w+)?)*)$/
5
13
 
6
- # The regular expression syntax checker. Start with the language specifier.
7
- # Follow that by zero or more space separated options that take one of two
8
- # forms:
9
- #
10
- # 1. name
11
- # 2. name=value
12
- SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=\w+)?)*)$/
13
-
14
- def initialize(tag_name, markup, tokens)
15
- super
16
- if markup.strip =~ SYNTAX
17
- @lang = $1
18
- if defined?($2) && $2 != ''
19
- tmp_options = {}
20
- $2.split.each do |opt|
21
- key, value = opt.split('=')
22
- if value.nil?
23
- if key == 'linenos'
24
- value = 'inline'
25
- else
26
- value = true
14
+ def initialize(tag_name, markup, tokens)
15
+ super
16
+ if markup.strip =~ SYNTAX
17
+ @lang = $1
18
+ @options = {}
19
+ if defined?($2) && $2 != ''
20
+ $2.split.each do |opt|
21
+ key, value = opt.split('=')
22
+ if value.nil?
23
+ if key == 'linenos'
24
+ value = 'inline'
25
+ else
26
+ value = true
27
+ end
27
28
  end
29
+ @options[key] = value
28
30
  end
29
- tmp_options[key] = value
30
31
  end
31
- tmp_options = tmp_options.to_a.sort.collect { |opt| opt.join('=') }
32
- # additional options to pass to Albino
33
- @options = { 'O' => tmp_options.join(',') }
34
32
  else
35
- @options = {}
33
+ raise SyntaxError.new <<-eos
34
+ Syntax Error in tag 'highlight' while parsing the following markup:
35
+
36
+ #{markup}
37
+
38
+ Valid syntax: highlight <lang> [linenos]
39
+ eos
36
40
  end
37
- else
38
- raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight <lang> [linenos]")
39
41
  end
40
- end
41
42
 
42
- def render(context)
43
- if context.registers[:site].pygments
44
- render_pygments(context, super)
45
- else
46
- render_codehighlighter(context, super)
43
+ def render(context)
44
+ if context.registers[:site].pygments
45
+ render_pygments(context, super)
46
+ else
47
+ render_codehighlighter(context, super)
48
+ end
47
49
  end
48
- end
49
50
 
50
- def render_pygments(context, code)
51
- @options[:encoding] = 'utf-8'
51
+ def render_pygments(context, code)
52
+ @options[:encoding] = 'utf-8'
52
53
 
53
- output = add_code_tags(
54
- Pygments.highlight(code, :lexer => @lang, :options => @options),
55
- @lang
56
- )
54
+ output = add_code_tags(
55
+ Pygments.highlight(code, :lexer => @lang, :options => @options),
56
+ @lang
57
+ )
57
58
 
58
- output = context["pygments_prefix"] + output if context["pygments_prefix"]
59
- output = output + context["pygments_suffix"] if context["pygments_suffix"]
60
- output
61
- end
59
+ output = context["pygments_prefix"] + output if context["pygments_prefix"]
60
+ output = output + context["pygments_suffix"] if context["pygments_suffix"]
61
+ output
62
+ end
62
63
 
63
- def render_codehighlighter(context, code)
64
- #The div is required because RDiscount blows ass
65
- <<-HTML
66
- <div>
67
- <pre><code class='#{@lang}'>#{h(code).strip}</code></pre>
68
- </div>
69
- HTML
70
- end
64
+ def render_codehighlighter(context, code)
65
+ #The div is required because RDiscount blows ass
66
+ <<-HTML
67
+ <div>
68
+ <pre><code class='#{@lang}'>#{h(code).strip}</code></pre>
69
+ </div>
70
+ HTML
71
+ end
71
72
 
72
- def add_code_tags(code, lang)
73
- # Add nested <code> tags to code blocks
74
- code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
75
- code = code.sub(/<\/pre>/,"</code></pre>")
76
- end
73
+ def add_code_tags(code, lang)
74
+ # Add nested <code> tags to code blocks
75
+ code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
76
+ code = code.sub(/<\/pre>/,"</code></pre>")
77
+ end
77
78
 
79
+ end
78
80
  end
79
-
80
81
  end
81
82
 
82
- Liquid::Template.register_tag('highlight', Jekyll::HighlightBlock)
83
+ Liquid::Template.register_tag('highlight', Jekyll::Tags::HighlightBlock)
@@ -1,37 +1,37 @@
1
1
  module Jekyll
2
+ module Tags
3
+ class IncludeTag < Liquid::Tag
4
+ def initialize(tag_name, file, tokens)
5
+ super
6
+ @file = file.strip
7
+ end
2
8
 
3
- class IncludeTag < Liquid::Tag
4
- def initialize(tag_name, file, tokens)
5
- super
6
- @file = file.strip
7
- end
8
-
9
- def render(context)
10
- includes_dir = File.join(context.registers[:site].source, '_includes')
9
+ def render(context)
10
+ includes_dir = File.join(context.registers[:site].source, '_includes')
11
11
 
12
- if File.symlink?(includes_dir)
13
- return "Includes directory '#{includes_dir}' cannot be a symlink"
14
- end
12
+ if File.symlink?(includes_dir)
13
+ return "Includes directory '#{includes_dir}' cannot be a symlink"
14
+ end
15
15
 
16
- if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
17
- return "Include file '#{@file}' contains invalid characters or sequences"
18
- end
16
+ if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
17
+ return "Include file '#{@file}' contains invalid characters or sequences"
18
+ end
19
19
 
20
- Dir.chdir(includes_dir) do
21
- choices = Dir['**/*'].reject { |x| File.symlink?(x) }
22
- if choices.include?(@file)
23
- source = File.read(@file)
24
- partial = Liquid::Template.parse(source)
25
- context.stack do
26
- partial.render(context)
20
+ Dir.chdir(includes_dir) do
21
+ choices = Dir['**/*'].reject { |x| File.symlink?(x) }
22
+ if choices.include?(@file)
23
+ source = File.read(@file)
24
+ partial = Liquid::Template.parse(source)
25
+ context.stack do
26
+ partial.render(context)
27
+ end
28
+ else
29
+ "Included file '#{@file}' not found in _includes directory"
27
30
  end
28
- else
29
- "Included file '#{@file}' not found in _includes directory"
30
31
  end
31
32
  end
32
33
  end
33
34
  end
34
-
35
35
  end
36
36
 
37
- Liquid::Template.register_tag('include', Jekyll::IncludeTag)
37
+ Liquid::Template.register_tag('include', Jekyll::Tags::IncludeTag)
@@ -1,38 +1,43 @@
1
1
  module Jekyll
2
+ module Tags
3
+ class PostComparer
4
+ MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
2
5
 
3
- class PostComparer
4
- MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
6
+ attr_accessor :date, :slug
5
7
 
6
- attr_accessor :date, :slug
7
-
8
- def initialize(name)
9
- who, cares, date, slug = *name.match(MATCHER)
10
- @slug = slug
11
- @date = Time.parse(date)
8
+ def initialize(name)
9
+ who, cares, date, slug = *name.match(MATCHER)
10
+ @slug = slug
11
+ @date = Time.parse(date)
12
+ end
12
13
  end
13
- end
14
14
 
15
- class PostUrl < Liquid::Tag
16
- def initialize(tag_name, post, tokens)
17
- super
18
- @orig_post = post.strip
19
- @post = PostComparer.new(@orig_post)
20
- end
15
+ class PostUrl < Liquid::Tag
16
+ def initialize(tag_name, post, tokens)
17
+ super
18
+ @orig_post = post.strip
19
+ @post = PostComparer.new(@orig_post)
20
+ end
21
21
 
22
- def render(context)
23
- site = context.registers[:site]
24
-
25
- site.posts.each do |p|
26
- if p == @post
27
- return p.url
22
+ def render(context)
23
+ site = context.registers[:site]
24
+
25
+ site.posts.each do |p|
26
+ if p.slug == @post.slug \
27
+ and p.date.year == @post.date.year \
28
+ and p.date.month == @post.date.month \
29
+ and p.date.day == @post.date.day
30
+
31
+ return p.url
32
+ end
28
33
  end
29
- end
30
34
 
31
- puts "ERROR: post_url: \"#{@orig_post}\" could not be found"
35
+ puts "ERROR: post_url: \"#{@orig_post}\" could not be found"
32
36
 
33
- return "#"
37
+ return "#"
38
+ end
34
39
  end
35
40
  end
36
41
  end
37
42
 
38
- Liquid::Template.register_tag('post_url', Jekyll::PostUrl)
43
+ Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl)
@@ -0,0 +1,2 @@
1
+ #!/bin/sh
2
+ bundle install
@@ -0,0 +1,4 @@
1
+ _site/
2
+ *.swp
3
+ pkg/
4
+ test/
@@ -0,0 +1 @@
1
+ jekyllrb.com
@@ -0,0 +1 @@
1
+ Jekyll's awesome website.
@@ -0,0 +1,5 @@
1
+ auto: false
2
+ server: true
3
+ permalink: /docs/:categories/:title
4
+ pygments: true
5
+ gauges_id: 503c5af6613f5d0f19000027
@@ -0,0 +1,32 @@
1
+ {% if site.gauges_id %}
2
+ <!-- Gauges (http://gaug.es/) -->
3
+ <script type="text/javascript">
4
+ var _gauges = _gauges || [];
5
+ (function() {
6
+ var t = document.createElement('script');
7
+ t.type = 'text/javascript';
8
+ t.async = true;
9
+ t.id = 'gauges-tracker';
10
+ t.setAttribute('data-site-id', '{{ site.gauges_id }}');
11
+ t.src = '//secure.gaug.es/track.js';
12
+ var s = document.getElementsByTagName('script')[0];
13
+ s.parentNode.insertBefore(t, s);
14
+ })();
15
+ </script>
16
+ {% endif %}
17
+
18
+ {% if site.google_analytics_id %}
19
+ <!-- Google Analytics (http://google.com/analytics) -->
20
+ <script type="text/javascript">
21
+ var _gaq = _gaq || [];
22
+ _gaq.push(['_setAccount', '{{ site.google_analytics_id }}']);
23
+ _gaq.push(['_setDomainName', '{{ site.url }}']); // Multiple sub-domains
24
+ _gaq.push(['_setAllowLinker', true]); // Multiple TLDs
25
+ _gaq.push(['_trackPageview']);
26
+ (function() {
27
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
28
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
29
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
30
+ })();
31
+ </script>
32
+ {% endif %}
@@ -0,0 +1,82 @@
1
+ <div class="grid2">
2
+ <aside>
3
+ <h4>Getting Started</h4>
4
+ <ul>
5
+ <li class="{% if page.title == "Welcome" %}current{% endif %}">
6
+ <a href="{{ site.url }}/docs/home">Welcome</a>
7
+ </li>
8
+ <li class="{% if page.title == "Installation" %}current{% endif %}">
9
+ <a href="{{ site.url }}/docs/installation">Installation</a>
10
+ </li>
11
+ <li class="{% if page.title == "Basic Usage" %}current{% endif %}">
12
+ <a href="{{ site.url }}/docs/usage">Basic Usage</a>
13
+ </li>
14
+ <li class="{% if page.title == "Directory structure" %}current{% endif %}">
15
+ <a href="{{ site.url }}/docs/structure">Directory structure</a>
16
+ </li>
17
+ <li class="{% if page.title == "Configuration" %}current{% endif %}">
18
+ <a href="{{ site.url }}/docs/configuration">Configuration</a>
19
+ </li>
20
+ </ul>
21
+ <h4>Your Content</h4>
22
+ <ul>
23
+ <li class="{% if page.title == "Front-matter" %}current{% endif %}">
24
+ <a href="{{ site.url }}/docs/frontmatter">Front-matter</a>
25
+ </li>
26
+ <li class="{% if page.title == "Writing posts" %}current{% endif %}">
27
+ <a href="{{ site.url }}/docs/posts">Writing posts</a>
28
+ </li>
29
+ <li class="{% if page.title == "Creating pages" %}current{% endif %}">
30
+ <a href="{{ site.url }}/docs/pages">Creating pages</a>
31
+ </li>
32
+ <li class="{% if page.title == "Variables" %}current{% endif %}">
33
+ <a href="{{ site.url }}/docs/variables">Variables</a>
34
+ </li>
35
+ <li class="{% if page.title == "Blog migrations" %}current{% endif %}">
36
+ <a href="{{ site.url }}/docs/migrations">Blog migrations</a>
37
+ </li>
38
+ </ul>
39
+ <h4>Customization</h4>
40
+ <ul>
41
+ <li class="{% if page.title == "Templates" %}current{% endif %}">
42
+ <a href="{{ site.url }}/docs/templates">Templates</a>
43
+ </li>
44
+ <li class="{% if page.title == "Permalinks" %}current{% endif %}">
45
+ <a href="{{ site.url }}/docs/permalinks">Permalinks</a>
46
+ </li>
47
+ <li class="{% if page.title == "Pagination" %}current{% endif %}">
48
+ <a href="{{ site.url }}/docs/pagination">Pagination</a>
49
+ </li>
50
+ <li class="{% if page.title == "Plugins" %}current{% endif %}">
51
+ <a href="{{ site.url }}/docs/plugins">Plugins</a>
52
+ </li>
53
+ <li class="{% if page.title == "Extras" %}current{% endif %}">
54
+ <a href="{{ site.url }}/docs/extras">Extras</a>
55
+ </li>
56
+ </ul>
57
+ <h4>Deployment</h4>
58
+ <ul>
59
+ <li class="{% if page.title == "GitHub Pages" %}current{% endif %}">
60
+ <a href="{{ site.url }}/docs/github-pages">GitHub Pages</a>
61
+ </li>
62
+ <li class="{% if page.title == "Deployment methods" %}current{% endif %}">
63
+ <a href="{{ site.url }}/docs/deployment-methods">Other methods</a>
64
+ </li>
65
+ </ul>
66
+ <h4>Miscellaneous</h4>
67
+ <ul>
68
+ <li class="{% if page.title == "Contributing" %}current{% endif %}">
69
+ <a href="{{ site.url }}/docs/contributing">Contributing</a>
70
+ </li>
71
+ <li class="{% if page.title == "Troubleshooting" %}current{% endif %}">
72
+ <a href="{{ site.url }}/docs/troubleshooting">Troubleshooting</a>
73
+ </li>
74
+ <li class="{% if page.title == "Sites using Jekyll" %}current{% endif %}">
75
+ <a href="{{ site.url }}/docs/sites">Sites using Jekyll</a>
76
+ </li>
77
+ <li class="{% if page.title == "Resources" %}current{% endif %}">
78
+ <a href="{{ site.url }}/docs/resources">Resources</a>
79
+ </li>
80
+ </ul>
81
+ </aside>
82
+ </div>