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.
Files changed (91) hide show
  1. data/History.txt +255 -0
  2. data/LICENSE +21 -0
  3. data/README.textile +41 -0
  4. data/Rakefile +159 -0
  5. data/bin/jekyll +178 -0
  6. data/cucumber.yml +1 -0
  7. data/features/create_sites.feature +94 -0
  8. data/features/embed_filters.feature +60 -0
  9. data/features/markdown.feature +30 -0
  10. data/features/pagination.feature +27 -0
  11. data/features/permalinks.feature +65 -0
  12. data/features/post_data.feature +153 -0
  13. data/features/site_configuration.feature +103 -0
  14. data/features/site_data.feature +82 -0
  15. data/features/step_definitions/jekyll_steps.rb +145 -0
  16. data/features/support/env.rb +16 -0
  17. data/jekyll.gemspec +135 -0
  18. data/lib/jekyll.rb +109 -0
  19. data/lib/jekyll/albino.rb +120 -0
  20. data/lib/jekyll/converter.rb +50 -0
  21. data/lib/jekyll/converters/identity.rb +22 -0
  22. data/lib/jekyll/converters/markdown.rb +80 -0
  23. data/lib/jekyll/converters/textile.rb +33 -0
  24. data/lib/jekyll/convertible.rb +82 -0
  25. data/lib/jekyll/core_ext.rb +52 -0
  26. data/lib/jekyll/errors.rb +6 -0
  27. data/lib/jekyll/filters.rb +47 -0
  28. data/lib/jekyll/generator.rb +7 -0
  29. data/lib/jekyll/generators/pagination.rb +87 -0
  30. data/lib/jekyll/layout.rb +36 -0
  31. data/lib/jekyll/migrators/csv.rb +26 -0
  32. data/lib/jekyll/migrators/mephisto.rb +79 -0
  33. data/lib/jekyll/migrators/mt.rb +59 -0
  34. data/lib/jekyll/migrators/textpattern.rb +50 -0
  35. data/lib/jekyll/migrators/typo.rb +49 -0
  36. data/lib/jekyll/migrators/wordpress.rb +55 -0
  37. data/lib/jekyll/page.rb +133 -0
  38. data/lib/jekyll/plugin.rb +76 -0
  39. data/lib/jekyll/post.rb +242 -0
  40. data/lib/jekyll/site.rb +235 -0
  41. data/lib/jekyll/static_file.rb +76 -0
  42. data/lib/jekyll/tags/highlight.rb +73 -0
  43. data/lib/jekyll/tags/include.rb +31 -0
  44. data/test/helper.rb +33 -0
  45. data/test/source/_includes/sig.markdown +3 -0
  46. data/test/source/_layouts/default.html +27 -0
  47. data/test/source/_layouts/simple.html +1 -0
  48. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  49. data/test/source/_posts/2008-02-02-published.textile +8 -0
  50. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  51. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  52. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  53. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  54. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  55. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  56. data/test/source/_posts/2009-01-27-category.textile +7 -0
  57. data/test/source/_posts/2009-01-27-empty-categories.textile +7 -0
  58. data/test/source/_posts/2009-01-27-empty-category.textile +7 -0
  59. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  60. data/test/source/_posts/2009-05-18-empty-tag.textile +6 -0
  61. data/test/source/_posts/2009-05-18-empty-tags.textile +6 -0
  62. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  63. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  64. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  65. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  66. data/test/source/_posts/2010-01-08-triple-dash.markdown +5 -0
  67. data/test/source/_posts/2010-01-09-date-override.textile +7 -0
  68. data/test/source/_posts/2010-01-09-time-override.textile +7 -0
  69. data/test/source/_posts/2010-01-09-timezone-override.textile +7 -0
  70. data/test/source/_posts/2010-01-16-override-data.textile +4 -0
  71. data/test/source/about.html +6 -0
  72. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  73. data/test/source/contacts.html +5 -0
  74. data/test/source/css/screen.css +76 -0
  75. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  76. data/test/source/index.html +22 -0
  77. data/test/source/sitemap.xml +32 -0
  78. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  79. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  80. data/test/suite.rb +9 -0
  81. data/test/test_configuration.rb +29 -0
  82. data/test/test_core_ext.rb +66 -0
  83. data/test/test_filters.rb +49 -0
  84. data/test/test_generated_site.rb +44 -0
  85. data/test/test_page.rb +98 -0
  86. data/test/test_pager.rb +113 -0
  87. data/test/test_post.rb +396 -0
  88. data/test/test_rdiscount.rb +18 -0
  89. data/test/test_site.rb +153 -0
  90. data/test/test_tags.rb +116 -0
  91. 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)
@@ -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,3 @@
1
+ --
2
+ Tom Preston-Werner
3
+ github.com/mojombo
@@ -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,8 @@
1
+ ---
2
+ layout: default
3
+ title: Not published!
4
+ published: false
5
+ category: publish_test
6
+ ---
7
+
8
+ This should *not* be published!
@@ -0,0 +1,8 @@
1
+ ---
2
+ layout: default
3
+ title: Publish
4
+ category: publish_test
5
+ ---
6
+
7
+ This should be published.
8
+
@@ -0,0 +1,8 @@
1
+ ---
2
+ layout: default
3
+ title: Foo Bar
4
+ ---
5
+
6
+ h1. {{ page.title }}
7
+
8
+ Best *post* ever
@@ -0,0 +1,8 @@
1
+ ---
2
+ layout: default
3
+ title: Complex
4
+ ---
5
+
6
+ url: {{ page.url }}
7
+ date: {{ page.date }}
8
+ id: {{ page.id }}
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: Post with Permalink
3
+ permalink: my_category/permalinked-post
4
+ ---
5
+
6
+ h1. {{ page.title }}
7
+
8
+
9
+ <p>Best <strong>post</strong> ever</p>
@@ -0,0 +1,8 @@
1
+ ---
2
+ layout: default
3
+ title: Include
4
+ ---
5
+
6
+ {% include sig.markdown %}
7
+
8
+ This _is_ cool
@@ -0,0 +1,10 @@
1
+ ---
2
+ layout: default
3
+ title: Array categories in YAML
4
+ categories:
5
+ - foo
6
+ - bar
7
+ - baz
8
+ ---
9
+
10
+ Best *post* ever
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Categories in YAML
4
+ categories: foo bar baz
5
+ ---
6
+
7
+ Best *post* ever
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Category in YAML
4
+ category: foo
5
+ ---
6
+
7
+ Best *post* ever
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Category in YAML
4
+ categories:
5
+ ---
6
+
7
+ Best *post* ever
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Category in YAML
4
+ category:
5
+ ---
6
+
7
+ Best *post* ever
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: default
3
+ title: Hash #1
4
+ ---
5
+
6
+ Hashes are nice
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: A Tag
3
+ tag:
4
+ ---
5
+
6
+ Whoa.
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: Some Tags
3
+ tags:
4
+ ---
5
+
6
+ Awesome!
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: A Tag
3
+ tag: code
4
+ ---
5
+
6
+ Whoa.
@@ -0,0 +1,9 @@
1
+ ---
2
+ title: Some Tags
3
+ tags:
4
+ - food
5
+ - cooking
6
+ - pizza
7
+ ---
8
+
9
+ Awesome!
@@ -0,0 +1,3 @@
1
+ ---
2
+ ---
3
+ Empty YAML.
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: Foo --- Bar
3
+ ---
4
+
5
+ Triple the fun!
@@ -0,0 +1,7 @@
1
+ ---
2
+ date: 2010-01-10
3
+ ---
4
+
5
+ Post with a front matter date
6
+
7
+ {{ page.date | date_to_string }}
@@ -0,0 +1,7 @@
1
+ ---
2
+ date: 2010-01-10 13:07:09
3
+ ---
4
+
5
+ Post with a front matter time
6
+
7
+ {{ page.date | date_to_string }}
@@ -0,0 +1,7 @@
1
+ ---
2
+ date: 2010-01-10 13:07:09 +00:00
3
+ ---
4
+
5
+ Post with a front matter time with timezone
6
+
7
+ {{ page.date | date_to_string }}