jekyll 2.0.0.alpha.2 → 2.0.0.alpha.3

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/History.markdown +35 -0
  3. data/Rakefile +1 -1
  4. data/features/collections.feature +38 -0
  5. data/features/create_sites.feature +17 -0
  6. data/features/step_definitions/jekyll_steps.rb +15 -7
  7. data/features/support/env.rb +6 -1
  8. data/lib/jekyll.rb +6 -1
  9. data/lib/jekyll/cleaner.rb +5 -3
  10. data/lib/jekyll/collection.rb +121 -0
  11. data/lib/jekyll/command.rb +2 -0
  12. data/lib/jekyll/commands/build.rb +5 -1
  13. data/lib/jekyll/commands/serve.rb +1 -1
  14. data/lib/jekyll/configuration.rb +2 -0
  15. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +11 -12
  16. data/lib/jekyll/convertible.rb +1 -1
  17. data/lib/jekyll/document.rb +228 -0
  18. data/lib/jekyll/entry_filter.rb +4 -1
  19. data/lib/jekyll/layout_reader.rb +1 -1
  20. data/lib/jekyll/page.rb +1 -1
  21. data/lib/jekyll/plugin_manager.rb +76 -0
  22. data/lib/jekyll/post.rb +3 -3
  23. data/lib/jekyll/publisher.rb +21 -0
  24. data/lib/jekyll/renderer.rb +132 -0
  25. data/lib/jekyll/site.rb +84 -68
  26. data/lib/jekyll/tags/highlight.rb +8 -6
  27. data/lib/jekyll/url.rb +43 -3
  28. data/lib/jekyll/version.rb +1 -1
  29. data/lib/site_template/_includes/head.html +3 -3
  30. data/script/console +38 -0
  31. data/site/_config.yml +1 -0
  32. data/site/_data/docs.yml +1 -0
  33. data/site/_includes/css/style.css +12 -12
  34. data/site/_includes/news_item.html +3 -3
  35. data/site/_includes/primary-nav-items.html +4 -1
  36. data/site/_includes/top.html +7 -3
  37. data/site/_layouts/news_item.html +3 -3
  38. data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +26 -0
  39. data/site/docs/collections.md +126 -0
  40. data/site/docs/configuration.md +3 -2
  41. data/site/docs/datafiles.md +1 -1
  42. data/site/docs/history.md +6 -0
  43. data/site/docs/plugins.md +1 -1
  44. data/site/docs/troubleshooting.md +7 -3
  45. data/site/docs/variables.md +1 -1
  46. data/site/favicon.ico +0 -0
  47. data/site/feed.xml +27 -14
  48. data/site/img/logo-rss.png +0 -0
  49. data/site/js/html5shiv.js +8 -0
  50. data/site/js/respond.min.js +5 -0
  51. data/test/source/+/%# +.md +6 -0
  52. data/test/source/_methods/_do_not_read_me.md +5 -0
  53. data/test/source/_methods/configuration.md +8 -0
  54. data/test/source/_methods/sanitized_path.md +5 -0
  55. data/test/source/_methods/site/_dont_include_me_either.md +5 -0
  56. data/test/source/_methods/site/generate.md +6 -0
  57. data/test/source/_methods/site/initialize.md +5 -0
  58. data/test/source/_methods/um_hi.md +6 -0
  59. data/test/source/_posts/2014-03-03-yaml-with-dots.md +5 -0
  60. data/test/source/_posts/2014-03-22-escape-+ %20[].markdown +6 -0
  61. data/test/source/pgp.key +2 -0
  62. data/test/test_coffeescript.rb +1 -1
  63. data/test/test_collections.rb +129 -0
  64. data/test/test_command.rb +17 -0
  65. data/test/test_document.rb +48 -0
  66. data/test/test_filters.rb +1 -1
  67. data/test/test_generated_site.rb +5 -4
  68. data/test/test_new_command.rb +4 -4
  69. data/test/test_page.rb +22 -8
  70. data/test/test_path_sanitization.rb +4 -0
  71. data/test/test_post.rb +42 -13
  72. data/test/test_site.rb +11 -17
  73. data/test/test_tags.rb +10 -6
  74. metadata +42 -7
  75. data/lib/site_template/_posts/0000-00-00-this-post-demonstrates-post-content-styles.md +0 -88
  76. data/site/favicon.png +0 -0
  77. data/site/img/tube.png +0 -0
  78. data/site/img/tube1x.png +0 -0
  79. data/site/js/modernizr-2.7.1.min.js +0 -4
@@ -1,3 +1,5 @@
1
+ require 'uri'
2
+
1
3
  # Public: Methods that generate a URL for a resource such as a Post or a Page.
2
4
  #
3
5
  # Examples
@@ -22,9 +24,9 @@ module Jekyll
22
24
  # template. Instead, the given permalink will be
23
25
  # used as URL.
24
26
  def initialize(options)
25
- @template = options[:template]
27
+ @template = options[:template]
26
28
  @placeholders = options[:placeholders] || {}
27
- @permalink = options[:permalink]
29
+ @permalink = options[:permalink]
28
30
 
29
31
  if (@template || @permalink).nil?
30
32
  raise ArgumentError, "One of :template or :permalink must be supplied."
@@ -44,7 +46,7 @@ module Jekyll
44
46
  # Returns the _unsanitizied_ String URL
45
47
  def generate_url
46
48
  @placeholders.inject(@template) do |result, token|
47
- result.gsub(/:#{token.first}/, token.last)
49
+ result.gsub(/:#{token.first}/, self.class.escape_path(token.last))
48
50
  end
49
51
  end
50
52
 
@@ -65,5 +67,43 @@ module Jekyll
65
67
 
66
68
  url
67
69
  end
70
+
71
+ # Escapes a path to be a valid URL path segment
72
+ #
73
+ # path - The path to be escaped.
74
+ #
75
+ # Examples:
76
+ #
77
+ # URL.escape_path("/a b")
78
+ # # => "/a%20b"
79
+ #
80
+ # Returns the escaped path.
81
+ def self.escape_path(path)
82
+ # Because URI.escape doesn't escape '?', '[' and ']' by defaut,
83
+ # specify unsafe string (except unreserved, sub-delims, ":", "@" and "/").
84
+ #
85
+ # URI path segment is defined in RFC 3986 as follows:
86
+ # segment = *pchar
87
+ # pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
88
+ # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
89
+ # pct-encoded = "%" HEXDIG HEXDIG
90
+ # sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
91
+ # / "*" / "+" / "," / ";" / "="
92
+ URI.escape(path, /[^a-zA-Z\d\-._~!$&\'()*+,;=:@\/]/)
93
+ end
94
+
95
+ # Unescapes a URL path segment
96
+ #
97
+ # path - The path to be unescaped.
98
+ #
99
+ # Examples:
100
+ #
101
+ # URL.unescape_path("/a%20b")
102
+ # # => "/a b"
103
+ #
104
+ # Returns the unescaped path.
105
+ def self.unescape_path(path)
106
+ URI.unescape(path)
107
+ end
68
108
  end
69
109
  end
@@ -1,3 +1,3 @@
1
1
  module Jekyll
2
- VERSION = '2.0.0.alpha.2'
2
+ VERSION = '2.0.0.alpha.3'
3
3
  end
@@ -1,10 +1,10 @@
1
1
  <head>
2
2
  <meta charset="utf-8">
3
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
3
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
4
  <title>{% if page.title %}{{ page.title }}{% else %}{{ site.name }}{% endif %}</title>
5
5
  <meta name="viewport" content="width=device-width">
6
- <meta name="description" content="{{ site.description }}" />
7
- <link rel="canonical" href="{{ site.url }}{{ page.url | replace:'index.html','' }}/" />
6
+ <meta name="description" content="{{ site.description }}">
7
+ <link rel="canonical" href="{{ site.url }}{{ page.url | replace:'index.html','' }}">
8
8
 
9
9
  <!-- Custom CSS -->
10
10
  <link rel="stylesheet" href="/css/main.css">
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pry'
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
5
+ require 'jekyll'
6
+
7
+ TEST_DIR = File.expand_path(File.join(File.dirname(__FILE__), *%w{ .. test }))
8
+
9
+ def fixture_site(overrides = {})
10
+ Jekyll::Site.new(site_configuration(overrides))
11
+ end
12
+
13
+ def build_configs(overrides, base_hash = Jekyll::Configuration::DEFAULTS)
14
+ Jekyll::Utils.deep_merge_hashes(base_hash, overrides)
15
+ end
16
+
17
+ def site_configuration(overrides = {})
18
+ build_configs({
19
+ "source" => source_dir,
20
+ "destination" => dest_dir
21
+ }, build_configs(overrides))
22
+ end
23
+
24
+ def dest_dir(*subdirs)
25
+ test_dir('dest', *subdirs)
26
+ end
27
+
28
+ def source_dir(*subdirs)
29
+ test_dir('source', *subdirs)
30
+ end
31
+
32
+ def test_dir(*subdirs)
33
+ File.join(TEST_DIR, *subdirs)
34
+ end
35
+
36
+ module Jekyll
37
+ binding.pry
38
+ end
@@ -4,3 +4,4 @@ gauges_id: 503c5af6613f5d0f19000027
4
4
  permalink: /news/:year/:month/:day/:title/
5
5
  excerpt_separator: noifniof3nioaniof3nioafafinoafnoif
6
6
  repository: https://github.com/jekyll/jekyll
7
+ help_url: https://github.com/jekyll/help
@@ -14,6 +14,7 @@
14
14
  - drafts
15
15
  - pages
16
16
  - variables
17
+ - collections
17
18
  - datafiles
18
19
  - assets
19
20
  - migrations
@@ -66,7 +66,7 @@ nav li {
66
66
 
67
67
  .main-nav li a {
68
68
  border-radius: 5px;
69
- font-weight: 800;
69
+ font-weight: 900;
70
70
  font-size: 14px;
71
71
  padding: 0.5em 1em;
72
72
  text-shadow: none;
@@ -103,7 +103,7 @@ nav li {
103
103
  text-align: center;
104
104
  text-transform: uppercase;
105
105
  font-size: 14px;
106
- font-weight: 800;
106
+ font-weight: 900;
107
107
  padding: 5px;
108
108
  border-radius: 5px;
109
109
  }
@@ -117,8 +117,8 @@ nav li {
117
117
 
118
118
  .mobile-nav li {
119
119
  display: table-cell;
120
- width: 25%;
121
- padding: 8px;
120
+ width: 20%;
121
+ padding: 8px 2px;
122
122
  }
123
123
 
124
124
  @media (max-width: 768px){
@@ -251,7 +251,7 @@ body > footer a:hover img {
251
251
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
252
252
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
253
253
  font-size: 16px;
254
- font-weight: normal;
254
+ font-weight: 400;
255
255
  color: #444;
256
256
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
257
257
  background: #f7f7f7;
@@ -489,7 +489,7 @@ aside li.current a:before {
489
489
  .section-nav .next:after, .section-nav .prev:before {
490
490
  font-size: 36px;
491
491
  color: #222;
492
- font-weight: 800;
492
+ font-weight: 900;
493
493
  text-shadow: 0 1px 0 rgba(255,255,255,.4);
494
494
  position: absolute;
495
495
  top: -7px;
@@ -560,7 +560,7 @@ article h2:first-child {
560
560
  .label {
561
561
  float: left;
562
562
  text-transform: uppercase;
563
- font-weight: bold;
563
+ font-weight: 700;
564
564
  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
565
565
  }
566
566
 
@@ -867,7 +867,7 @@ code.option, code.flag, code.filter, code.output {
867
867
 
868
868
  .note h5 {
869
869
  line-height: 1.5em;
870
- font-weight: 800;
870
+ font-weight: 900;
871
871
  font-style: normal;
872
872
  }
873
873
 
@@ -932,7 +932,7 @@ code.option, code.flag, code.filter, code.output {
932
932
  top: 14px;
933
933
  left: 14px;
934
934
  font-size: 28px;
935
- font-weight: bold;
935
+ font-weight: 700;
936
936
  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
937
937
  }
938
938
 
@@ -943,7 +943,7 @@ code.option, code.flag, code.filter, code.output {
943
943
  top: 15px;
944
944
  left: 15px;
945
945
  font-size: 28px;
946
- font-weight: bold;
946
+ font-weight: 700;
947
947
  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
948
948
  }
949
949
 
@@ -954,7 +954,7 @@ code.option, code.flag, code.filter, code.output {
954
954
  top: 15px;
955
955
  left: 15px;
956
956
  font-size: 32px;
957
- font-weight: bold;
957
+ font-weight: 700;
958
958
  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
959
959
  }
960
960
 
@@ -965,7 +965,7 @@ code.option, code.flag, code.filter, code.output {
965
965
  top: 8px;
966
966
  left: 15px;
967
967
  font-size: 38px;
968
- font-weight: bold;
968
+ font-weight: 700;
969
969
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
970
970
  }
971
971
 
@@ -5,9 +5,9 @@
5
5
  </a>
6
6
  </h2>
7
7
  <span class="post-category">
8
- {% for category in post.categories %}
9
- <span class="label">{{ category }}</span>
10
- {% endfor %}
8
+ <span class="label">
9
+ {{ post.categories | array_to_sentence_string }}
10
+ </span>
11
11
  </span>
12
12
  <div class="post-meta">
13
13
  <span class="post-date">
@@ -1,6 +1,6 @@
1
1
  <ul>
2
2
  <li class="{% if page.overview %}current{% endif %}">
3
- <a href="/">Overview</a>
3
+ <a href="/">Home</a>
4
4
  </li>
5
5
  <li class="{% if page.url contains '/docs/' %}current{% endif %}">
6
6
  <a href="/docs/home/">Doc<span class="show-on-mobiles">s</span><span class="hide-on-mobiles">umentation</span></a>
@@ -8,6 +8,9 @@
8
8
  <li class="{% if page.author %}current{% endif %}">
9
9
  <a href="/news/">News</a>
10
10
  </li>
11
+ <li>
12
+ <a href="{{ site.help_url }}">Help</a>
13
+ </li>
11
14
  <li>
12
15
  <a href="{{ site.repository }}"><span class="hide-on-mobiles">View on </span>GitHub</a>
13
16
  </li>
@@ -4,10 +4,14 @@
4
4
  <meta charset="UTF-8">
5
5
  <title>{{ page.title }}</title>
6
6
  <meta name="viewport" content="width=device-width,initial-scale=1">
7
+ <meta name="generator" content="Jekyll v{{ jekyll.version }}">
7
8
  <link rel="alternate" type="application/rss+xml" title="Jekyll • Simple, blog-aware, static sites - Feed" href="/feed.xml">
8
9
  <link rel="alternate" type="application/atom+xml" title="Recent commits to Jekyll’s master branch" href="{{ site.repository }}/commits/master.atom">
9
- <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic">
10
+ <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
10
11
  <link rel="stylesheet" href="/css/screen.css">
11
- <link rel="icon" type="image/png" href="/favicon.png">
12
- <script src="/js/modernizr-2.7.1.min.js"></script>
12
+ <link rel="icon" type="image/x-icon" href="/favicon.ico">
13
+ <!--[if lt IE 9]>
14
+ <script src="/js/html5shiv.js"></script>
15
+ <script src="/js/respond.min.js"></script>
16
+ <![endif]-->
13
17
  </head>
@@ -8,9 +8,9 @@ layout: news
8
8
  <a href="{{ page.url }}" class="permalink" title="Permalink">∞</a>
9
9
  </h2>
10
10
  <span class="post-category">
11
- {% for category in page.categories %}
12
- <span class="label">{{ category }}</span>
13
- {% endfor %}
11
+ <span class="label">
12
+ {{ page.categories | array_to_sentence_string }}
13
+ </span>
14
14
  </span>
15
15
  <div class="post-meta">
16
16
  <span class="post-date">
@@ -0,0 +1,26 @@
1
+ ---
2
+ layout: news_item
3
+ title: 'Jekyll 1.5.1 Released'
4
+ date: 2014-03-27 22:43:48 -0400
5
+ author: parkr
6
+ version: 1.5.1
7
+ categories: [release]
8
+ ---
9
+
10
+ The hawk-eyed [@gregose](https://github.com/gregose) spotted a bug in our
11
+ `Jekyll.sanitized_path` code:
12
+
13
+ {% highlight ruby %}
14
+ > sanitized_path("/tmp/foobar/jail", "..c:/..c:/..c:/etc/passwd")
15
+ => "/tmp/foobar/jail/../../../etc/passwd"
16
+ {% endhighlight %}
17
+
18
+ Well, we can't have that! In 1.5.1, you'll instead see:
19
+
20
+ {% highlight ruby %}
21
+ > sanitized_path("/tmp/foobar/jail", "..c:/..c:/..c:/etc/passwd")
22
+ => "/tmp/foobar/jail/..c:/..c:/..c:/etc/passwd"
23
+ {% endhighlight %}
24
+
25
+ Luckily not affecting 1.4.x, this fix will make 1.5.0 that much safer for
26
+ the masses. Thanks, Greg!
@@ -0,0 +1,126 @@
1
+ ---
2
+ layout: docs
3
+ title: Collections
4
+ prev_section: variables
5
+ next_section: datafiles
6
+ permalink: /docs/collections/
7
+ ---
8
+
9
+ <div class="note unreleased">
10
+ <h5>Collections support is currently unreleased.</h5>
11
+ <p>
12
+ In order to use this feature, <a href="/docs/installation/#pre-releases">
13
+ install the latest development version of Jekyll</a>.
14
+ </p>
15
+ </div>
16
+
17
+ <div class="note warning">
18
+ <h5>Collections support is unstable and may change</h5>
19
+ <p>
20
+ This is an experimental feature and that the API may likely change until the feature stabilizes.
21
+ </p>
22
+ </div>
23
+
24
+ Put some things in a folder and add the folder to your config. It's simple...
25
+
26
+ Not everything is a post or a page. Maybe you want to document the various methods in your open source project, members of a team, or talks at a conference. Collections allow you to define a new type of document that behave like Pages or Posts do normally, but also have their own unique properties and namespace.
27
+
28
+ ## Using Collections
29
+
30
+ ### Step 1: Tell Jekyll to read in your collection
31
+
32
+ Add the following to your site's `_config.yml` file, replacing `my_collection` with the name of your collection:
33
+
34
+ {% highlight yaml %}
35
+ collections:
36
+ - my_collection
37
+ {% endhighlight %}
38
+
39
+ ### Step 2: Add your content
40
+
41
+ Create a corresponding folder (e.g. `<source>/_my_collection`) and add documents.
42
+ YAML front-matter is read in as data if it exists, if not, then everything is just stuck in the Document's `content` attribute.
43
+
44
+ Note: the folder must be named identical to the collection you defined in you config.yml file, with the addition of the preceding `_` character.
45
+
46
+ ### Step 3: Optionally render your collection's documents into independent files
47
+
48
+ If you'd like Jekyll to create a public-facing, rendered version of each document in your collection, add your collection name to the `render` config key in your `_config.yml`:
49
+
50
+ {% highlight yaml %}
51
+ render:
52
+ - my_collection
53
+ {% endhighlight %}
54
+
55
+ This will produce a file for each document in the collection.
56
+ For example, if you have `_my_collection/some_subdir/some_doc.md`,
57
+ it will be rendered using Liquid and the Markdown converter of your
58
+ choice and written out to `<dest>/my_collection/some_subdir/some_doc.html`.
59
+
60
+ ## Liquid Attributes
61
+
62
+ ### Collections
63
+
64
+ Each collection is accessible via the `site` Liquid variable. For example, if you want to access the `albums` collection found in `_albums`, you'd use `site.albums`. Each collection is itself an array of documents (e.g. `site.albums` is an array of documents, much like `site.pages` and `site.posts`). See below for how to access attributes of those documents.
65
+
66
+ ### Documents
67
+
68
+ In addition to any YAML front-matter provided in the document's corresponding file, each document has the following attributes:
69
+
70
+ <div class="mobile-side-scroller">
71
+ <table>
72
+ <thead>
73
+ <tr>
74
+ <th>Variable</th>
75
+ <th>Description</th>
76
+ </tr>
77
+ </thead>
78
+ <tbody>
79
+ <tr>
80
+ <td>
81
+ <p><code>content</code></p>
82
+ </td>
83
+ <td>
84
+ <p>
85
+ The content of the document. If no YAML front-matter is provided,
86
+ this is the entirety of the file contents. If YAML front-matter
87
+ is used, then this is all the contents of the file after the terminating
88
+ `---` of the front-matter.
89
+ </p>
90
+ </td>
91
+ </tr>
92
+ <tr>
93
+ <td>
94
+ <p><code>path</code></p>
95
+ </td>
96
+ <td>
97
+ <p>
98
+ The full path to the document's source file.
99
+ </p>
100
+ </td>
101
+ </tr>
102
+ <tr>
103
+ <td>
104
+ <p><code>relative_path</code></p>
105
+ </td>
106
+ <td>
107
+ <p>
108
+ The path to the document's source file relative to the site source.
109
+ </p>
110
+ </td>
111
+ </tr>
112
+ <tr>
113
+ <td>
114
+ <p><code>url</code></p>
115
+ </td>
116
+ <td>
117
+ <p>
118
+ The URL of the rendered collection. The file is only written to the
119
+ destination when the name of the collection to which it belongs is
120
+ included in the <code>render</code> key in the site's configuration file.
121
+ </p>
122
+ </td>
123
+ </tr>
124
+ </tbody>
125
+ </table>
126
+ </div>