fagiani-jekyll 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +284 -0
- data/LICENSE +21 -0
- data/README.textile +41 -0
- data/Rakefile +159 -0
- data/bin/jekyll +192 -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 +126 -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 +140 -0
- data/lib/jekyll.rb +125 -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 +113 -0
- data/lib/jekyll/converters/textile.rb +33 -0
- data/lib/jekyll/convertible.rb +98 -0
- data/lib/jekyll/core_ext.rb +52 -0
- data/lib/jekyll/errors.rb +6 -0
- data/lib/jekyll/filters.rb +53 -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/drupal.rb +86 -0
- data/lib/jekyll/migrators/marley.rb +53 -0
- data/lib/jekyll/migrators/mephisto.rb +79 -0
- data/lib/jekyll/migrators/mt.rb +77 -0
- data/lib/jekyll/migrators/textpattern.rb +50 -0
- data/lib/jekyll/migrators/typo.rb +49 -0
- data/lib/jekyll/migrators/wordpress.com.rb +38 -0
- data/lib/jekyll/migrators/wordpress.rb +56 -0
- data/lib/jekyll/page.rb +134 -0
- data/lib/jekyll/plugin.rb +76 -0
- data/lib/jekyll/post.rb +244 -0
- data/lib/jekyll/site.rb +273 -0
- data/lib/jekyll/static_file.rb +75 -0
- data/lib/jekyll/tags/highlight.rb +73 -0
- data/lib/jekyll/tags/include.rb +37 -0
- data/test/helper.rb +34 -0
- data/test/source/.htaccess +8 -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/deal.with.dots.html +7 -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 +53 -0
- data/test/test_generated_site.rb +72 -0
- data/test/test_kramdown.rb +23 -0
- data/test/test_page.rb +117 -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 +186 -0
- data/test/test_tags.rb +127 -0
- metadata +332 -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,140 @@
|
|
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 = 'fagiani-jekyll'
|
7
|
+
s.version = '0.10.1'
|
8
|
+
s.date = '2011-02-09'
|
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.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
|
+
s.add_development_dependency('kramdown', [">= 0.12.0"])
|
37
|
+
|
38
|
+
# = MANIFEST =
|
39
|
+
s.files = %w[
|
40
|
+
History.txt
|
41
|
+
LICENSE
|
42
|
+
README.textile
|
43
|
+
Rakefile
|
44
|
+
bin/jekyll
|
45
|
+
cucumber.yml
|
46
|
+
features/create_sites.feature
|
47
|
+
features/embed_filters.feature
|
48
|
+
features/markdown.feature
|
49
|
+
features/pagination.feature
|
50
|
+
features/permalinks.feature
|
51
|
+
features/post_data.feature
|
52
|
+
features/site_configuration.feature
|
53
|
+
features/site_data.feature
|
54
|
+
features/step_definitions/jekyll_steps.rb
|
55
|
+
features/support/env.rb
|
56
|
+
jekyll.gemspec
|
57
|
+
lib/jekyll.rb
|
58
|
+
lib/jekyll/albino.rb
|
59
|
+
lib/jekyll/converter.rb
|
60
|
+
lib/jekyll/converters/identity.rb
|
61
|
+
lib/jekyll/converters/markdown.rb
|
62
|
+
lib/jekyll/converters/textile.rb
|
63
|
+
lib/jekyll/convertible.rb
|
64
|
+
lib/jekyll/core_ext.rb
|
65
|
+
lib/jekyll/errors.rb
|
66
|
+
lib/jekyll/filters.rb
|
67
|
+
lib/jekyll/generator.rb
|
68
|
+
lib/jekyll/generators/pagination.rb
|
69
|
+
lib/jekyll/layout.rb
|
70
|
+
lib/jekyll/migrators/csv.rb
|
71
|
+
lib/jekyll/migrators/drupal.rb
|
72
|
+
lib/jekyll/migrators/marley.rb
|
73
|
+
lib/jekyll/migrators/mephisto.rb
|
74
|
+
lib/jekyll/migrators/mt.rb
|
75
|
+
lib/jekyll/migrators/textpattern.rb
|
76
|
+
lib/jekyll/migrators/typo.rb
|
77
|
+
lib/jekyll/migrators/wordpress.com.rb
|
78
|
+
lib/jekyll/migrators/wordpress.rb
|
79
|
+
lib/jekyll/page.rb
|
80
|
+
lib/jekyll/plugin.rb
|
81
|
+
lib/jekyll/post.rb
|
82
|
+
lib/jekyll/site.rb
|
83
|
+
lib/jekyll/static_file.rb
|
84
|
+
lib/jekyll/tags/highlight.rb
|
85
|
+
lib/jekyll/tags/include.rb
|
86
|
+
test/helper.rb
|
87
|
+
test/source/.htaccess
|
88
|
+
test/source/_includes/sig.markdown
|
89
|
+
test/source/_layouts/default.html
|
90
|
+
test/source/_layouts/simple.html
|
91
|
+
test/source/_posts/2008-02-02-not-published.textile
|
92
|
+
test/source/_posts/2008-02-02-published.textile
|
93
|
+
test/source/_posts/2008-10-18-foo-bar.textile
|
94
|
+
test/source/_posts/2008-11-21-complex.textile
|
95
|
+
test/source/_posts/2008-12-03-permalinked-post.textile
|
96
|
+
test/source/_posts/2008-12-13-include.markdown
|
97
|
+
test/source/_posts/2009-01-27-array-categories.textile
|
98
|
+
test/source/_posts/2009-01-27-categories.textile
|
99
|
+
test/source/_posts/2009-01-27-category.textile
|
100
|
+
test/source/_posts/2009-01-27-empty-categories.textile
|
101
|
+
test/source/_posts/2009-01-27-empty-category.textile
|
102
|
+
test/source/_posts/2009-03-12-hash-#1.markdown
|
103
|
+
test/source/_posts/2009-05-18-empty-tag.textile
|
104
|
+
test/source/_posts/2009-05-18-empty-tags.textile
|
105
|
+
test/source/_posts/2009-05-18-tag.textile
|
106
|
+
test/source/_posts/2009-05-18-tags.textile
|
107
|
+
test/source/_posts/2009-06-22-empty-yaml.textile
|
108
|
+
test/source/_posts/2009-06-22-no-yaml.textile
|
109
|
+
test/source/_posts/2010-01-08-triple-dash.markdown
|
110
|
+
test/source/_posts/2010-01-09-date-override.textile
|
111
|
+
test/source/_posts/2010-01-09-time-override.textile
|
112
|
+
test/source/_posts/2010-01-09-timezone-override.textile
|
113
|
+
test/source/_posts/2010-01-16-override-data.textile
|
114
|
+
test/source/about.html
|
115
|
+
test/source/category/_posts/2008-9-23-categories.textile
|
116
|
+
test/source/contacts.html
|
117
|
+
test/source/css/screen.css
|
118
|
+
test/source/deal.with.dots.html
|
119
|
+
test/source/foo/_posts/bar/2008-12-12-topical-post.textile
|
120
|
+
test/source/index.html
|
121
|
+
test/source/sitemap.xml
|
122
|
+
test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
|
123
|
+
test/source/z_category/_posts/2008-9-23-categories.textile
|
124
|
+
test/suite.rb
|
125
|
+
test/test_configuration.rb
|
126
|
+
test/test_core_ext.rb
|
127
|
+
test/test_filters.rb
|
128
|
+
test/test_generated_site.rb
|
129
|
+
test/test_kramdown.rb
|
130
|
+
test/test_page.rb
|
131
|
+
test/test_pager.rb
|
132
|
+
test/test_post.rb
|
133
|
+
test/test_rdiscount.rb
|
134
|
+
test/test_site.rb
|
135
|
+
test/test_tags.rb
|
136
|
+
]
|
137
|
+
# = MANIFEST =
|
138
|
+
|
139
|
+
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
140
|
+
end
|
data/lib/jekyll.rb
ADDED
@@ -0,0 +1,125 @@
|
|
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.10.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
|
+
'kramdown' => {
|
79
|
+
'auto_ids' => true,
|
80
|
+
'footnote_nr' => 1,
|
81
|
+
'entity_output' => 'as_char',
|
82
|
+
'toc_levels' => '1..6',
|
83
|
+
'use_coderay' => false,
|
84
|
+
|
85
|
+
'coderay' => {
|
86
|
+
'coderay_wrap' => 'div',
|
87
|
+
'coderay_line_numbers' => 'inline',
|
88
|
+
'coderay_line_number_start' => 1,
|
89
|
+
'coderay_tab_width' => 4,
|
90
|
+
'coderay_bold_every' => 10,
|
91
|
+
'coderay_css' => 'style'
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
# Generate a Jekyll configuration Hash by merging the default options
|
97
|
+
# with anything in _config.yml, and adding the given options on top.
|
98
|
+
#
|
99
|
+
# override - A Hash of config directives that override any options in both
|
100
|
+
# the defaults and the config file. See Jekyll::DEFAULTS for a
|
101
|
+
# list of option names and their defaults.
|
102
|
+
#
|
103
|
+
# Returns the final configuration Hash.
|
104
|
+
def self.configuration(override)
|
105
|
+
# _config.yml may override default source location, but until
|
106
|
+
# then, we need to know where to look for _config.yml
|
107
|
+
source = override['source'] || Jekyll::DEFAULTS['source']
|
108
|
+
|
109
|
+
# Get configuration from <source>/_config.yml
|
110
|
+
config_file = File.join(source, '_config.yml')
|
111
|
+
begin
|
112
|
+
config = YAML.load_file(config_file)
|
113
|
+
raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash)
|
114
|
+
$stdout.puts "Configuration from #{config_file}"
|
115
|
+
rescue => err
|
116
|
+
$stderr.puts "WARNING: Could not read configuration. " +
|
117
|
+
"Using defaults (and options)."
|
118
|
+
$stderr.puts "\t" + err.to_s
|
119
|
+
config = {}
|
120
|
+
end
|
121
|
+
|
122
|
+
# Merge DEFAULTS < _config.yml < override
|
123
|
+
Jekyll::DEFAULTS.deep_merge(config).deep_merge(override)
|
124
|
+
end
|
125
|
+
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
|