realityforge-jekyll 0.7.1-java
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/History.txt +255 -0
- data/LICENSE +21 -0
- data/README.textile +41 -0
- data/Rakefile +159 -0
- data/bin/jekyll +178 -0
- data/cucumber.yml +1 -0
- data/features/create_sites.feature +94 -0
- data/features/embed_filters.feature +60 -0
- data/features/markdown.feature +30 -0
- data/features/pagination.feature +27 -0
- data/features/permalinks.feature +65 -0
- data/features/post_data.feature +153 -0
- data/features/site_configuration.feature +103 -0
- data/features/site_data.feature +82 -0
- data/features/step_definitions/jekyll_steps.rb +145 -0
- data/features/support/env.rb +16 -0
- data/jekyll.gemspec +135 -0
- data/lib/jekyll.rb +109 -0
- data/lib/jekyll/albino.rb +120 -0
- data/lib/jekyll/converter.rb +50 -0
- data/lib/jekyll/converters/identity.rb +22 -0
- data/lib/jekyll/converters/markdown.rb +80 -0
- data/lib/jekyll/converters/textile.rb +33 -0
- data/lib/jekyll/convertible.rb +82 -0
- data/lib/jekyll/core_ext.rb +52 -0
- data/lib/jekyll/errors.rb +6 -0
- data/lib/jekyll/filters.rb +47 -0
- data/lib/jekyll/generator.rb +7 -0
- data/lib/jekyll/generators/pagination.rb +87 -0
- data/lib/jekyll/layout.rb +36 -0
- data/lib/jekyll/migrators/csv.rb +26 -0
- data/lib/jekyll/migrators/mephisto.rb +79 -0
- data/lib/jekyll/migrators/mt.rb +59 -0
- data/lib/jekyll/migrators/textpattern.rb +50 -0
- data/lib/jekyll/migrators/typo.rb +49 -0
- data/lib/jekyll/migrators/wordpress.rb +55 -0
- data/lib/jekyll/page.rb +133 -0
- data/lib/jekyll/plugin.rb +76 -0
- data/lib/jekyll/post.rb +242 -0
- data/lib/jekyll/site.rb +235 -0
- data/lib/jekyll/static_file.rb +76 -0
- data/lib/jekyll/tags/highlight.rb +73 -0
- data/lib/jekyll/tags/include.rb +31 -0
- data/test/helper.rb +33 -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-01-27-empty-categories.textile +7 -0
- data/test/source/_posts/2009-01-27-empty-category.textile +7 -0
- data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
- data/test/source/_posts/2009-05-18-empty-tag.textile +6 -0
- data/test/source/_posts/2009-05-18-empty-tags.textile +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/_posts/2010-01-08-triple-dash.markdown +5 -0
- data/test/source/_posts/2010-01-09-date-override.textile +7 -0
- data/test/source/_posts/2010-01-09-time-override.textile +7 -0
- data/test/source/_posts/2010-01-09-timezone-override.textile +7 -0
- data/test/source/_posts/2010-01-16-override-data.textile +4 -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 +32 -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_core_ext.rb +66 -0
- data/test/test_filters.rb +49 -0
- data/test/test_generated_site.rb +44 -0
- data/test/test_page.rb +98 -0
- data/test/test_pager.rb +113 -0
- data/test/test_post.rb +396 -0
- data/test/test_rdiscount.rb +18 -0
- data/test/test_site.rb +153 -0
- data/test/test_tags.rb +116 -0
- metadata +282 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module Jekyll
|
|
2
|
+
|
|
3
|
+
class StaticFile
|
|
4
|
+
@@mtimes = Hash.new # the cache of last modification times [path] -> mtime
|
|
5
|
+
|
|
6
|
+
# Initialize a new StaticFile.
|
|
7
|
+
# +site+ is the Site
|
|
8
|
+
# +base+ is the String path to the <source>
|
|
9
|
+
# +dir+ is the String path between <source> and the file
|
|
10
|
+
# +name+ is the String filename of the file
|
|
11
|
+
#
|
|
12
|
+
# Returns <StaticFile>
|
|
13
|
+
def initialize(site, base, dir, name)
|
|
14
|
+
@site = site
|
|
15
|
+
@base = base
|
|
16
|
+
@dir = dir
|
|
17
|
+
@name = name
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Obtains source file path.
|
|
21
|
+
#
|
|
22
|
+
# Returns source file path.
|
|
23
|
+
def path
|
|
24
|
+
File.join(@base, @dir, @name)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Obtain destination path.
|
|
28
|
+
# +dest+ is the String path to the destination dir
|
|
29
|
+
#
|
|
30
|
+
# Returns destination file path.
|
|
31
|
+
def destination(dest)
|
|
32
|
+
File.join(dest, @dir, @name)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Obtain mtime of the source path.
|
|
36
|
+
#
|
|
37
|
+
# Returns last modifiaction time for this file.
|
|
38
|
+
def mtime
|
|
39
|
+
File.stat(path).mtime.to_i
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Is source path modified?
|
|
43
|
+
#
|
|
44
|
+
# Returns true if modified since last write.
|
|
45
|
+
def modified?
|
|
46
|
+
@@mtimes[path] != mtime
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Write the static file to the destination directory (if modified).
|
|
50
|
+
# +dest+ is the String path to the destination dir
|
|
51
|
+
#
|
|
52
|
+
# Returns false if the file was not modified since last time (no-op).
|
|
53
|
+
def write(dest)
|
|
54
|
+
dest_path = destination(dest)
|
|
55
|
+
dest_dir = File.join(dest, @dir)
|
|
56
|
+
|
|
57
|
+
return false if File.exist? dest_path and !modified?
|
|
58
|
+
@@mtimes[path] = mtime
|
|
59
|
+
|
|
60
|
+
FileUtils.mkdir_p(dest_dir)
|
|
61
|
+
FileUtils.cp(path, dest_path)
|
|
62
|
+
|
|
63
|
+
true
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Reset the mtimes cache (for testing purposes).
|
|
67
|
+
#
|
|
68
|
+
# Returns nothing.
|
|
69
|
+
def self.reset_cache
|
|
70
|
+
@@mtimes = Hash.new
|
|
71
|
+
|
|
72
|
+
nil
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
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?([\w\s=]+)*/
|
|
8
|
+
|
|
9
|
+
def initialize(tag_name, markup, tokens)
|
|
10
|
+
super
|
|
11
|
+
if markup =~ SYNTAX
|
|
12
|
+
@lang = $1
|
|
13
|
+
if defined? $2
|
|
14
|
+
tmp_options = {}
|
|
15
|
+
$2.split.each do |opt|
|
|
16
|
+
key, value = opt.split('=')
|
|
17
|
+
if value.nil?
|
|
18
|
+
if key == 'linenos'
|
|
19
|
+
value = 'inline'
|
|
20
|
+
else
|
|
21
|
+
value = true
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
tmp_options[key] = value
|
|
25
|
+
end
|
|
26
|
+
tmp_options = tmp_options.to_a.collect { |opt| opt.join('=') }
|
|
27
|
+
# additional options to pass to Albino.
|
|
28
|
+
@options = { 'O' => tmp_options.join(',') }
|
|
29
|
+
else
|
|
30
|
+
@options = {}
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight <lang> [linenos]")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def render(context)
|
|
38
|
+
if context.registers[:site].pygments
|
|
39
|
+
render_pygments(context, super.join)
|
|
40
|
+
else
|
|
41
|
+
render_codehighlighter(context, super.join)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def render_pygments(context, code)
|
|
46
|
+
output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang)
|
|
47
|
+
output = context["pygments_prefix"] + output if context["pygments_prefix"]
|
|
48
|
+
output = output + context["pygments_suffix"] if context["pygments_suffix"]
|
|
49
|
+
output
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def render_codehighlighter(context, code)
|
|
53
|
+
#The div is required because RDiscount blows ass
|
|
54
|
+
<<-HTML
|
|
55
|
+
<div>
|
|
56
|
+
<pre>
|
|
57
|
+
<code class='#{@lang}'>#{h(code).strip}</code>
|
|
58
|
+
</pre>
|
|
59
|
+
</div>
|
|
60
|
+
HTML
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def add_code_tags(code, lang)
|
|
64
|
+
# Add nested <code> tags to code blocks
|
|
65
|
+
code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
|
|
66
|
+
code = code.sub(/<\/pre>/,"</code></pre>")
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
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,33 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
gem 'RedCloth', '>= 4.2.1'
|
|
3
|
+
|
|
4
|
+
require File.join(File.dirname(__FILE__), *%w[.. lib jekyll])
|
|
5
|
+
|
|
6
|
+
require 'RedCloth'
|
|
7
|
+
require 'rdiscount'
|
|
8
|
+
|
|
9
|
+
require 'test/unit'
|
|
10
|
+
require 'redgreen'
|
|
11
|
+
require 'shoulda'
|
|
12
|
+
require 'rr'
|
|
13
|
+
|
|
14
|
+
include Jekyll
|
|
15
|
+
|
|
16
|
+
# Send STDERR into the void to suppress program output messages
|
|
17
|
+
STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:')
|
|
18
|
+
|
|
19
|
+
class Test::Unit::TestCase
|
|
20
|
+
include RR::Adapters::TestUnit
|
|
21
|
+
|
|
22
|
+
def dest_dir(*subdirs)
|
|
23
|
+
File.join(File.dirname(__FILE__), 'dest', *subdirs)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def source_dir(*subdirs)
|
|
27
|
+
File.join(File.dirname(__FILE__), 'source', *subdirs)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def clear_dest
|
|
31
|
+
FileUtils.rm_rf(dest_dir)
|
|
32
|
+
end
|
|
33
|
+
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.
|