tsion-jekyll 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/History.txt +151 -0
- data/README.textile +42 -0
- data/Rakefile +92 -0
- data/VERSION.yml +5 -0
- data/bin/jekyll +150 -0
- data/features/create_sites.feature +46 -0
- data/features/embed_filters.feature +60 -0
- data/features/pagination.feature +40 -0
- data/features/permalinks.feature +65 -0
- data/features/post_data.feature +153 -0
- data/features/site_configuration.feature +63 -0
- data/features/site_data.feature +82 -0
- data/features/step_definitions/jekyll_steps.rb +136 -0
- data/features/support/env.rb +16 -0
- data/lib/jekyll.rb +85 -0
- data/lib/jekyll/albino.rb +122 -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/textpattern.rb +50 -0
- data/lib/jekyll/converters/typo.rb +49 -0
- data/lib/jekyll/converters/wordpress.rb +54 -0
- data/lib/jekyll/convertible.rb +84 -0
- data/lib/jekyll/core_ext.rb +30 -0
- data/lib/jekyll/filters.rb +47 -0
- data/lib/jekyll/layout.rb +36 -0
- data/lib/jekyll/page.rb +112 -0
- data/lib/jekyll/pager.rb +45 -0
- data/lib/jekyll/post.rb +251 -0
- data/lib/jekyll/site.rb +265 -0
- data/lib/jekyll/tags/highlight.rb +56 -0
- data/lib/jekyll/tags/include.rb +31 -0
- data/test/helper.rb +27 -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-array-categories.textile +10 -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/_posts/2009-03-12-hash-#1.markdown +6 -0
- data/test/source/_posts/2009-05-18-tag.textile +6 -0
- data/test/source/_posts/2009-05-18-tags.textile +9 -0
- data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
- data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
- data/test/source/about.html +6 -0
- data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
- data/test/source/contacts.html +5 -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/sitemap.xml +23 -0
- data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
- data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
- data/test/suite.rb +9 -0
- data/test/test_configuration.rb +29 -0
- data/test/test_filters.rb +49 -0
- data/test/test_generated_site.rb +40 -0
- data/test/test_page.rb +98 -0
- data/test/test_pager.rb +47 -0
- data/test/test_post.rb +302 -0
- data/test/test_site.rb +85 -0
- data/test/test_tags.rb +116 -0
- data/tsion-jekyll.gemspec +138 -0
- metadata +193 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
module Jekyll
|
2
|
+
|
3
|
+
class HighlightBlock < Liquid::Block
|
4
|
+
include Liquid::StandardFilters
|
5
|
+
|
6
|
+
# we need a language, but the linenos argument is optional.
|
7
|
+
SYNTAX = /(\w+)\s?(:?linenos)?\s?/
|
8
|
+
|
9
|
+
def initialize(tag_name, markup, tokens)
|
10
|
+
super
|
11
|
+
if markup =~ SYNTAX
|
12
|
+
@lang = $1
|
13
|
+
if defined? $2
|
14
|
+
# additional options to pass to Albino.
|
15
|
+
@options = { 'O' => 'linenos=table' }
|
16
|
+
else
|
17
|
+
@options = {}
|
18
|
+
end
|
19
|
+
else
|
20
|
+
raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight <lang> [linenos]")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def render(context)
|
25
|
+
if context.registers[:site].pygments
|
26
|
+
render_pygments(context, super.join)
|
27
|
+
else
|
28
|
+
render_codehighlighter(context, super.join)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def render_pygments(context, code)
|
33
|
+
if context["content_type"] == "markdown"
|
34
|
+
return "\n" + Albino.new(code, @lang).to_s(@options) + "\n"
|
35
|
+
elsif context["content_type"] == "textile"
|
36
|
+
return "<notextile>" + Albino.new(code, @lang).to_s(@options) + "</notextile>"
|
37
|
+
else
|
38
|
+
return Albino.new(code, @lang).to_s(@options)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def render_codehighlighter(context, code)
|
43
|
+
#The div is required because RDiscount blows ass
|
44
|
+
<<-HTML
|
45
|
+
<div>
|
46
|
+
<pre>
|
47
|
+
<code class='#{@lang}'>#{h(code).strip}</code>
|
48
|
+
</pre>
|
49
|
+
</div>
|
50
|
+
HTML
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
Liquid::Template.register_tag('highlight', Jekyll::HighlightBlock)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Jekyll
|
2
|
+
|
3
|
+
class IncludeTag < Liquid::Tag
|
4
|
+
def initialize(tag_name, file, tokens)
|
5
|
+
super
|
6
|
+
@file = file.strip
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
|
11
|
+
return "Include file '#{@file}' contains invalid characters or sequences"
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir.chdir(File.join(context.registers[:site].source, '_includes')) do
|
15
|
+
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
16
|
+
if choices.include?(@file)
|
17
|
+
source = File.read(@file)
|
18
|
+
partial = Liquid::Template.parse(source)
|
19
|
+
context.stack do
|
20
|
+
partial.render(context)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
"Included file '#{@file}' not found in _includes directory"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
Liquid::Template.register_tag('include', Jekyll::IncludeTag)
|
data/test/helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'RedCloth', '= 4.2.1'
|
3
|
+
|
4
|
+
require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'redgreen'
|
8
|
+
require 'shoulda'
|
9
|
+
require 'rr'
|
10
|
+
|
11
|
+
include Jekyll
|
12
|
+
|
13
|
+
class Test::Unit::TestCase
|
14
|
+
include RR::Adapters::TestUnit
|
15
|
+
|
16
|
+
def dest_dir(*subdirs)
|
17
|
+
File.join(File.dirname(__FILE__), 'dest', *subdirs)
|
18
|
+
end
|
19
|
+
|
20
|
+
def source_dir(*subdirs)
|
21
|
+
File.join(File.dirname(__FILE__), 'source', *subdirs)
|
22
|
+
end
|
23
|
+
|
24
|
+
def clear_dest
|
25
|
+
FileUtils.rm_rf(dest_dir)
|
26
|
+
end
|
27
|
+
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 @@
|
|
1
|
+
No YAML.
|
@@ -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>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
layout: nil
|
3
|
+
---
|
4
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
5
|
+
<urlset
|
6
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
7
|
+
|
8
|
+
<url>
|
9
|
+
<loc>http://example.com</loc>
|
10
|
+
<lastmod>{{ site.time | date_to_xmlschema }}</lastmod>
|
11
|
+
<changefreq>daily</changefreq>
|
12
|
+
<priority>1.0</priority>
|
13
|
+
</url>
|
14
|
+
|
15
|
+
{% for post in site.posts %}
|
16
|
+
<url>
|
17
|
+
<loc>http://example.com/{{ post.url }}/</loc>
|
18
|
+
<lastmod>{{ site.time }}</lastmod>
|
19
|
+
<changefreq>monthly</changefreq>
|
20
|
+
<priority>0.2</priority>
|
21
|
+
</url>
|
22
|
+
{% endfor %}
|
23
|
+
</urlset>
|