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,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,135 @@
|
|
|
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 = 'realityforge-jekyll'
|
|
7
|
+
s.version = '0.7.1'
|
|
8
|
+
s.date = '2010-08-24'
|
|
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"]
|
|
15
|
+
s.email = 'tom@mojombo.com'
|
|
16
|
+
s.homepage = 'http://github.com/mojombo/jekyll'
|
|
17
|
+
|
|
18
|
+
s.require_paths = %w[lib]
|
|
19
|
+
|
|
20
|
+
s.platform = $platform || RUBY_PLATFORM[/java/] || 'ruby'
|
|
21
|
+
|
|
22
|
+
s.executables = ["jekyll"]
|
|
23
|
+
s.default_executable = 'jekyll'
|
|
24
|
+
|
|
25
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
26
|
+
s.extra_rdoc_files = %w[README.textile LICENSE]
|
|
27
|
+
|
|
28
|
+
s.add_runtime_dependency('liquid', [">= 1.9.0"])
|
|
29
|
+
s.add_runtime_dependency('classifier', [">= 1.3.1"]) unless s.platform.to_s == 'java'
|
|
30
|
+
s.add_runtime_dependency('directory_watcher', [">= 1.1.1"])
|
|
31
|
+
s.add_runtime_dependency('maruku', [">= 0.5.9"])
|
|
32
|
+
|
|
33
|
+
s.add_development_dependency('redgreen', [">= 4.2.1"])
|
|
34
|
+
s.add_development_dependency('shoulda', [">= 4.2.1"])
|
|
35
|
+
s.add_development_dependency('rr', [">= 4.2.1"])
|
|
36
|
+
s.add_development_dependency('cucumber', [">= 4.2.1"])
|
|
37
|
+
s.add_development_dependency('RedCloth', [">= 4.2.1"])
|
|
38
|
+
|
|
39
|
+
# = MANIFEST =
|
|
40
|
+
s.files = %w[
|
|
41
|
+
History.txt
|
|
42
|
+
LICENSE
|
|
43
|
+
README.textile
|
|
44
|
+
Rakefile
|
|
45
|
+
bin/jekyll
|
|
46
|
+
cucumber.yml
|
|
47
|
+
features/create_sites.feature
|
|
48
|
+
features/embed_filters.feature
|
|
49
|
+
features/markdown.feature
|
|
50
|
+
features/pagination.feature
|
|
51
|
+
features/permalinks.feature
|
|
52
|
+
features/post_data.feature
|
|
53
|
+
features/site_configuration.feature
|
|
54
|
+
features/site_data.feature
|
|
55
|
+
features/step_definitions/jekyll_steps.rb
|
|
56
|
+
features/support/env.rb
|
|
57
|
+
jekyll.gemspec
|
|
58
|
+
lib/jekyll.rb
|
|
59
|
+
lib/jekyll/albino.rb
|
|
60
|
+
lib/jekyll/converter.rb
|
|
61
|
+
lib/jekyll/converters/identity.rb
|
|
62
|
+
lib/jekyll/converters/markdown.rb
|
|
63
|
+
lib/jekyll/converters/textile.rb
|
|
64
|
+
lib/jekyll/convertible.rb
|
|
65
|
+
lib/jekyll/core_ext.rb
|
|
66
|
+
lib/jekyll/errors.rb
|
|
67
|
+
lib/jekyll/filters.rb
|
|
68
|
+
lib/jekyll/generator.rb
|
|
69
|
+
lib/jekyll/generators/pagination.rb
|
|
70
|
+
lib/jekyll/layout.rb
|
|
71
|
+
lib/jekyll/migrators/csv.rb
|
|
72
|
+
lib/jekyll/migrators/mephisto.rb
|
|
73
|
+
lib/jekyll/migrators/mt.rb
|
|
74
|
+
lib/jekyll/migrators/textpattern.rb
|
|
75
|
+
lib/jekyll/migrators/typo.rb
|
|
76
|
+
lib/jekyll/migrators/wordpress.rb
|
|
77
|
+
lib/jekyll/page.rb
|
|
78
|
+
lib/jekyll/plugin.rb
|
|
79
|
+
lib/jekyll/post.rb
|
|
80
|
+
lib/jekyll/site.rb
|
|
81
|
+
lib/jekyll/static_file.rb
|
|
82
|
+
lib/jekyll/tags/highlight.rb
|
|
83
|
+
lib/jekyll/tags/include.rb
|
|
84
|
+
test/helper.rb
|
|
85
|
+
test/source/_includes/sig.markdown
|
|
86
|
+
test/source/_layouts/default.html
|
|
87
|
+
test/source/_layouts/simple.html
|
|
88
|
+
test/source/_posts/2008-02-02-not-published.textile
|
|
89
|
+
test/source/_posts/2008-02-02-published.textile
|
|
90
|
+
test/source/_posts/2008-10-18-foo-bar.textile
|
|
91
|
+
test/source/_posts/2008-11-21-complex.textile
|
|
92
|
+
test/source/_posts/2008-12-03-permalinked-post.textile
|
|
93
|
+
test/source/_posts/2008-12-13-include.markdown
|
|
94
|
+
test/source/_posts/2009-01-27-array-categories.textile
|
|
95
|
+
test/source/_posts/2009-01-27-categories.textile
|
|
96
|
+
test/source/_posts/2009-01-27-category.textile
|
|
97
|
+
test/source/_posts/2009-01-27-empty-categories.textile
|
|
98
|
+
test/source/_posts/2009-01-27-empty-category.textile
|
|
99
|
+
test/source/_posts/2009-03-12-hash-#1.markdown
|
|
100
|
+
test/source/_posts/2009-05-18-empty-tag.textile
|
|
101
|
+
test/source/_posts/2009-05-18-empty-tags.textile
|
|
102
|
+
test/source/_posts/2009-05-18-tag.textile
|
|
103
|
+
test/source/_posts/2009-05-18-tags.textile
|
|
104
|
+
test/source/_posts/2009-06-22-empty-yaml.textile
|
|
105
|
+
test/source/_posts/2009-06-22-no-yaml.textile
|
|
106
|
+
test/source/_posts/2010-01-08-triple-dash.markdown
|
|
107
|
+
test/source/_posts/2010-01-09-date-override.textile
|
|
108
|
+
test/source/_posts/2010-01-09-time-override.textile
|
|
109
|
+
test/source/_posts/2010-01-09-timezone-override.textile
|
|
110
|
+
test/source/_posts/2010-01-16-override-data.textile
|
|
111
|
+
test/source/about.html
|
|
112
|
+
test/source/category/_posts/2008-9-23-categories.textile
|
|
113
|
+
test/source/contacts.html
|
|
114
|
+
test/source/css/screen.css
|
|
115
|
+
test/source/foo/_posts/bar/2008-12-12-topical-post.textile
|
|
116
|
+
test/source/index.html
|
|
117
|
+
test/source/sitemap.xml
|
|
118
|
+
test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
|
|
119
|
+
test/source/z_category/_posts/2008-9-23-categories.textile
|
|
120
|
+
test/suite.rb
|
|
121
|
+
test/test_configuration.rb
|
|
122
|
+
test/test_core_ext.rb
|
|
123
|
+
test/test_filters.rb
|
|
124
|
+
test/test_generated_site.rb
|
|
125
|
+
test/test_page.rb
|
|
126
|
+
test/test_pager.rb
|
|
127
|
+
test/test_post.rb
|
|
128
|
+
test/test_rdiscount.rb
|
|
129
|
+
test/test_site.rb
|
|
130
|
+
test/test_tags.rb
|
|
131
|
+
]
|
|
132
|
+
# = MANIFEST =
|
|
133
|
+
|
|
134
|
+
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
|
135
|
+
end
|
data/lib/jekyll.rb
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
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.7.0'
|
|
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
|
+
'rdiscount' => {
|
|
76
|
+
'extensions' => []
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
# Generate a Jekyll configuration Hash by merging the default options
|
|
81
|
+
# with anything in _config.yml, and adding the given options on top.
|
|
82
|
+
#
|
|
83
|
+
# override - A Hash of config directives that override any options in both
|
|
84
|
+
# the defaults and the config file. See Jekyll::DEFAULTS for a
|
|
85
|
+
# list of option names and their defaults.
|
|
86
|
+
#
|
|
87
|
+
# Returns the final configuration Hash.
|
|
88
|
+
def self.configuration(override)
|
|
89
|
+
# _config.yml may override default source location, but until
|
|
90
|
+
# then, we need to know where to look for _config.yml
|
|
91
|
+
source = override['source'] || Jekyll::DEFAULTS['source']
|
|
92
|
+
|
|
93
|
+
# Get configuration from <source>/_config.yml
|
|
94
|
+
config_file = File.join(source, '_config.yml')
|
|
95
|
+
begin
|
|
96
|
+
config = YAML.load_file(config_file)
|
|
97
|
+
raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash)
|
|
98
|
+
$stdout.puts "Configuration from #{config_file}"
|
|
99
|
+
rescue => err
|
|
100
|
+
$stderr.puts "WARNING: Could not read configuration. " +
|
|
101
|
+
"Using defaults (and options)."
|
|
102
|
+
$stderr.puts "\t" + err.to_s
|
|
103
|
+
config = {}
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Merge DEFAULTS < _config.yml < override
|
|
107
|
+
Jekyll::DEFAULTS.deep_merge(config).deep_merge(override)
|
|
108
|
+
end
|
|
109
|
+
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 = 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
|