jekyll 1.0.0.beta1 → 1.0.0.beta2

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.

@@ -19,7 +19,7 @@ module Jekyll
19
19
  end
20
20
 
21
21
  attr_accessor :site
22
- attr_accessor :data, :content, :output, :ext
22
+ attr_accessor :data, :excerpt, :content, :output, :ext
23
23
  attr_accessor :date, :slug, :published, :tags, :categories
24
24
 
25
25
  attr_reader :name
@@ -36,7 +36,7 @@ module Jekyll
36
36
  @base = self.containing_dir(source, dir)
37
37
  @name = name
38
38
 
39
- self.categories = dir.split('/').reject { |x| x.empty? }
39
+ self.categories = dir.downcase.split('/').reject { |x| x.empty? }
40
40
  self.process(name)
41
41
  begin
42
42
  self.read_yaml(@base, name)
@@ -60,7 +60,7 @@ module Jekyll
60
60
  self.tags = self.data.pluralized_array("tag", "tags")
61
61
 
62
62
  if self.categories.empty?
63
- self.categories = self.data.pluralized_array('category', 'categories')
63
+ self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.downcase}
64
64
  end
65
65
  end
66
66
 
@@ -77,8 +77,8 @@ module Jekyll
77
77
  # Returns nothing.
78
78
  def read_yaml(base, name)
79
79
  super(base, name)
80
+ self.excerpt = self.extract_excerpt
80
81
  self.data['layout'] = 'post' unless self.data.has_key?('layout')
81
- self.data
82
82
  end
83
83
 
84
84
  # Compares Post objects. First compares the Post date. If the dates are
@@ -109,6 +109,14 @@ module Jekyll
109
109
  raise FatalException.new("Post #{name} does not have a valid date.")
110
110
  end
111
111
 
112
+ # Transform the contents and excerpt based on the content type.
113
+ #
114
+ # Returns nothing.
115
+ def transform
116
+ super
117
+ self.excerpt = converter.convert(self.excerpt)
118
+ end
119
+
112
120
  # The generated directory into which the post will be placed
113
121
  # upon generation. This is derived from the permalink or, if
114
122
  # permalink is absent, set to the default date
@@ -257,7 +265,8 @@ module Jekyll
257
265
  "next" => self.next,
258
266
  "previous" => self.previous,
259
267
  "tags" => self.tags,
260
- "content" => self.content })
268
+ "content" => self.content,
269
+ "excerpt" => self.excerpt })
261
270
  end
262
271
 
263
272
  # Returns the shorthand String identifier of this Post.
@@ -283,5 +292,48 @@ module Jekyll
283
292
  nil
284
293
  end
285
294
  end
295
+
296
+ protected
297
+
298
+ # Internal: Extract excerpt from the content
299
+ #
300
+ # By default excerpt is your first paragraph of a post: everything before
301
+ # the first two new lines:
302
+ #
303
+ # ---
304
+ # title: Example
305
+ # ---
306
+ #
307
+ # First paragraph with [link][1].
308
+ #
309
+ # Second paragraph.
310
+ #
311
+ # [1]: http://example.com/
312
+ #
313
+ # This is fairly good option for Markdown and Textile files. But might cause
314
+ # problems for HTML posts (which is quite unusual for Jekyll). If default
315
+ # excerpt delimiter is not good for you, you might want to set your own via
316
+ # configuration option `excerpt_separator`. For example, following is a good
317
+ # alternative for HTML posts:
318
+ #
319
+ # # file: _config.yml
320
+ # excerpt_separator: "<!-- more -->"
321
+ #
322
+ # Notice that all markdown-style link references will be appended to the
323
+ # excerpt. So the example post above will have this excerpt source:
324
+ #
325
+ # First paragraph with [link][1].
326
+ #
327
+ # [1]: http://example.com/
328
+ #
329
+ # Excerpts are rendered same time as content is rendered.
330
+ #
331
+ # Returns excerpt String
332
+ def extract_excerpt
333
+ separator = self.site.config['excerpt_separator']
334
+ head, _, tail = self.content.partition(separator)
335
+
336
+ "" << head << "\n\n" << tail.scan(/^\[[^\]]+\]:.+$/).join("\n")
337
+ end
286
338
  end
287
339
  end
@@ -5,7 +5,7 @@ module Jekyll
5
5
  attr_accessor :config, :layouts, :posts, :pages, :static_files,
6
6
  :categories, :exclude, :include, :source, :dest, :lsi, :pygments,
7
7
  :permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts,
8
- :show_drafts, :keep_files
8
+ :show_drafts, :keep_files, :baseurl
9
9
 
10
10
  attr_accessor :converters, :generators
11
11
 
@@ -21,6 +21,7 @@ module Jekyll
21
21
  self.plugins = plugins_path
22
22
  self.lsi = config['lsi']
23
23
  self.pygments = config['pygments']
24
+ self.baseurl = config['baseurl']
24
25
  self.permalink_style = config['permalink'].to_sym
25
26
  self.exclude = config['exclude'] || []
26
27
  self.include = config['include'] || []
@@ -88,17 +89,8 @@ module Jekyll
88
89
  end
89
90
  end
90
91
 
91
- self.converters = Jekyll::Converter.subclasses.select do |c|
92
- !self.safe || c.safe
93
- end.map do |c|
94
- c.new(self.config)
95
- end
96
-
97
- self.generators = Jekyll::Generator.subclasses.select do |c|
98
- !self.safe || c.safe
99
- end.map do |c|
100
- c.new(self.config)
101
- end
92
+ self.converters = instantiate_subclasses(Jekyll::Converter)
93
+ self.generators = instantiate_subclasses(Jekyll::Generator)
102
94
  end
103
95
 
104
96
  # Internal: Setup the plugin search path
@@ -388,6 +380,21 @@ module Jekyll
388
380
  end
389
381
  end
390
382
 
383
+ # Create array of instances of the subclasses of the class or module
384
+ # passed in as argument.
385
+ #
386
+ # klass - class or module containing the subclasses which should be
387
+ # instantiated
388
+ #
389
+ # Returns array of instances of subclasses of parameter
390
+ def instantiate_subclasses(klass)
391
+ klass.subclasses.select do |c|
392
+ !self.safe || c.safe
393
+ end.sort.map do |c|
394
+ c.new(self.config)
395
+ end
396
+ end
397
+
391
398
  # Read the entries from a particular directory for processing
392
399
  #
393
400
  # dir - The String relative path of the directory to read
@@ -2,16 +2,27 @@
2
2
  #
3
3
  # Example:
4
4
  # {% gist 1234567 %}
5
+ # {% gist 1234567 file.rb %}
5
6
 
6
7
  module Jekyll
7
8
  class GistTag < Liquid::Tag
8
- def initialize(tag_name, gist, tokens)
9
- super
10
- @gist = gist.strip
9
+ def render(context)
10
+ if tag_contents = @markup.strip.match(/\A(\d+) ?(\S*)\Z/)
11
+ gist_id, filename = tag_contents[1].strip, tag_contents[2].strip
12
+ gist_script_tag(gist_id, filename)
13
+ else
14
+ "Error parsing gist id"
15
+ end
11
16
  end
12
17
 
13
- def render(context)
14
- "<script src=\"https://gist.github.com/#{@gist}.js\"> </script>"
18
+ private
19
+
20
+ def gist_script_tag(gist_id, filename=nil)
21
+ if filename.empty?
22
+ "<script src=\"https://gist.github.com/#{gist_id}.js\"> </script>"
23
+ else
24
+ "<script src=\"https://gist.github.com/#{gist_id}.js?file=#{filename}\"> </script>"
25
+ end
15
26
  end
16
27
  end
17
28
  end
@@ -0,0 +1,2 @@
1
+ markdown: rdiscount
2
+ pygments: true
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
+ <title>{{ page.title }}</title>
6
+ <!-- syntax highlighting CSS -->
7
+ <link rel="stylesheet" href="/css/syntax.css" type="text/css" />
8
+ <!-- Homepage CSS -->
9
+ <link rel="stylesheet" href="/css/screen.css" type="text/css" media="screen, projection" />
10
+ </head>
11
+ <body>
12
+ <div class="site">
13
+ <div class="title">
14
+ <a href="/">Your Name</a>
15
+ <a class="extra" href="/">home</a>
16
+ </div>
17
+
18
+ {{ content }}
19
+
20
+ <div class="footer">
21
+ <div class="contact">
22
+ <p>
23
+ Your Name<br />
24
+ What You Are<br />
25
+ your@email.com
26
+ </p>
27
+ </div>
28
+ <div class="contact">
29
+ <p>
30
+ <a href="http://github.com/yourusername/">github.com/yourusername</a><br />
31
+ <a href="http://twitter.com/yourusername/">twitter.com/yourusername</a><br />
32
+ </p>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <a href="http://github.com/yourusername"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" /></a>
37
+ </body>
38
+ </html>
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+ <div id="post">
5
+ {{ content }}
6
+ </div>
@@ -0,0 +1,24 @@
1
+ ---
2
+ layout: post
3
+ title: "Welcome to Jekyll!"
4
+ date: <%= Time.now.strftime('%Y-%m-%d %H:%M:%S') %>
5
+ categories: jekyll update
6
+ ---
7
+
8
+ You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!
9
+ To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.
10
+
11
+ Jekyll also offers powerful support for code snippets:
12
+
13
+ {% highlight ruby %}
14
+ def print_hi(name)
15
+ puts "Hi, #{name}"
16
+ end
17
+ print_hi('Tom')
18
+ #=> prints 'Hi, Tom' to STDOUT.
19
+ {% endhighlight %}
20
+
21
+ Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].
22
+
23
+ [jekyll-gh]: https://github.com/mojombo/jekyll
24
+ [jekyll]: http://jekyllrb.com
@@ -0,0 +1,189 @@
1
+ /*****************************************************************************/
2
+ /*
3
+ /* Common
4
+ /*
5
+ /*****************************************************************************/
6
+
7
+ /* Global Reset */
8
+
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ html, body {
15
+ height: 100%;
16
+ }
17
+
18
+ body {
19
+ background-color: white;
20
+ font: 13.34px helvetica, arial, clean, sans-serif;
21
+ *font-size: small;
22
+ text-align: center;
23
+ }
24
+
25
+ h1, h2, h3, h4, h5, h6 {
26
+ font-size: 100%;
27
+ }
28
+
29
+ h1 {
30
+ margin-bottom: 1em;
31
+ }
32
+
33
+ p {
34
+ margin: 1em 0;
35
+ }
36
+
37
+ a {
38
+ color: #00a;
39
+ }
40
+
41
+ a:hover {
42
+ color: black;
43
+ }
44
+
45
+ a:visited {
46
+ color: #a0a;
47
+ }
48
+
49
+ table {
50
+ font-size: inherit;
51
+ font: 100%;
52
+ }
53
+
54
+ /*****************************************************************************/
55
+ /*
56
+ /* Home
57
+ /*
58
+ /*****************************************************************************/
59
+
60
+ ul.posts {
61
+ list-style-type: none;
62
+ margin-bottom: 2em;
63
+ }
64
+
65
+ ul.posts li {
66
+ line-height: 1.75em;
67
+ }
68
+
69
+ ul.posts span {
70
+ color: #aaa;
71
+ font-family: Monaco, "Courier New", monospace;
72
+ font-size: 80%;
73
+ }
74
+
75
+ /*****************************************************************************/
76
+ /*
77
+ /* Site
78
+ /*
79
+ /*****************************************************************************/
80
+
81
+ .site {
82
+ font-size: 110%;
83
+ text-align: justify;
84
+ width: 42em;
85
+ margin: 3em auto 2em auto;
86
+ line-height: 1.5em;
87
+ }
88
+
89
+ .title {
90
+ color: #a00;
91
+ font-weight: bold;
92
+ margin-bottom: 2em;
93
+ }
94
+
95
+ .site .title a {
96
+ color: #a00;
97
+ text-decoration: none;
98
+ }
99
+
100
+ .site .title a:hover {
101
+ color: black;
102
+ }
103
+
104
+ .site .title a.extra {
105
+ color: #aaa;
106
+ text-decoration: none;
107
+ margin-left: 1em;
108
+ }
109
+
110
+ .site .title a.extra:hover {
111
+ color: black;
112
+ }
113
+
114
+ .site .meta {
115
+ color: #aaa;
116
+ }
117
+
118
+ .site .footer {
119
+ font-size: 80%;
120
+ color: #666;
121
+ border-top: 4px solid #eee;
122
+ margin-top: 2em;
123
+ overflow: hidden;
124
+ }
125
+
126
+ .site .footer .contact {
127
+ float: left;
128
+ margin-right: 3em;
129
+ }
130
+
131
+ .site .footer .contact a {
132
+ color: #8085C1;
133
+ }
134
+
135
+ .site .footer .rss {
136
+ margin-top: 1.1em;
137
+ margin-right: -.2em;
138
+ float: right;
139
+ }
140
+
141
+ .site .footer .rss img {
142
+ border: 0;
143
+ }
144
+
145
+ /*****************************************************************************/
146
+ /*
147
+ /* Posts
148
+ /*
149
+ /*****************************************************************************/
150
+
151
+ #post {
152
+
153
+ }
154
+
155
+ /* standard */
156
+
157
+ #post pre {
158
+ border: 1px solid #ddd;
159
+ background-color: #eef;
160
+ padding: 0 .4em;
161
+ }
162
+
163
+ #post ul,
164
+ #post ol {
165
+ margin-left: 1.35em;
166
+ }
167
+
168
+ #post code {
169
+ border: 1px solid #ddd;
170
+ background-color: #eef;
171
+ font-size: 85%;
172
+ padding: 0 .2em;
173
+ }
174
+
175
+ #post pre code {
176
+ border: none;
177
+ }
178
+
179
+ /* terminal */
180
+
181
+ #post pre.terminal {
182
+ border: 1px solid black;
183
+ background-color: #333;
184
+ color: white;
185
+ }
186
+
187
+ #post pre.terminal code {
188
+ background-color: #333;
189
+ }