jsjohnst-jekyll 0.4.1.999.4 → 0.4.1.999.6
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.
- data/lib/jekyll.rb +0 -11
- data/lib/jekyll/albino.rb +8 -2
- data/lib/jekyll/filters.rb +4 -0
- data/lib/jekyll/page.rb +2 -0
- data/lib/jekyll/post.rb +30 -28
- data/lib/jekyll/site.rb +8 -4
- data/lib/jekyll/tags/highlight.rb +4 -3
- metadata +1 -1
data/lib/jekyll.rb
CHANGED
@@ -17,17 +17,6 @@ require 'redcloth'
|
|
17
17
|
require 'hpricot'
|
18
18
|
begin
|
19
19
|
require 'maruku'
|
20
|
-
require 'maruku/ext/math'
|
21
|
-
# Switch off MathML output
|
22
|
-
MaRuKu::Globals[:html_math_output_mathml] = false
|
23
|
-
MaRuKu::Globals[:html_math_engine] = 'none'
|
24
|
-
|
25
|
-
# Turn on math to PNG support with blahtex
|
26
|
-
# Resulting PNGs stored in `images/latex`
|
27
|
-
MaRuKu::Globals[:html_math_output_png] = true
|
28
|
-
MaRuKu::Globals[:html_png_engine] = 'blahtex'
|
29
|
-
MaRuKu::Globals[:html_png_dir] = 'images/latex'
|
30
|
-
MaRuKu::Globals[:html_png_url] = '/images/latex/'
|
31
20
|
rescue LoadError
|
32
21
|
puts "The maruku gem is required for markdown support!"
|
33
22
|
end
|
data/lib/jekyll/albino.rb
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
require 'open4'
|
45
45
|
|
46
46
|
class Albino
|
47
|
-
@@bin =
|
47
|
+
@@bin = '/usr/local/bin/pygmentize'
|
48
48
|
|
49
49
|
def self.bin=(path)
|
50
50
|
@@bin = path
|
@@ -54,7 +54,7 @@ class Albino
|
|
54
54
|
new(*args).colorize
|
55
55
|
end
|
56
56
|
|
57
|
-
def initialize(target, lexer = :text, format = :html)
|
57
|
+
def initialize(target, lexer = :text, format = :html )
|
58
58
|
@target = File.exists?(target) ? File.read(target) : target rescue target
|
59
59
|
@options = { :l => lexer, :f => format }
|
60
60
|
end
|
@@ -64,7 +64,13 @@ class Albino
|
|
64
64
|
Open4.popen4(command) do |pid, stdin, stdout, stderr|
|
65
65
|
stdin.puts @target
|
66
66
|
stdin.close
|
67
|
+
|
67
68
|
output = stdout.read.strip
|
69
|
+
|
70
|
+
# puts "pid : #{ pid }"
|
71
|
+
# puts "stdout : #{ stdout.read.strip }"
|
72
|
+
# puts "stderr : #{ stderr.read.strip }"
|
73
|
+
|
68
74
|
end
|
69
75
|
|
70
76
|
# rdiscount wants the closing pre on a line by itself
|
data/lib/jekyll/filters.rb
CHANGED
data/lib/jekyll/page.rb
CHANGED
data/lib/jekyll/post.rb
CHANGED
@@ -20,7 +20,7 @@ module Jekyll
|
|
20
20
|
|
21
21
|
attr_accessor :date, :slug, :ext, :categories, :topics, :published
|
22
22
|
attr_accessor :data, :content, :output
|
23
|
-
attr_accessor :previous, :next
|
23
|
+
attr_accessor :previous, :next, :numericid, :archivedate
|
24
24
|
|
25
25
|
# Initialize this Post instance.
|
26
26
|
# +base+ is the String path to the dir containing the post file
|
@@ -31,7 +31,9 @@ module Jekyll
|
|
31
31
|
def initialize(source, dir, name)
|
32
32
|
@base = File.join(source, dir, '_posts')
|
33
33
|
@name = name
|
34
|
-
|
34
|
+
|
35
|
+
self.numericid = 0
|
36
|
+
|
35
37
|
self.categories = dir.split('/').reject { |x| x.empty? }
|
36
38
|
|
37
39
|
parts = name.split('/')
|
@@ -46,36 +48,32 @@ module Jekyll
|
|
46
48
|
self.published = true
|
47
49
|
end
|
48
50
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
self.topics = []
|
59
|
-
end
|
51
|
+
if self.data.has_key?('topic')
|
52
|
+
self.topics << self.data['topic']
|
53
|
+
elsif self.data.has_key?('topics')
|
54
|
+
if self.data['topics'].kind_of? Array
|
55
|
+
self.topics = self.data['topics']
|
56
|
+
elsif self.data['topics'].kind_of? String
|
57
|
+
self.topics = self.data['topics'].split
|
58
|
+
else
|
59
|
+
self.topics = []
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
else
|
75
|
-
self.categories = []
|
76
|
-
end
|
62
|
+
|
63
|
+
if self.data.has_key?('category')
|
64
|
+
self.categories << self.data['category']
|
65
|
+
elsif self.data.has_key?('categories')
|
66
|
+
# Look for categories in the YAML-header, either specified as
|
67
|
+
# an array or a string.
|
68
|
+
if self.data['categories'].kind_of? Array
|
69
|
+
self.categories = self.data['categories']
|
70
|
+
elsif self.data['categories'].kind_of? String
|
71
|
+
self.categories = self.data['categories'].split
|
72
|
+
else
|
73
|
+
self.categories = []
|
77
74
|
end
|
78
75
|
end
|
76
|
+
|
79
77
|
end
|
80
78
|
|
81
79
|
# Spaceship is based on Post#date
|
@@ -92,6 +90,7 @@ module Jekyll
|
|
92
90
|
def process(name)
|
93
91
|
m, cats, date, slug, ext = *name.match(MATCHER)
|
94
92
|
self.date = Time.parse(date)
|
93
|
+
self.archivedate = self.date.month.to_s + "-" + self.date.year.to_s
|
95
94
|
self.slug = slug
|
96
95
|
self.ext = ext
|
97
96
|
end
|
@@ -216,8 +215,11 @@ module Jekyll
|
|
216
215
|
def to_liquid
|
217
216
|
{ "title" => self.data["title"] || self.slug.split('-').select {|w| w.capitalize! || w }.join(' '),
|
218
217
|
"url" => self.url,
|
218
|
+
"topleveldir" => self.url.split("/")[1],
|
219
219
|
"date" => self.date,
|
220
|
+
"archivedate" => self.archivedate,
|
220
221
|
"id" => self.id,
|
222
|
+
"numericid" => self.numericid,
|
221
223
|
"topics" => self.topics,
|
222
224
|
"folded" => (self.content.match("<hr") ? true : false),
|
223
225
|
"content" => self.content,
|
data/lib/jekyll/site.rb
CHANGED
@@ -101,7 +101,8 @@ module Jekyll
|
|
101
101
|
|
102
102
|
# second pass renders each post now that full site payload is available
|
103
103
|
self.posts.each_with_index do |post, idx|
|
104
|
-
post.
|
104
|
+
post.numericid = idx+1
|
105
|
+
post.previous = posts[idx - 1] unless idx - 1 < 0
|
105
106
|
post.next = posts[idx + 1] unless idx + 1 >= posts.size
|
106
107
|
post.render(self.layouts, site_payload)
|
107
108
|
end
|
@@ -188,18 +189,21 @@ module Jekyll
|
|
188
189
|
# "topics" => [<Post>] }}
|
189
190
|
def site_payload
|
190
191
|
all_posts = self.posts.sort { |a,b| b <=> a }
|
191
|
-
|
192
|
+
latest_post = all_posts[0]
|
193
|
+
recent_posts = all_posts[1..2]
|
192
194
|
older_posts = all_posts[3..7]
|
193
195
|
rss_posts = all_posts[0..25]
|
194
196
|
|
195
197
|
{"site" => self.settings.merge({
|
196
198
|
"time" => Time.now,
|
197
199
|
"posts" => all_posts,
|
198
|
-
"
|
200
|
+
"latest_post" => latest_post,
|
201
|
+
"recent_posts" => recent_posts,
|
199
202
|
"older_posts" => older_posts,
|
200
203
|
"rss_posts" => rss_posts,
|
201
204
|
"categories" => post_attr_hash('categories'),
|
202
|
-
"topics" => post_attr_hash('topics')
|
205
|
+
"topics" => post_attr_hash('topics'),
|
206
|
+
"archives" => post_attr_hash('archivedate')
|
203
207
|
})}
|
204
208
|
end
|
205
209
|
|
@@ -11,9 +11,9 @@ module Jekyll
|
|
11
11
|
@lang = $1
|
12
12
|
if defined? $2
|
13
13
|
# additional options to pass to Albino.
|
14
|
-
@options = { 'O' => 'linenos=
|
14
|
+
@options = { 'O' => 'linenos=table,encoding=utf8,style=native' }
|
15
15
|
else
|
16
|
-
@options = {}
|
16
|
+
@options = { 'O' => 'encoding=utf8,style=native' }
|
17
17
|
end
|
18
18
|
else
|
19
19
|
raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight <lang> [linenos]")
|
@@ -32,7 +32,8 @@ module Jekyll
|
|
32
32
|
if Jekyll.content_type == :markdown
|
33
33
|
return "\n" + Albino.new(code, @lang).to_s(@options) + "\n"
|
34
34
|
else
|
35
|
-
"<notextile
|
35
|
+
content = "\n<notextile>\n" + Albino.new(code, @lang).to_s(@options) + "\n</notextile>\n"
|
36
|
+
content
|
36
37
|
end
|
37
38
|
end
|
38
39
|
|