jsjohnst-jekyll 0.4.1.999.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +106 -0
- data/README.textile +555 -0
- data/VERSION.yml +4 -0
- data/bin/jekyll +146 -0
- data/lib/jekyll.rb +81 -0
- data/lib/jekyll/albino.rb +121 -0
- data/lib/jekyll/converters/csv.rb +26 -0
- data/lib/jekyll/converters/mephisto.rb +79 -0
- data/lib/jekyll/converters/mt.rb +59 -0
- data/lib/jekyll/converters/rss.rb +44 -0
- data/lib/jekyll/converters/textpattern.rb +50 -0
- data/lib/jekyll/converters/typo.rb +49 -0
- data/lib/jekyll/converters/wordpress.rb +55 -0
- data/lib/jekyll/convertible.rb +71 -0
- data/lib/jekyll/core_ext.rb +22 -0
- data/lib/jekyll/filters.rb +87 -0
- data/lib/jekyll/layout.rb +47 -0
- data/lib/jekyll/page.rb +64 -0
- data/lib/jekyll/post.rb +232 -0
- data/lib/jekyll/site.rb +221 -0
- data/lib/jekyll/tags/highlight.rb +53 -0
- data/lib/jekyll/tags/include.rb +49 -0
- data/lib/jekyll/tasks.rb +68 -0
- data/test/helper.rb +14 -0
- data/test/source/_includes/sig.markdown +3 -0
- data/test/source/_layouts/default.html +27 -0
- data/test/source/_layouts/simple.html +1 -0
- data/test/source/_posts/2008-02-02-not-published.textile +8 -0
- data/test/source/_posts/2008-02-02-published.textile +8 -0
- data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
- data/test/source/_posts/2008-11-21-complex.textile +8 -0
- data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
- data/test/source/_posts/2008-12-13-include.markdown +8 -0
- data/test/source/_posts/2009-01-27-categories.textile +7 -0
- data/test/source/_posts/2009-01-27-category.textile +7 -0
- data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
- data/test/source/category_test.html +13 -0
- data/test/source/css/screen.css +76 -0
- data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
- data/test/source/index.html +22 -0
- data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
- data/test/suite.rb +9 -0
- data/test/test_filters.rb +49 -0
- data/test/test_generated_site.rb +37 -0
- data/test/test_jekyll.rb +0 -0
- data/test/test_post.rb +174 -0
- data/test/test_site.rb +51 -0
- data/test/test_tags.rb +52 -0
- metadata +186 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
module Jekyll
|
2
|
+
|
3
|
+
class HighlightBlock < Liquid::Block
|
4
|
+
include Liquid::StandardFilters
|
5
|
+
# we need a language, but the linenos argument is optional.
|
6
|
+
SYNTAX = /(\w+)\s?(:?linenos)?\s?/
|
7
|
+
|
8
|
+
def initialize(tag_name, markup, tokens)
|
9
|
+
super
|
10
|
+
if markup =~ SYNTAX
|
11
|
+
@lang = $1
|
12
|
+
if defined? $2
|
13
|
+
# additional options to pass to Albino.
|
14
|
+
@options = { 'O' => 'linenos=inline' }
|
15
|
+
else
|
16
|
+
@options = {}
|
17
|
+
end
|
18
|
+
else
|
19
|
+
raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight <lang> [linenos]")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def render(context)
|
24
|
+
if Jekyll.pygments
|
25
|
+
render_pygments(context, super.to_s)
|
26
|
+
else
|
27
|
+
render_codehighlighter(context, super.to_s)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def render_pygments(context, code)
|
32
|
+
if Jekyll.content_type == :markdown
|
33
|
+
return "\n" + Albino.new(code, @lang).to_s(@options) + "\n"
|
34
|
+
else
|
35
|
+
"<notextile>" + Albino.new(code, @lang).to_s(@options) + "</notextile>"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def render_codehighlighter(context, code)
|
40
|
+
#The div is required because RDiscount blows ass
|
41
|
+
<<-HTML
|
42
|
+
<div>
|
43
|
+
<pre>
|
44
|
+
<code class='#{@lang}'>#{h(code).strip}</code>
|
45
|
+
</pre>
|
46
|
+
</div>
|
47
|
+
HTML
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
Liquid::Template.register_tag('highlight', Jekyll::HighlightBlock)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Jekyll
|
2
|
+
|
3
|
+
class IncludeTag < Liquid::Tag
|
4
|
+
Syntax = /from\s+(#{Liquid::VariableSignature}+)/
|
5
|
+
|
6
|
+
def initialize(tag_name, markup, tokens)
|
7
|
+
super
|
8
|
+
if markup =~ Syntax
|
9
|
+
@variable = $1
|
10
|
+
@use_context = 1
|
11
|
+
else
|
12
|
+
@file = markup.strip
|
13
|
+
@use_context = 0
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def render(context)
|
18
|
+
if @use_context == 1
|
19
|
+
@file = context[@variable]
|
20
|
+
end
|
21
|
+
|
22
|
+
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
|
23
|
+
return "Include file '#{@file}' contains invalid characters or sequences"
|
24
|
+
end
|
25
|
+
|
26
|
+
if Jekyll.site && Jekyll.site.options
|
27
|
+
path = Jekyll.site.options['include_path']
|
28
|
+
else
|
29
|
+
path = File.join(Jekyll.source, '_includes')
|
30
|
+
end
|
31
|
+
|
32
|
+
Dir.chdir(path) do
|
33
|
+
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
34
|
+
if choices.include?(@file)
|
35
|
+
source = File.read(@file)
|
36
|
+
partial = Liquid::Template.parse(source)
|
37
|
+
context.stack do
|
38
|
+
partial.render(context, [Jekyll::Filters])
|
39
|
+
end
|
40
|
+
else
|
41
|
+
"Included file '#{@file}' not found in _includes directory"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
Liquid::Template.register_tag('include', Jekyll::IncludeTag)
|
data/lib/jekyll/tasks.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
require 'jekyll'
|
4
|
+
|
5
|
+
module Jekyll
|
6
|
+
# Rake tasks for generating a Jekyll site and running the server.
|
7
|
+
#
|
8
|
+
# The attributes correspond to the command line options the jekyll command accepts.
|
9
|
+
#
|
10
|
+
# An example Rakefile would look like:
|
11
|
+
#
|
12
|
+
# require 'rake'
|
13
|
+
# require 'jekyll/tasks'
|
14
|
+
#
|
15
|
+
# Jekyll::Tasks.new do |jekyll|
|
16
|
+
# jekyll.rdiscount = true
|
17
|
+
# jekyll.pygments = true
|
18
|
+
# end
|
19
|
+
class Tasks < ::Rake::TaskLib
|
20
|
+
attr_accessor :source, :destination, :lsi, :pygments, :rdiscount, :permalink, :server, :server_port
|
21
|
+
def initialize
|
22
|
+
yield self if block_given?
|
23
|
+
|
24
|
+
@source ||= '.'
|
25
|
+
@destination ||= File.join('.', '_site')
|
26
|
+
|
27
|
+
define_task
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def define_task
|
33
|
+
desc 'Generate Jekyll site'
|
34
|
+
task :jekyll do
|
35
|
+
ruby(arguments_for_ruby_execution.join(" "))
|
36
|
+
end
|
37
|
+
|
38
|
+
namespace :jekyll do
|
39
|
+
desc 'Run Jekyll server'
|
40
|
+
task :server do
|
41
|
+
ruby(arguments_for_ruby_execution_with_server.join(" "))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def arguments_for_ruby_execution
|
47
|
+
args = [Jekyll::BINARY]
|
48
|
+
args << "--lsi" if self.lsi
|
49
|
+
args << "--pygments" if self.pygments
|
50
|
+
args << "--rdiscount" if self.rdiscount
|
51
|
+
if permalink
|
52
|
+
args << "--permalink" << permalink
|
53
|
+
end
|
54
|
+
|
55
|
+
args << source << destination
|
56
|
+
|
57
|
+
args
|
58
|
+
end
|
59
|
+
|
60
|
+
def arguments_for_ruby_execution_with_server
|
61
|
+
args = arguments_for_ruby_execution
|
62
|
+
args << "--server"
|
63
|
+
args << server_port if server_port
|
64
|
+
args << "--auto"
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require 'redgreen'
|
5
|
+
|
6
|
+
include Jekyll
|
7
|
+
|
8
|
+
def dest_dir
|
9
|
+
File.join(File.dirname(__FILE__), *%w[dest])
|
10
|
+
end
|
11
|
+
|
12
|
+
def clear_dest
|
13
|
+
FileUtils.rm_rf(dest_dir)
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
7
|
+
<title>{{ page.title }}</title>
|
8
|
+
<meta name="author" content="<%= @page.author %>" />
|
9
|
+
|
10
|
+
<!-- CodeRay syntax highlighting CSS -->
|
11
|
+
<link rel="stylesheet" href="/css/coderay.css" type="text/css" />
|
12
|
+
|
13
|
+
<!-- Homepage CSS -->
|
14
|
+
<link rel="stylesheet" href="/css/screen.css" type="text/css" media="screen, projection" />
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
|
18
|
+
<div class="site">
|
19
|
+
<div class="title">
|
20
|
+
Tom Preston-Werner
|
21
|
+
</div>
|
22
|
+
|
23
|
+
{{ content }}
|
24
|
+
</div>
|
25
|
+
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<<< {{ content }} >>>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Tom Preston-Werner
|
4
|
+
---
|
5
|
+
|
6
|
+
{% assign category_post = site.categories.foo.first %}
|
7
|
+
<div id="category_post">
|
8
|
+
<h1>{{ category_post.title }}</h1>
|
9
|
+
<div>
|
10
|
+
{{ category_post.content }}
|
11
|
+
</div>
|
12
|
+
<div>{{ category_post.categories }}</div>
|
13
|
+
</div>
|
@@ -0,0 +1,76 @@
|
|
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
|
+
/* Site
|
57
|
+
/*
|
58
|
+
/*****************************************************************************/
|
59
|
+
|
60
|
+
.site {
|
61
|
+
font-size: 110%;
|
62
|
+
text-align: justify;
|
63
|
+
width: 40em;
|
64
|
+
margin: 3em auto 2em auto;
|
65
|
+
line-height: 1.5em;
|
66
|
+
}
|
67
|
+
|
68
|
+
.title {
|
69
|
+
color: #a00;
|
70
|
+
font-weight: bold;
|
71
|
+
margin-bottom: 2em;
|
72
|
+
}
|
73
|
+
|
74
|
+
.site .meta {
|
75
|
+
color: #aaa;
|
76
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Tom Preston-Werner
|
4
|
+
---
|
5
|
+
|
6
|
+
h1. Welcome to my site
|
7
|
+
|
8
|
+
h2. Please read our {{ site.posts | size }} Posts
|
9
|
+
|
10
|
+
<ul>
|
11
|
+
{% for post in site.posts %}
|
12
|
+
<li>{{ post.date }} <a href="{{ post.url }}">{{ post.title }}</a></li>
|
13
|
+
{% endfor %}
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
{% assign first_post = site.posts.first %}
|
17
|
+
<div id="first_post">
|
18
|
+
<h1>{{ first_post.title }}</h1>
|
19
|
+
<div>
|
20
|
+
{{ first_post.content }}
|
21
|
+
</div>
|
22
|
+
</div>
|