cartera-jekyll 0.6.2

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 (90) hide show
  1. data/History.txt +248 -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 +132 -0
  18. data/lib/jekyll.rb +106 -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 +77 -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 +241 -0
  40. data/lib/jekyll/site.rb +231 -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_site.rb +153 -0
  89. data/test/test_tags.rb +108 -0
  90. metadata +284 -0
@@ -0,0 +1,16 @@
1
+ require 'fileutils'
2
+ require 'rr'
3
+ require 'test/unit'
4
+
5
+ World do
6
+ include Test::Unit::Assertions
7
+ end
8
+
9
+ TEST_DIR = File.join('/', 'tmp', 'jekyll')
10
+ JEKYLL_PATH = File.join(ENV['PWD'], 'bin', 'jekyll')
11
+
12
+ def run_jekyll(opts = {})
13
+ command = JEKYLL_PATH
14
+ command << " >> /dev/null 2>&1" if opts[:debug].nil?
15
+ system command
16
+ end
data/jekyll.gemspec ADDED
@@ -0,0 +1,132 @@
1
+ Gem::Specification.new do |s|
2
+ s.specification_version = 2 if s.respond_to? :specification_version=
3
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
+ s.rubygems_version = '1.3.5'
5
+
6
+ s.name = 'cartera-jekyll'
7
+ s.version = '0.6.2'
8
+ s.date = '2010-07-10'
9
+ s.rubyforge_project = 'jekyll'
10
+
11
+ s.summary = "A simple, blog aware, static site generator."
12
+ s.description = "Jekyll is a simple, blog aware, static site generator."
13
+
14
+ s.authors = ["Tom Preston-Werner, forked by Carter Allen"]
15
+ s.email = 'carter@zcr.me'
16
+ s.homepage = 'http://github.com/cartera/jekyll'
17
+
18
+ s.require_paths = %w[lib]
19
+
20
+ s.executables = ["jekyll"]
21
+ s.default_executable = 'jekyll'
22
+
23
+ s.rdoc_options = ["--charset=UTF-8"]
24
+ s.extra_rdoc_files = %w[README.textile LICENSE]
25
+
26
+ s.add_runtime_dependency('liquid', [">= 1.9.0"])
27
+ s.add_runtime_dependency('classifier', [">= 1.3.1"])
28
+ s.add_runtime_dependency('directory_watcher', [">= 1.1.1"])
29
+ s.add_runtime_dependency('maruku', [">= 0.5.9"])
30
+
31
+ s.add_development_dependency('redgreen', [">= 4.2.1"])
32
+ s.add_development_dependency('shoulda', [">= 4.2.1"])
33
+ s.add_development_dependency('rr', [">= 4.2.1"])
34
+ s.add_development_dependency('cucumber', [">= 4.2.1"])
35
+ s.add_development_dependency('RedCloth', [">= 4.2.1"])
36
+
37
+ # = MANIFEST =
38
+ s.files = %w[
39
+ History.txt
40
+ LICENSE
41
+ README.textile
42
+ Rakefile
43
+ bin/jekyll
44
+ cucumber.yml
45
+ features/create_sites.feature
46
+ features/embed_filters.feature
47
+ features/markdown.feature
48
+ features/pagination.feature
49
+ features/permalinks.feature
50
+ features/post_data.feature
51
+ features/site_configuration.feature
52
+ features/site_data.feature
53
+ features/step_definitions/jekyll_steps.rb
54
+ features/support/env.rb
55
+ jekyll.gemspec
56
+ lib/jekyll.rb
57
+ lib/jekyll/albino.rb
58
+ lib/jekyll/converter.rb
59
+ lib/jekyll/converters/identity.rb
60
+ lib/jekyll/converters/markdown.rb
61
+ lib/jekyll/converters/textile.rb
62
+ lib/jekyll/convertible.rb
63
+ lib/jekyll/core_ext.rb
64
+ lib/jekyll/errors.rb
65
+ lib/jekyll/filters.rb
66
+ lib/jekyll/generator.rb
67
+ lib/jekyll/generators/pagination.rb
68
+ lib/jekyll/layout.rb
69
+ lib/jekyll/migrators/csv.rb
70
+ lib/jekyll/migrators/mephisto.rb
71
+ lib/jekyll/migrators/mt.rb
72
+ lib/jekyll/migrators/textpattern.rb
73
+ lib/jekyll/migrators/typo.rb
74
+ lib/jekyll/migrators/wordpress.rb
75
+ lib/jekyll/page.rb
76
+ lib/jekyll/plugin.rb
77
+ lib/jekyll/post.rb
78
+ lib/jekyll/site.rb
79
+ lib/jekyll/static_file.rb
80
+ lib/jekyll/tags/highlight.rb
81
+ lib/jekyll/tags/include.rb
82
+ test/helper.rb
83
+ test/source/_includes/sig.markdown
84
+ test/source/_layouts/default.html
85
+ test/source/_layouts/simple.html
86
+ test/source/_posts/2008-02-02-not-published.textile
87
+ test/source/_posts/2008-02-02-published.textile
88
+ test/source/_posts/2008-10-18-foo-bar.textile
89
+ test/source/_posts/2008-11-21-complex.textile
90
+ test/source/_posts/2008-12-03-permalinked-post.textile
91
+ test/source/_posts/2008-12-13-include.markdown
92
+ test/source/_posts/2009-01-27-array-categories.textile
93
+ test/source/_posts/2009-01-27-categories.textile
94
+ test/source/_posts/2009-01-27-category.textile
95
+ test/source/_posts/2009-01-27-empty-categories.textile
96
+ test/source/_posts/2009-01-27-empty-category.textile
97
+ test/source/_posts/2009-03-12-hash-#1.markdown
98
+ test/source/_posts/2009-05-18-empty-tag.textile
99
+ test/source/_posts/2009-05-18-empty-tags.textile
100
+ test/source/_posts/2009-05-18-tag.textile
101
+ test/source/_posts/2009-05-18-tags.textile
102
+ test/source/_posts/2009-06-22-empty-yaml.textile
103
+ test/source/_posts/2009-06-22-no-yaml.textile
104
+ test/source/_posts/2010-01-08-triple-dash.markdown
105
+ test/source/_posts/2010-01-09-date-override.textile
106
+ test/source/_posts/2010-01-09-time-override.textile
107
+ test/source/_posts/2010-01-09-timezone-override.textile
108
+ test/source/_posts/2010-01-16-override-data.textile
109
+ test/source/about.html
110
+ test/source/category/_posts/2008-9-23-categories.textile
111
+ test/source/contacts.html
112
+ test/source/css/screen.css
113
+ test/source/foo/_posts/bar/2008-12-12-topical-post.textile
114
+ test/source/index.html
115
+ test/source/sitemap.xml
116
+ test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
117
+ test/source/z_category/_posts/2008-9-23-categories.textile
118
+ test/suite.rb
119
+ test/test_configuration.rb
120
+ test/test_core_ext.rb
121
+ test/test_filters.rb
122
+ test/test_generated_site.rb
123
+ test/test_page.rb
124
+ test/test_pager.rb
125
+ test/test_post.rb
126
+ test/test_site.rb
127
+ test/test_tags.rb
128
+ ]
129
+ # = MANIFEST =
130
+
131
+ s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
132
+ end
data/lib/jekyll.rb ADDED
@@ -0,0 +1,106 @@
1
+ $:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
2
+
3
+ # Require all of the Ruby files in the given directory.
4
+ #
5
+ # path - The String relative path from here to the directory.
6
+ #
7
+ # Returns nothing.
8
+ def require_all(path)
9
+ glob = File.join(File.dirname(__FILE__), path, '*.rb')
10
+ Dir[glob].each do |f|
11
+ require f
12
+ end
13
+ end
14
+
15
+ # rubygems
16
+ require 'rubygems'
17
+
18
+ # stdlib
19
+ require 'fileutils'
20
+ require 'time'
21
+ require 'yaml'
22
+
23
+ # 3rd party
24
+ require 'liquid'
25
+ require 'maruku'
26
+
27
+ # internal requires
28
+ require 'jekyll/core_ext'
29
+ require 'jekyll/site'
30
+ require 'jekyll/convertible'
31
+ require 'jekyll/layout'
32
+ require 'jekyll/page'
33
+ require 'jekyll/post'
34
+ require 'jekyll/filters'
35
+ require 'jekyll/albino'
36
+ require 'jekyll/static_file'
37
+ require 'jekyll/errors'
38
+
39
+ # extensions
40
+ require 'jekyll/plugin'
41
+ require 'jekyll/converter'
42
+ require 'jekyll/generator'
43
+ require_all 'jekyll/converters'
44
+ require_all 'jekyll/generators'
45
+ require_all 'jekyll/tags'
46
+
47
+ module Jekyll
48
+ VERSION = '0.6.2'
49
+
50
+ # Default options. Overriden by values in _config.yml or command-line opts.
51
+ # (Strings rather symbols used for compatability with YAML).
52
+ DEFAULTS = {
53
+ 'safe' => false,
54
+ 'auto' => false,
55
+ 'server' => false,
56
+ 'server_port' => 4000,
57
+
58
+ 'source' => Dir.pwd,
59
+ 'destination' => File.join(Dir.pwd, '_site'),
60
+ 'plugins' => File.join(Dir.pwd, '_plugins'),
61
+
62
+ 'future' => true,
63
+ 'lsi' => false,
64
+ 'pygments' => false,
65
+ 'markdown' => 'maruku',
66
+ 'permalink' => 'date',
67
+
68
+ 'maruku' => {
69
+ 'use_tex' => false,
70
+ 'use_divs' => false,
71
+ 'png_engine' => 'blahtex',
72
+ 'png_dir' => 'images/latex',
73
+ 'png_url' => '/images/latex'
74
+ }
75
+ }
76
+
77
+ # Generate a Jekyll configuration Hash by merging the default options
78
+ # with anything in _config.yml, and adding the given options on top.
79
+ #
80
+ # override - A Hash of config directives that override any options in both
81
+ # the defaults and the config file. See Jekyll::DEFAULTS for a
82
+ # list of option names and their defaults.
83
+ #
84
+ # Returns the final configuration Hash.
85
+ def self.configuration(override)
86
+ # _config.yml may override default source location, but until
87
+ # then, we need to know where to look for _config.yml
88
+ source = override['source'] || Jekyll::DEFAULTS['source']
89
+
90
+ # Get configuration from <source>/_config.yml
91
+ config_file = File.join(source, '_config.yml')
92
+ begin
93
+ config = YAML.load_file(config_file)
94
+ raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash)
95
+ $stdout.puts "Configuration from #{config_file}"
96
+ rescue => err
97
+ $stderr.puts "WARNING: Could not read configuration. " +
98
+ "Using defaults (and options)."
99
+ $stderr.puts "\t" + err.to_s
100
+ config = {}
101
+ end
102
+
103
+ # Merge DEFAULTS < _config.yml < override
104
+ Jekyll::DEFAULTS.deep_merge(config).deep_merge(override)
105
+ end
106
+ end
@@ -0,0 +1,120 @@
1
+ ##
2
+ # Wrapper for the Pygments command line tool, pygmentize.
3
+ #
4
+ # Pygments: http://pygments.org/
5
+ #
6
+ # Assumes pygmentize is in the path. If not, set its location
7
+ # with Albino.bin = '/path/to/pygmentize'
8
+ #
9
+ # Use like so:
10
+ #
11
+ # @syntaxer = Albino.new('/some/file.rb', :ruby)
12
+ # puts @syntaxer.colorize
13
+ #
14
+ # This'll print out an HTMLized, Ruby-highlighted version
15
+ # of '/some/file.rb'.
16
+ #
17
+ # To use another formatter, pass it as the third argument:
18
+ #
19
+ # @syntaxer = Albino.new('/some/file.rb', :ruby, :bbcode)
20
+ # puts @syntaxer.colorize
21
+ #
22
+ # You can also use the #colorize class method:
23
+ #
24
+ # puts Albino.colorize('/some/file.rb', :ruby)
25
+ #
26
+ # Another also: you get a #to_s, for somewhat nicer use in Rails views.
27
+ #
28
+ # ... helper file ...
29
+ # def highlight(text)
30
+ # Albino.new(text, :ruby)
31
+ # end
32
+ #
33
+ # ... view file ...
34
+ # <%= highlight text %>
35
+ #
36
+ # The default lexer is 'text'. You need to specify a lexer yourself;
37
+ # because we are using STDIN there is no auto-detect.
38
+ #
39
+ # To see all lexers and formatters available, run `pygmentize -L`.
40
+ #
41
+ # Chris Wanstrath // chris@ozmm.org
42
+ # GitHub // http://github.com
43
+ #
44
+
45
+ class Albino
46
+ @@bin = Rails.development? ? 'pygmentize' : '/usr/bin/pygmentize' rescue 'pygmentize'
47
+
48
+ def self.bin=(path)
49
+ @@bin = path
50
+ end
51
+
52
+ def self.colorize(*args)
53
+ new(*args).colorize
54
+ end
55
+
56
+ def initialize(target, lexer = :text, format = :html)
57
+ @target = File.exists?(target) ? File.read(target) : target rescue target
58
+ @options = { :l => lexer, :f => format, :O => 'encoding=utf-8' }
59
+ end
60
+
61
+ def execute(command)
62
+ output = ''
63
+ IO.popen(command, mode='r+') do |p|
64
+ p.write @target
65
+ p.close_write
66
+ output = p.read.strip
67
+ end
68
+ output
69
+ end
70
+
71
+ def colorize(options = {})
72
+ html = execute(@@bin + convert_options(options))
73
+ # Work around an RDiscount bug: http://gist.github.com/97682
74
+ html.to_s.sub(%r{</pre></div>\Z}, "</pre>\n</div>")
75
+ end
76
+ alias_method :to_s, :colorize
77
+
78
+ def convert_options(options = {})
79
+ @options.merge(options).inject('') do |string, (flag, value)|
80
+ string + " -#{flag} #{value}"
81
+ end
82
+ end
83
+ end
84
+
85
+ if $0 == __FILE__
86
+ require 'rubygems'
87
+ require 'test/spec'
88
+ require 'mocha'
89
+ begin require 'redgreen'; rescue LoadError; end
90
+
91
+ context "Albino" do
92
+ setup do
93
+ @syntaxer = Albino.new(__FILE__, :ruby)
94
+ end
95
+
96
+ specify "defaults to text" do
97
+ syntaxer = Albino.new(__FILE__)
98
+ syntaxer.expects(:execute).with('pygmentize -f html -l text').returns(true)
99
+ syntaxer.colorize
100
+ end
101
+
102
+ specify "accepts options" do
103
+ @syntaxer.expects(:execute).with('pygmentize -f html -l ruby').returns(true)
104
+ @syntaxer.colorize
105
+ end
106
+
107
+ specify "works with strings" do
108
+ syntaxer = Albino.new('class New; end', :ruby)
109
+ assert_match %r(highlight), syntaxer.colorize
110
+ end
111
+
112
+ specify "aliases to_s" do
113
+ assert_equal @syntaxer.colorize, @syntaxer.to_s
114
+ end
115
+
116
+ specify "class method colorize" do
117
+ assert_equal @syntaxer.colorize, Albino.colorize(__FILE__, :ruby)
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,50 @@
1
+ module Jekyll
2
+
3
+ class Converter < Plugin
4
+ # Public: Get or set the pygments prefix. When an argument is specified,
5
+ # the prefix will be set. If no argument is specified, the current prefix
6
+ # will be returned.
7
+ #
8
+ # pygments_prefix - The String prefix (default: nil).
9
+ #
10
+ # Returns the String prefix.
11
+ def self.pygments_prefix(pygments_prefix = nil)
12
+ @pygments_prefix = pygments_prefix if pygments_prefix
13
+ @pygments_prefix
14
+ end
15
+
16
+ # Public: Get or set the pygments suffix. When an argument is specified,
17
+ # the suffix will be set. If no argument is specified, the current suffix
18
+ # will be returned.
19
+ #
20
+ # pygments_suffix - The String suffix (default: nil).
21
+ #
22
+ # Returns the String suffix.
23
+ def self.pygments_suffix(pygments_suffix = nil)
24
+ @pygments_suffix = pygments_suffix if pygments_suffix
25
+ @pygments_suffix
26
+ end
27
+
28
+ # Initialize the converter.
29
+ #
30
+ # Returns an initialized Converter.
31
+ def initialize(config = {})
32
+ @config = config
33
+ end
34
+
35
+ # Get the pygments prefix.
36
+ #
37
+ # Returns the String prefix.
38
+ def pygments_prefix
39
+ self.class.pygments_prefix
40
+ end
41
+
42
+ # Get the pygments suffix.
43
+ #
44
+ # Returns the String suffix.
45
+ def pygments_suffix
46
+ self.class.pygments_suffix
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,22 @@
1
+ module Jekyll
2
+
3
+ class IdentityConverter < Converter
4
+ safe true
5
+
6
+ priority :lowest
7
+
8
+ def matches(ext)
9
+ true
10
+ end
11
+
12
+ def output_ext(ext)
13
+ ext
14
+ end
15
+
16
+ def convert(content)
17
+ content
18
+ end
19
+
20
+ end
21
+
22
+ end