naeu-jekyll 0.5.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
+ :patch: 0
2
3
  :major: 0
3
- :minor: 5
4
- :patch: 5
5
4
  :build:
5
+ :minor: 7
@@ -21,7 +21,9 @@ require 'jekyll/site'
21
21
  require 'jekyll/convertible'
22
22
  require 'jekyll/layout'
23
23
  require 'jekyll/page'
24
+ require 'jekyll/item'
24
25
  require 'jekyll/post'
26
+ require 'jekyll/thing'
25
27
  require 'jekyll/filters'
26
28
  require 'jekyll/tags/highlight'
27
29
  require 'jekyll/tags/include'
@@ -0,0 +1,264 @@
1
+ module Jekyll
2
+
3
+ class Item
4
+ include Comparable
5
+ include Convertible
6
+
7
+ class << self
8
+ attr_accessor :lsi
9
+ end
10
+
11
+ MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$/
12
+
13
+ # Item name validator. Item filenames must be like:
14
+ # 2008-11-05-my-awesome-post.textile
15
+ #
16
+ # Returns <Bool>
17
+ def self.valid?(name)
18
+ name =~ MATCHER
19
+ end
20
+
21
+ attr_accessor :site, :date, :slug, :ext, :published, :data, :content, :output, :tags
22
+ attr_writer :categories
23
+
24
+ def categories
25
+ @categories ||= []
26
+ end
27
+
28
+ # Initialize this Item instance.
29
+ # +site+ is the Site
30
+ # +base+ is the String path to the dir containing the item file
31
+ # +name+ is the String filename of the item file
32
+ #
33
+ # Returns <Item>
34
+ def initialize(site, source, dir, name)
35
+ @under_scored_dir ||= '_posts'
36
+ @kind ||= 'post'
37
+
38
+ @site = site
39
+ @base = File.join(source, dir, @under_scored_dir)
40
+ @name = name
41
+
42
+ self.categories = dir.split('/').reject { |x| x.empty? }
43
+ self.process(name)
44
+ self.read_yaml(@base, name)
45
+
46
+ if self.data.has_key?('published') && self.data['published'] == false
47
+ self.published = false
48
+ else
49
+ self.published = true
50
+ end
51
+
52
+ if self.data.has_key?("tag")
53
+ self.tags = [self.data["tag"]]
54
+ elsif self.data.has_key?("tags")
55
+ self.tags = self.data['tags']
56
+ else
57
+ self.tags = []
58
+ end
59
+
60
+ if self.categories.empty?
61
+ if self.data.has_key?('category')
62
+ self.categories << self.data['category']
63
+ elsif self.data.has_key?('categories')
64
+ # Look for categories in the YAML-header, either specified as
65
+ # an array or a string.
66
+ if self.data['categories'].kind_of? String
67
+ self.categories = self.data['categories'].split
68
+ else
69
+ self.categories = self.data['categories']
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ # Spaceship is based on Post#date, slug
76
+ #
77
+ # Returns -1, 0, 1
78
+ def <=>(other)
79
+ cmp = self.date <=> other.date
80
+ if 0 == cmp
81
+ cmp = self.slug <=> other.slug
82
+ end
83
+ return cmp
84
+ end
85
+
86
+ # Extract information from the post filename
87
+ # +name+ is the String filename of the post file
88
+ #
89
+ # Returns nothing
90
+ def process(name)
91
+ m, cats, date, slug, ext = *name.match(MATCHER)
92
+ self.date = Time.parse(date)
93
+ self.slug = slug
94
+ self.ext = ext
95
+ end
96
+
97
+ # The generated directory into which the post will be placed
98
+ # upon generation. This is derived from the permalink or, if
99
+ # permalink is absent, set to the default date
100
+ # e.g. "/2008/11/05/" if the permalink style is :date, otherwise nothing
101
+ #
102
+ # Returns <String>
103
+ def dir
104
+ File.dirname(url)
105
+ end
106
+
107
+ # The full path and filename of the post.
108
+ # Defined in the YAML of the post body
109
+ # (Optional)
110
+ #
111
+ # Returns <String>
112
+ def permalink
113
+ self.data && self.data['permalink']
114
+ end
115
+
116
+ def template
117
+ case self.site.permalink_style
118
+ when :pretty
119
+ "/:categories/:year/:month/:day/:title/"
120
+ when :none
121
+ "/:categories/:title.html"
122
+ when :date
123
+ "/:categories/:year/:month/:day/:title.html"
124
+ else
125
+ self.site.permalink_style.to_s
126
+ end
127
+ end
128
+
129
+ # The generated relative url of this post
130
+ # e.g. /2008/11/05/my-awesome-post.html
131
+ #
132
+ # Returns <String>
133
+ def url
134
+ return permalink if permalink
135
+
136
+ @url ||= {
137
+ "year" => date.strftime("%Y"),
138
+ "month" => date.strftime("%m"),
139
+ "day" => date.strftime("%d"),
140
+ "title" => CGI.escape(slug),
141
+ "categories" => categories.sort.join('/')
142
+ }.inject(template) { |result, token|
143
+ result.gsub(/:#{token.first}/, token.last)
144
+ }.gsub(/\/\//, "/")
145
+
146
+ @url = add_top_level_dir(@url)
147
+ end
148
+
149
+ # The UID for this post (useful in feeds)
150
+ # e.g. /2008/11/05/my-awesome-post
151
+ #
152
+ # Returns <String>
153
+ def id
154
+ add_top_level_dir(File.join(self.dir, self.slug))
155
+ end
156
+
157
+ def add_top_level_dir(string)
158
+ if @top_level_dir
159
+ "#{@top_level_dir}/#{string}"
160
+ else
161
+ string
162
+ end
163
+ end
164
+
165
+ # Calculate related posts.
166
+ #
167
+ # Returns [<ITem>]
168
+ def related_items(items)
169
+ return [] unless items.size > 1
170
+
171
+ if self.site.lsi
172
+ self.class.lsi ||= begin
173
+ puts "Running the classifier... this could take a while."
174
+ lsi = Classifier::LSI.new
175
+ items.each { |x| $stdout.print(".");$stdout.flush;lsi.add_item(x) }
176
+ puts ""
177
+ lsi
178
+ end
179
+
180
+ related = self.class.lsi.find_related(self.content, 11)
181
+ related - [self]
182
+ else
183
+ (items - [self])[0..9]
184
+ end
185
+ end
186
+
187
+ # Add any necessary layouts to this post
188
+ # +layouts+ is a Hash of {"name" => "layout"}
189
+ # +site_payload+ is the site payload hash
190
+ #
191
+ # Returns nothing
192
+ def render(layouts, site_payload)
193
+ # construct payload
194
+ payload =
195
+ {
196
+ "site" => { "related_items" => related_items(site_payload["site"]["#{@kind}s"]) },
197
+ "page" => self.to_liquid
198
+ }
199
+ payload = payload.deep_merge(site_payload)
200
+
201
+ do_layout(payload, layouts)
202
+ end
203
+
204
+ # Write the generated post file to the destination directory.
205
+ # +dest+ is the String path to the destination dir
206
+ #
207
+ # Returns nothing
208
+ def write(dest)
209
+ FileUtils.mkdir_p(File.join(dest, dir))
210
+
211
+ # The url needs to be unescaped in order to preserve the correct filename
212
+ path = File.join(dest, CGI.unescape(self.url))
213
+
214
+ if template[/\.html$/].nil?
215
+ FileUtils.mkdir_p(path)
216
+ path = File.join(path, "index.html")
217
+ end
218
+
219
+ File.open(path, 'w') do |f|
220
+ f.write(self.output)
221
+ end
222
+ end
223
+
224
+ # Convert this item into a Hash for use in Liquid templates.
225
+ #
226
+ # Returns <Hash>
227
+ def to_liquid
228
+ { "title" => self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '),
229
+ "url" => self.url,
230
+ "date" => self.date,
231
+ "id" => self.id,
232
+ "categories" => self.categories,
233
+ "next" => self.next,
234
+ "previous" => self.previous,
235
+ "tags" => self.tags,
236
+ "content" => self.content,
237
+ "kind" => @kind }.deep_merge(self.data)
238
+ end
239
+
240
+ def inspect
241
+ "<Item(#{@kind}): #{self.id}>"
242
+ end
243
+
244
+ def next
245
+ pos = self.site.posts.index(self)
246
+
247
+ if pos && pos < self.site.posts.length-1
248
+ self.site.posts[pos+1]
249
+ else
250
+ nil
251
+ end
252
+ end
253
+
254
+ def previous
255
+ pos = self.site.posts.index(self)
256
+ if pos && pos > 0
257
+ self.site.posts[pos-1]
258
+ else
259
+ nil
260
+ end
261
+ end
262
+ end
263
+
264
+ end
@@ -1,251 +1,4 @@
1
1
  module Jekyll
2
-
3
- class Post
4
- include Comparable
5
- include Convertible
6
-
7
- class << self
8
- attr_accessor :lsi
9
- end
10
-
11
- MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)(\.[^.]+)$/
12
-
13
- # Post name validator. Post filenames must be like:
14
- # 2008-11-05-my-awesome-post.textile
15
- #
16
- # Returns <Bool>
17
- def self.valid?(name)
18
- name =~ MATCHER
19
- end
20
-
21
- attr_accessor :site, :date, :slug, :ext, :published, :data, :content, :output, :tags
22
- attr_writer :categories
23
-
24
- def categories
25
- @categories ||= []
26
- end
27
-
28
- # Initialize this Post instance.
29
- # +site+ is the Site
30
- # +base+ is the String path to the dir containing the post file
31
- # +name+ is the String filename of the post file
32
- # +categories+ is an Array of Strings for the categories for this post
33
- #
34
- # Returns <Post>
35
- def initialize(site, source, dir, name)
36
- @site = site
37
- @base = File.join(source, dir, '_posts')
38
- @name = name
39
-
40
- self.categories = dir.split('/').reject { |x| x.empty? }
41
- self.process(name)
42
- self.read_yaml(@base, name)
43
-
44
- if self.data.has_key?('published') && self.data['published'] == false
45
- self.published = false
46
- else
47
- self.published = true
48
- end
49
-
50
- if self.data.has_key?("tag")
51
- self.tags = [self.data["tag"]]
52
- elsif self.data.has_key?("tags")
53
- self.tags = self.data['tags']
54
- else
55
- self.tags = []
56
- end
57
-
58
- if self.categories.empty?
59
- if self.data.has_key?('category')
60
- self.categories << self.data['category']
61
- elsif self.data.has_key?('categories')
62
- # Look for categories in the YAML-header, either specified as
63
- # an array or a string.
64
- if self.data['categories'].kind_of? String
65
- self.categories = self.data['categories'].split
66
- else
67
- self.categories = self.data['categories']
68
- end
69
- end
70
- end
71
- end
72
-
73
- # Spaceship is based on Post#date, slug
74
- #
75
- # Returns -1, 0, 1
76
- def <=>(other)
77
- cmp = self.date <=> other.date
78
- if 0 == cmp
79
- cmp = self.slug <=> other.slug
80
- end
81
- return cmp
82
- end
83
-
84
- # Extract information from the post filename
85
- # +name+ is the String filename of the post file
86
- #
87
- # Returns nothing
88
- def process(name)
89
- m, cats, date, slug, ext = *name.match(MATCHER)
90
- self.date = Time.parse(date)
91
- self.slug = slug
92
- self.ext = ext
93
- end
94
-
95
- # The generated directory into which the post will be placed
96
- # upon generation. This is derived from the permalink or, if
97
- # permalink is absent, set to the default date
98
- # e.g. "/2008/11/05/" if the permalink style is :date, otherwise nothing
99
- #
100
- # Returns <String>
101
- def dir
102
- File.dirname(url)
103
- end
104
-
105
- # The full path and filename of the post.
106
- # Defined in the YAML of the post body
107
- # (Optional)
108
- #
109
- # Returns <String>
110
- def permalink
111
- self.data && self.data['permalink']
112
- end
113
-
114
- def template
115
- case self.site.permalink_style
116
- when :pretty
117
- "/:categories/:year/:month/:day/:title/"
118
- when :none
119
- "/:categories/:title.html"
120
- when :date
121
- "/:categories/:year/:month/:day/:title.html"
122
- else
123
- self.site.permalink_style.to_s
124
- end
125
- end
126
-
127
- # The generated relative url of this post
128
- # e.g. /2008/11/05/my-awesome-post.html
129
- #
130
- # Returns <String>
131
- def url
132
- return permalink if permalink
133
-
134
- @url ||= {
135
- "year" => date.strftime("%Y"),
136
- "month" => date.strftime("%m"),
137
- "day" => date.strftime("%d"),
138
- "title" => CGI.escape(slug),
139
- "categories" => categories.sort.join('/')
140
- }.inject(template) { |result, token|
141
- result.gsub(/:#{token.first}/, token.last)
142
- }.gsub(/\/\//, "/")
143
- end
144
-
145
- # The UID for this post (useful in feeds)
146
- # e.g. /2008/11/05/my-awesome-post
147
- #
148
- # Returns <String>
149
- def id
150
- File.join(self.dir, self.slug)
151
- end
152
-
153
- # Calculate related posts.
154
- #
155
- # Returns [<Post>]
156
- def related_posts(posts)
157
- return [] unless posts.size > 1
158
-
159
- if self.site.lsi
160
- self.class.lsi ||= begin
161
- puts "Running the classifier... this could take a while."
162
- lsi = Classifier::LSI.new
163
- posts.each { |x| $stdout.print(".");$stdout.flush;lsi.add_item(x) }
164
- puts ""
165
- lsi
166
- end
167
-
168
- related = self.class.lsi.find_related(self.content, 11)
169
- related - [self]
170
- else
171
- (posts - [self])[0..9]
172
- end
173
- end
174
-
175
- # Add any necessary layouts to this post
176
- # +layouts+ is a Hash of {"name" => "layout"}
177
- # +site_payload+ is the site payload hash
178
- #
179
- # Returns nothing
180
- def render(layouts, site_payload)
181
- # construct payload
182
- payload =
183
- {
184
- "site" => { "related_posts" => related_posts(site_payload["site"]["posts"]) },
185
- "page" => self.to_liquid
186
- }
187
- payload = payload.deep_merge(site_payload)
188
-
189
- do_layout(payload, layouts)
190
- end
191
-
192
- # Write the generated post file to the destination directory.
193
- # +dest+ is the String path to the destination dir
194
- #
195
- # Returns nothing
196
- def write(dest)
197
- FileUtils.mkdir_p(File.join(dest, dir))
198
-
199
- # The url needs to be unescaped in order to preserve the correct filename
200
- path = File.join(dest, CGI.unescape(self.url))
201
-
202
- if template[/\.html$/].nil?
203
- FileUtils.mkdir_p(path)
204
- path = File.join(path, "index.html")
205
- end
206
-
207
- File.open(path, 'w') do |f|
208
- f.write(self.output)
209
- end
210
- end
211
-
212
- # Convert this post into a Hash for use in Liquid templates.
213
- #
214
- # Returns <Hash>
215
- def to_liquid
216
- { "title" => self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '),
217
- "url" => self.url,
218
- "date" => self.date,
219
- "id" => self.id,
220
- "categories" => self.categories,
221
- "next" => self.next,
222
- "previous" => self.previous,
223
- "tags" => self.tags,
224
- "content" => self.content }.deep_merge(self.data)
225
- end
226
-
227
- def inspect
228
- "<Post: #{self.id}>"
229
- end
230
-
231
- def next
232
- pos = self.site.posts.index(self)
233
-
234
- if pos && pos < self.site.posts.length-1
235
- self.site.posts[pos+1]
236
- else
237
- nil
238
- end
239
- end
240
-
241
- def previous
242
- pos = self.site.posts.index(self)
243
- if pos && pos > 0
244
- self.site.posts[pos-1]
245
- else
246
- nil
247
- end
248
- end
2
+ class Post < Item
249
3
  end
250
-
251
4
  end
@@ -1,7 +1,7 @@
1
1
  module Jekyll
2
2
 
3
3
  class Site
4
- attr_accessor :config, :layouts, :posts, :categories, :exclude,
4
+ attr_accessor :config, :layouts, :posts, :things, :categories, :exclude,
5
5
  :source, :dest, :lsi, :pygments, :permalink_style, :tags
6
6
 
7
7
  # Initialize the site
@@ -25,6 +25,7 @@ module Jekyll
25
25
  def reset
26
26
  self.layouts = {}
27
27
  self.posts = []
28
+ self.things = []
28
29
  self.categories = Hash.new { |hash, key| hash[key] = [] }
29
30
  self.tags = Hash.new { |hash, key| hash[key] = [] }
30
31
  end
@@ -95,6 +96,7 @@ module Jekyll
95
96
  self.read_layouts
96
97
  self.transform_pages
97
98
  self.write_posts
99
+ self.write_things
98
100
  end
99
101
 
100
102
  # Read all the files in <source>/_layouts into memory for later use.
@@ -147,6 +149,37 @@ module Jekyll
147
149
  # ignore missing layout dir
148
150
  end
149
151
 
152
+ def read_things(dir)
153
+ base = File.join(self.source, dir, '_things')
154
+ entries = []
155
+ Dir.chdir(base) { entries = filter_entries(Dir['**/*']) }
156
+
157
+ # first pass processes, but does not yet render post content
158
+ entries.each do |f|
159
+ if Thing.valid?(f)
160
+ thing = Thing.new(self, self.source, dir, f)
161
+
162
+ if thing.published
163
+ self.things << thing
164
+ thing.categories.each { |c| self.categories[c] << thing }
165
+ thing.tags.each { |c| self.tags[c] << thing }
166
+ end
167
+ end
168
+ end
169
+
170
+ self.things.sort!
171
+
172
+ # second pass renders each post now that full site payload is available
173
+ self.things.each do |thing|
174
+ thing.render(self.layouts, site_payload)
175
+ end
176
+
177
+ self.categories.values.map { |ps| ps.sort! { |a, b| b <=> a} }
178
+ self.tags.values.map { |ps| ps.sort! { |a, b| b <=> a} }
179
+ rescue Errno::ENOENT => e
180
+ # ignore missing layout dir
181
+ end
182
+
150
183
  # Write each post to <dest>/<year>/<month>/<day>/<slug>
151
184
  #
152
185
  # Returns nothing
@@ -156,6 +189,12 @@ module Jekyll
156
189
  end
157
190
  end
158
191
 
192
+ def write_things
193
+ self.things.each do |thing|
194
+ thing.write(self.dest)
195
+ end
196
+ end
197
+
159
198
  # Copy all regular files from <source> to <dest>/ ignoring
160
199
  # any files/directories that are hidden or backup files (start
161
200
  # with "." or "#" or end with "~") or contain site content (start with "_")
@@ -178,6 +217,11 @@ module Jekyll
178
217
  read_posts(dir)
179
218
  end
180
219
 
220
+ if directories.include?('_things')
221
+ directories.delete('_things')
222
+ read_things(dir)
223
+ end
224
+
181
225
  [directories, files].each do |entries|
182
226
  entries.each do |f|
183
227
  if File.directory?(File.join(base, f))
@@ -214,6 +258,15 @@ module Jekyll
214
258
  return hash
215
259
  end
216
260
 
261
+ def thing_attr_hash(thing_attr)
262
+ # Build a hash map based on the specified post attribute ( post attr => array of posts )
263
+ # then sort each array in reverse order
264
+ hash = Hash.new { |hash, key| hash[key] = Array.new }
265
+ self.things.each { |p| p.send(thing_attr.to_sym).each { |t| hash[t] << p } }
266
+ hash.values.map { |sortme| sortme.sort! { |a, b| b <=> a} }
267
+ return hash
268
+ end
269
+
217
270
  # The Hash payload containing site-wide data
218
271
  #
219
272
  # Returns {"site" => {"time" => <Time>,
@@ -223,6 +276,7 @@ module Jekyll
223
276
  {"site" => self.config.merge({
224
277
  "time" => Time.now,
225
278
  "posts" => self.posts.sort { |a,b| b <=> a },
279
+ "things" => self.things.sort { |a,b| b <=> a },
226
280
  "categories" => post_attr_hash('categories'),
227
281
  "tags" => post_attr_hash('tags')})}
228
282
  end
@@ -233,7 +287,7 @@ module Jekyll
233
287
  # '.htaccess'
234
288
  def filter_entries(entries)
235
289
  entries = entries.reject do |e|
236
- unless ['_posts', '.htaccess'].include?(e)
290
+ unless ['_posts', '_things', '.htaccess'].include?(e)
237
291
  ['.', '_', '#'].include?(e[0..0]) || e[-1..-1] == '~' || self.exclude.include?(e)
238
292
  end
239
293
  end
@@ -0,0 +1,28 @@
1
+ module Jekyll
2
+ class Thing < Item
3
+ def initialize(site, source, dir, name)
4
+ @kind = 'thing'
5
+ @under_scored_dir = '_things'
6
+ super
7
+ end
8
+
9
+ def next
10
+ pos = self.site.things.index(self)
11
+
12
+ if pos && pos < self.site.things.length-1
13
+ self.site.things[pos+1]
14
+ else
15
+ nil
16
+ end
17
+ end
18
+
19
+ def previous
20
+ pos = self.site.things.index(self)
21
+ if pos && pos > 0
22
+ self.site.things[pos-1]
23
+ else
24
+ nil
25
+ end
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naeu-jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-11 00:00:00 +01:00
12
+ date: 2010-02-07 00:00:00 +01:00
13
13
  default_executable: jekyll
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -96,18 +96,12 @@ files:
96
96
  - features/site_data.feature
97
97
  - features/step_definitions/jekyll_steps.rb
98
98
  - features/support/env.rb
99
- - jekyll.gemspec
100
99
  - lib/jekyll.rb
101
100
  - lib/jekyll/albino.rb
102
- - lib/jekyll/converters/csv.rb
103
- - lib/jekyll/converters/mephisto.rb
104
- - lib/jekyll/converters/mt.rb
105
- - lib/jekyll/converters/textpattern.rb
106
- - lib/jekyll/converters/typo.rb
107
- - lib/jekyll/converters/wordpress.rb
108
101
  - lib/jekyll/convertible.rb
109
102
  - lib/jekyll/core_ext.rb
110
103
  - lib/jekyll/filters.rb
104
+ - lib/jekyll/item.rb
111
105
  - lib/jekyll/layout.rb
112
106
  - lib/jekyll/page.rb
113
107
  - lib/jekyll/pager.rb
@@ -115,6 +109,7 @@ files:
115
109
  - lib/jekyll/site.rb
116
110
  - lib/jekyll/tags/highlight.rb
117
111
  - lib/jekyll/tags/include.rb
112
+ - lib/jekyll/thing.rb
118
113
  - test/helper.rb
119
114
  - test/source/_includes/sig.markdown
120
115
  - test/source/_layouts/default.html
@@ -1,135 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{jekyll}
5
- s.version = "0.5.4"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Tom Preston-Werner"]
9
- s.date = %q{2009-08-24}
10
- s.default_executable = %q{jekyll}
11
- s.description = %q{Jekyll is a simple, blog aware, static site generator.}
12
- s.email = %q{tom@mojombo.com}
13
- s.executables = ["jekyll"]
14
- s.extra_rdoc_files = [
15
- "README.textile"
16
- ]
17
- s.files = [
18
- ".gitignore",
19
- "History.txt",
20
- "README.textile",
21
- "Rakefile",
22
- "VERSION.yml",
23
- "bin/jekyll",
24
- "features/create_sites.feature",
25
- "features/embed_filters.feature",
26
- "features/pagination.feature",
27
- "features/permalinks.feature",
28
- "features/post_data.feature",
29
- "features/site_configuration.feature",
30
- "features/site_data.feature",
31
- "features/step_definitions/jekyll_steps.rb",
32
- "features/support/env.rb",
33
- "jekyll.gemspec",
34
- "lib/jekyll.rb",
35
- "lib/jekyll/albino.rb",
36
- "lib/jekyll/converters/csv.rb",
37
- "lib/jekyll/converters/mephisto.rb",
38
- "lib/jekyll/converters/mt.rb",
39
- "lib/jekyll/converters/textpattern.rb",
40
- "lib/jekyll/converters/typo.rb",
41
- "lib/jekyll/converters/wordpress.rb",
42
- "lib/jekyll/convertible.rb",
43
- "lib/jekyll/core_ext.rb",
44
- "lib/jekyll/filters.rb",
45
- "lib/jekyll/layout.rb",
46
- "lib/jekyll/page.rb",
47
- "lib/jekyll/pager.rb",
48
- "lib/jekyll/post.rb",
49
- "lib/jekyll/site.rb",
50
- "lib/jekyll/tags/highlight.rb",
51
- "lib/jekyll/tags/include.rb",
52
- "test/helper.rb",
53
- "test/source/_includes/sig.markdown",
54
- "test/source/_layouts/default.html",
55
- "test/source/_layouts/simple.html",
56
- "test/source/_posts/2008-02-02-not-published.textile",
57
- "test/source/_posts/2008-02-02-published.textile",
58
- "test/source/_posts/2008-10-18-foo-bar.textile",
59
- "test/source/_posts/2008-11-21-complex.textile",
60
- "test/source/_posts/2008-12-03-permalinked-post.textile",
61
- "test/source/_posts/2008-12-13-include.markdown",
62
- "test/source/_posts/2009-01-27-array-categories.textile",
63
- "test/source/_posts/2009-01-27-categories.textile",
64
- "test/source/_posts/2009-01-27-category.textile",
65
- "test/source/_posts/2009-03-12-hash-#1.markdown",
66
- "test/source/_posts/2009-05-18-tag.textile",
67
- "test/source/_posts/2009-05-18-tags.textile",
68
- "test/source/_posts/2009-06-22-empty-yaml.textile",
69
- "test/source/_posts/2009-06-22-no-yaml.textile",
70
- "test/source/about.html",
71
- "test/source/category/_posts/2008-9-23-categories.textile",
72
- "test/source/contacts.html",
73
- "test/source/css/screen.css",
74
- "test/source/foo/_posts/bar/2008-12-12-topical-post.textile",
75
- "test/source/index.html",
76
- "test/source/sitemap.xml",
77
- "test/source/win/_posts/2009-05-24-yaml-linebreak.markdown",
78
- "test/source/z_category/_posts/2008-9-23-categories.textile",
79
- "test/suite.rb",
80
- "test/test_configuration.rb",
81
- "test/test_filters.rb",
82
- "test/test_generated_site.rb",
83
- "test/test_page.rb",
84
- "test/test_pager.rb",
85
- "test/test_post.rb",
86
- "test/test_site.rb",
87
- "test/test_tags.rb"
88
- ]
89
- s.homepage = %q{http://github.com/mojombo/jekyll}
90
- s.rdoc_options = ["--charset=UTF-8"]
91
- s.require_paths = ["lib"]
92
- s.rubyforge_project = %q{jekyll}
93
- s.rubygems_version = %q{1.3.5}
94
- s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
95
- s.test_files = [
96
- "test/helper.rb",
97
- "test/suite.rb",
98
- "test/test_configuration.rb",
99
- "test/test_filters.rb",
100
- "test/test_generated_site.rb",
101
- "test/test_page.rb",
102
- "test/test_pager.rb",
103
- "test/test_post.rb",
104
- "test/test_site.rb",
105
- "test/test_tags.rb"
106
- ]
107
-
108
- if s.respond_to? :specification_version then
109
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
110
- s.specification_version = 3
111
-
112
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
113
- s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.1"])
114
- s.add_runtime_dependency(%q<liquid>, [">= 1.9.0"])
115
- s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
116
- s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
117
- s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
118
- s.add_runtime_dependency(%q<open4>, [">= 0.9.6"])
119
- else
120
- s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
121
- s.add_dependency(%q<liquid>, [">= 1.9.0"])
122
- s.add_dependency(%q<classifier>, [">= 1.3.1"])
123
- s.add_dependency(%q<maruku>, [">= 0.5.9"])
124
- s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
125
- s.add_dependency(%q<open4>, [">= 0.9.6"])
126
- end
127
- else
128
- s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
129
- s.add_dependency(%q<liquid>, [">= 1.9.0"])
130
- s.add_dependency(%q<classifier>, [">= 1.3.1"])
131
- s.add_dependency(%q<maruku>, [">= 0.5.9"])
132
- s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
133
- s.add_dependency(%q<open4>, [">= 0.9.6"])
134
- end
135
- end
@@ -1,26 +0,0 @@
1
- module Jekyll
2
- module CSV
3
- #Reads a csv with title, permalink, body, published_at, and filter.
4
- #It creates a post file for each row in the csv
5
- def self.process(file = "posts.csv")
6
- FileUtils.mkdir_p "_posts"
7
- posts = 0
8
- FasterCSV.foreach(file) do |row|
9
- next if row[0] == "title"
10
- posts += 1
11
- name = row[3].split(" ")[0]+"-"+row[1]+(row[4] =~ /markdown/ ? ".markdown" : ".textile")
12
- File.open("_posts/#{name}", "w") do |f|
13
- f.puts <<-HEADER
14
- ---
15
- layout: post
16
- title: #{row[0]}
17
- ---
18
-
19
- HEADER
20
- f.puts row[2]
21
- end
22
- end
23
- "Created #{posts} posts!"
24
- end
25
- end
26
- end
@@ -1,79 +0,0 @@
1
- # Quickly hacked together my Michael Ivey
2
- # Based on mt.rb by Nick Gerakines, open source and publically
3
- # available under the MIT license. Use this module at your own risk.
4
-
5
- require 'rubygems'
6
- require 'sequel'
7
- require 'fastercsv'
8
- require 'fileutils'
9
- require File.join(File.dirname(__FILE__),"csv.rb")
10
-
11
- # NOTE: This converter requires Sequel and the MySQL gems.
12
- # The MySQL gem can be difficult to install on OS X. Once you have MySQL
13
- # installed, running the following commands should work:
14
- # $ sudo gem install sequel
15
- # $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
16
-
17
- module Jekyll
18
- module Mephisto
19
- #Accepts a hash with database config variables, exports mephisto posts into a csv
20
- #export PGPASSWORD if you must
21
- def self.postgres(c)
22
- sql = <<-SQL
23
- BEGIN;
24
- CREATE TEMP TABLE jekyll AS
25
- SELECT title, permalink, body, published_at, filter FROM contents
26
- WHERE user_id = 1 AND type = 'Article' ORDER BY published_at;
27
- COPY jekyll TO STDOUT WITH CSV HEADER;
28
- ROLLBACK;
29
- SQL
30
- command = %Q(psql -h #{c[:host] || "localhost"} -c "#{sql.strip}" #{c[:database]} #{c[:username]} -o #{c[:filename] || "posts.csv"})
31
- puts command
32
- `#{command}`
33
- CSV.process
34
- end
35
-
36
- # This query will pull blog posts from all entries across all blogs. If
37
- # you've got unpublished, deleted or otherwise hidden posts please sift
38
- # through the created posts to make sure nothing is accidently published.
39
-
40
- QUERY = "SELECT id, permalink, body, published_at, title FROM contents WHERE user_id = 1 AND type = 'Article' AND published_at IS NOT NULL ORDER BY published_at"
41
-
42
- def self.process(dbname, user, pass, host = 'localhost')
43
- db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host)
44
-
45
- FileUtils.mkdir_p "_posts"
46
-
47
- db[QUERY].each do |post|
48
- title = post[:title]
49
- slug = post[:permalink]
50
- date = post[:published_at]
51
- content = post[:body]
52
- # more_content = ''
53
-
54
- # Be sure to include the body and extended body.
55
- # if more_content != nil
56
- # content = content + " \n" + more_content
57
- # end
58
-
59
- # Ideally, this script would determine the post format (markdown, html
60
- # , etc) and create files with proper extensions. At this point it
61
- # just assumes that markdown will be acceptable.
62
- name = [date.year, date.month, date.day, slug].join('-') + ".markdown"
63
-
64
- data = {
65
- 'layout' => 'post',
66
- 'title' => title.to_s,
67
- 'mt_id' => post[:entry_id],
68
- }.delete_if { |k,v| v.nil? || v == ''}.to_yaml
69
-
70
- File.open("_posts/#{name}", "w") do |f|
71
- f.puts data
72
- f.puts "---"
73
- f.puts content
74
- end
75
- end
76
-
77
- end
78
- end
79
- end
@@ -1,59 +0,0 @@
1
- # Created by Nick Gerakines, open source and publically available under the
2
- # MIT license. Use this module at your own risk.
3
- # I'm an Erlang/Perl/C++ guy so please forgive my dirty ruby.
4
-
5
- require 'rubygems'
6
- require 'sequel'
7
- require 'fileutils'
8
-
9
- # NOTE: This converter requires Sequel and the MySQL gems.
10
- # The MySQL gem can be difficult to install on OS X. Once you have MySQL
11
- # installed, running the following commands should work:
12
- # $ sudo gem install sequel
13
- # $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
14
-
15
- module Jekyll
16
- module MT
17
- # This query will pull blog posts from all entries across all blogs. If
18
- # you've got unpublished, deleted or otherwise hidden posts please sift
19
- # through the created posts to make sure nothing is accidently published.
20
- QUERY = "SELECT entry_id, entry_basename, entry_text, entry_text_more, entry_created_on, entry_title FROM mt_entry"
21
-
22
- def self.process(dbname, user, pass, host = 'localhost')
23
- db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host)
24
-
25
- FileUtils.mkdir_p "_posts"
26
-
27
- db[QUERY].each do |post|
28
- title = post[:entry_title]
29
- slug = post[:entry_basename]
30
- date = post[:entry_created_on]
31
- content = post[:entry_text]
32
- more_content = post[:entry_text_more]
33
-
34
- # Be sure to include the body and extended body.
35
- if more_content != nil
36
- content = content + " \n" + more_content
37
- end
38
-
39
- # Ideally, this script would determine the post format (markdown, html
40
- # , etc) and create files with proper extensions. At this point it
41
- # just assumes that markdown will be acceptable.
42
- name = [date.year, date.month, date.day, slug].join('-') + ".markdown"
43
-
44
- data = {
45
- 'layout' => 'post',
46
- 'title' => title.to_s,
47
- 'mt_id' => post[:entry_id],
48
- }.delete_if { |k,v| v.nil? || v == ''}.to_yaml
49
-
50
- File.open("_posts/#{name}", "w") do |f|
51
- f.puts data
52
- f.puts "---"
53
- f.puts content
54
- end
55
- end
56
-
57
- end
58
- end
59
- end
@@ -1,50 +0,0 @@
1
- require 'rubygems'
2
- require 'sequel'
3
- require 'fileutils'
4
-
5
- # NOTE: This converter requires Sequel and the MySQL gems.
6
- # The MySQL gem can be difficult to install on OS X. Once you have MySQL
7
- # installed, running the following commands should work:
8
- # $ sudo gem install sequel
9
- # $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
10
-
11
- module Jekyll
12
- module TextPattern
13
- # Reads a MySQL database via Sequel and creates a post file for each post.
14
- # The only posts selected are those with a status of 4 or 5, which means "live"
15
- # and "sticky" respectively.
16
- # Other statuses is 1 => draft, 2 => hidden and 3 => pending
17
- QUERY = "select Title, url_title, Posted, Body, Keywords from textpattern where Status = '4' or Status = '5'"
18
-
19
- def self.process(dbname, user, pass, host = 'localhost')
20
- db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host)
21
-
22
- FileUtils.mkdir_p "_posts"
23
-
24
- db[QUERY].each do |post|
25
- # Get required fields and construct Jekyll compatible name
26
- title = post[:Title]
27
- slug = post[:url_title]
28
- date = post[:Posted]
29
- content = post[:Body]
30
-
31
- name = [date.strftime("%Y-%m-%d"), slug].join('-') + ".textile"
32
-
33
- # Get the relevant fields as a hash, delete empty fields and convert
34
- # to YAML for the header
35
- data = {
36
- 'layout' => 'post',
37
- 'title' => title.to_s,
38
- 'tags' => post[:Keywords].split(',')
39
- }.delete_if { |k,v| v.nil? || v == ''}.to_yaml
40
-
41
- # Write out the data and content to file
42
- File.open("_posts/#{name}", "w") do |f|
43
- f.puts data
44
- f.puts "---"
45
- f.puts content
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,49 +0,0 @@
1
- # Author: Toby DiPasquale <toby@cbcg.net>
2
- require 'fileutils'
3
- require 'rubygems'
4
- require 'sequel'
5
-
6
- module Jekyll
7
- module Typo
8
- # this SQL *should* work for both MySQL and PostgreSQL, but I haven't
9
- # tested PostgreSQL yet (as of 2008-12-16)
10
- SQL = <<-EOS
11
- SELECT c.id id,
12
- c.title title,
13
- c.permalink slug,
14
- c.body body,
15
- c.published_at date,
16
- c.state state,
17
- COALESCE(tf.name, 'html') filter
18
- FROM contents c
19
- LEFT OUTER JOIN text_filters tf
20
- ON c.text_filter_id = tf.id
21
- EOS
22
-
23
- def self.process dbname, user, pass, host='localhost'
24
- FileUtils.mkdir_p '_posts'
25
- db = Sequel.mysql dbname, :user => user, :password => pass, :host => host
26
- db[SQL].each do |post|
27
- next unless post[:state] =~ /Published/
28
-
29
- name = [ sprintf("%.04d", post[:date].year),
30
- sprintf("%.02d", post[:date].month),
31
- sprintf("%.02d", post[:date].day),
32
- post[:slug].strip ].join('-')
33
- # Can have more than one text filter in this field, but we just want
34
- # the first one for this
35
- name += '.' + post[:filter].split(' ')[0]
36
-
37
- File.open("_posts/#{name}", 'w') do |f|
38
- f.puts({ 'layout' => 'post',
39
- 'title' => post[:title].to_s,
40
- 'typo_id' => post[:id]
41
- }.delete_if { |k, v| v.nil? || v == '' }.to_yaml)
42
- f.puts '---'
43
- f.puts post[:body].delete("\r")
44
- end
45
- end
46
- end
47
-
48
- end # module Typo
49
- end # module Jekyll
@@ -1,54 +0,0 @@
1
- require 'rubygems'
2
- require 'sequel'
3
- require 'fileutils'
4
-
5
- # NOTE: This converter requires Sequel and the MySQL gems.
6
- # The MySQL gem can be difficult to install on OS X. Once you have MySQL
7
- # installed, running the following commands should work:
8
- # $ sudo gem install sequel
9
- # $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
10
-
11
- module Jekyll
12
- module WordPress
13
-
14
- # Reads a MySQL database via Sequel and creates a post file for each
15
- # post in wp_posts that has post_status = 'publish'.
16
- # This restriction is made because 'draft' posts are not guaranteed to
17
- # have valid dates.
18
- QUERY = "select post_title, post_name, post_date, post_content, post_excerpt, ID, guid from wp_posts where post_status = 'publish' and post_type = 'post'"
19
-
20
- def self.process(dbname, user, pass, host = 'localhost')
21
- db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host)
22
-
23
- FileUtils.mkdir_p "_posts"
24
-
25
- db[QUERY].each do |post|
26
- # Get required fields and construct Jekyll compatible name
27
- title = post[:post_title]
28
- slug = post[:post_name]
29
- date = post[:post_date]
30
- content = post[:post_content]
31
- name = "%02d-%02d-%02d-%s.markdown" % [date.year, date.month, date.day,
32
- slug]
33
-
34
- # Get the relevant fields as a hash, delete empty fields and convert
35
- # to YAML for the header
36
- data = {
37
- 'layout' => 'post',
38
- 'title' => title.to_s,
39
- 'excerpt' => post[:post_excerpt].to_s,
40
- 'wordpress_id' => post[:ID],
41
- 'wordpress_url' => post[:guid]
42
- }.delete_if { |k,v| v.nil? || v == ''}.to_yaml
43
-
44
- # Write out the data and content to file
45
- File.open("_posts/#{name}", "w") do |f|
46
- f.puts data
47
- f.puts "---"
48
- f.puts content
49
- end
50
- end
51
-
52
- end
53
- end
54
- end