mm-jekyll-prism 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +92 -0
- data/LICENSE +22 -0
- data/README.md +105 -0
- data/Rakefile +1 -0
- data/jekyll_prism_plugin.gemspec +26 -0
- data/lib/jekyll-prism.rb +108 -0
- data/script/bootstrap +3 -0
- data/script/cibuild +3 -0
- data/spec/_test/doc.md +0 -0
- data/spec/jekyll_prism_spec.rb +69 -0
- data/spec/spec_helper.rb +43 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cef1a527f0b11c63cc360ece4cda070460d86855
|
4
|
+
data.tar.gz: 1d1c623f56c5a65c5c7ae09f436e227baae4c8c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f98451286797e4006d392ae3b238482a91a40b53a3f7a5093ea97e747235b9285baaab0ec5c84178a3d666fb8341812c3f74cf9742e3b59c33e2d2c4f81f7c12
|
7
|
+
data.tar.gz: b45c0acd5dbc45d57b76d77b62a0878a21fd6f56798d63175bf517bdce691a26846852cb0e0d832f2c78b85a672e658a745d28d2271845d3ab357bb70f8c09d5
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jekyll-prism (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
blankslate (2.1.2.4)
|
10
|
+
celluloid (0.15.2)
|
11
|
+
timers (~> 1.1.0)
|
12
|
+
classifier-reborn (2.0.1)
|
13
|
+
fast-stemmer (~> 1.0)
|
14
|
+
coffee-script (2.3.0)
|
15
|
+
coffee-script-source
|
16
|
+
execjs
|
17
|
+
coffee-script-source (1.7.1)
|
18
|
+
colorator (0.1)
|
19
|
+
diff-lcs (1.2.5)
|
20
|
+
execjs (2.2.1)
|
21
|
+
fast-stemmer (1.0.2)
|
22
|
+
ffi (1.9.3)
|
23
|
+
jekyll (2.3.0)
|
24
|
+
classifier-reborn (~> 2.0)
|
25
|
+
colorator (~> 0.1)
|
26
|
+
jekyll-coffeescript (~> 1.0)
|
27
|
+
jekyll-gist (~> 1.0)
|
28
|
+
jekyll-paginate (~> 1.0)
|
29
|
+
jekyll-sass-converter (~> 1.0)
|
30
|
+
jekyll-watch (~> 1.1)
|
31
|
+
kramdown (~> 1.3)
|
32
|
+
liquid (~> 2.6.1)
|
33
|
+
mercenary (~> 0.3.3)
|
34
|
+
pygments.rb (~> 0.6.0)
|
35
|
+
redcarpet (~> 3.1)
|
36
|
+
safe_yaml (~> 1.0)
|
37
|
+
toml (~> 0.1.0)
|
38
|
+
jekyll-coffeescript (1.0.0)
|
39
|
+
coffee-script (~> 2.2)
|
40
|
+
jekyll-gist (1.1.0)
|
41
|
+
jekyll-paginate (1.0.0)
|
42
|
+
jekyll-sass-converter (1.2.0)
|
43
|
+
sass (~> 3.2)
|
44
|
+
jekyll-watch (1.1.0)
|
45
|
+
listen (~> 2.7)
|
46
|
+
kramdown (1.4.1)
|
47
|
+
liquid (2.6.1)
|
48
|
+
listen (2.7.9)
|
49
|
+
celluloid (>= 0.15.2)
|
50
|
+
rb-fsevent (>= 0.9.3)
|
51
|
+
rb-inotify (>= 0.9)
|
52
|
+
mercenary (0.3.4)
|
53
|
+
parslet (1.5.0)
|
54
|
+
blankslate (~> 2.0)
|
55
|
+
posix-spawn (0.3.9)
|
56
|
+
pygments.rb (0.6.0)
|
57
|
+
posix-spawn (~> 0.3.6)
|
58
|
+
yajl-ruby (~> 1.1.0)
|
59
|
+
rake (10.3.2)
|
60
|
+
rb-fsevent (0.9.4)
|
61
|
+
rb-inotify (0.9.5)
|
62
|
+
ffi (>= 0.5.0)
|
63
|
+
redcarpet (3.1.2)
|
64
|
+
rspec (3.0.0)
|
65
|
+
rspec-core (~> 3.0.0)
|
66
|
+
rspec-expectations (~> 3.0.0)
|
67
|
+
rspec-mocks (~> 3.0.0)
|
68
|
+
rspec-core (3.0.4)
|
69
|
+
rspec-support (~> 3.0.0)
|
70
|
+
rspec-expectations (3.0.4)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.0.0)
|
73
|
+
rspec-mocks (3.0.4)
|
74
|
+
rspec-support (~> 3.0.0)
|
75
|
+
rspec-support (3.0.4)
|
76
|
+
safe_yaml (1.0.3)
|
77
|
+
sass (3.4.1)
|
78
|
+
timers (1.1.0)
|
79
|
+
toml (0.1.1)
|
80
|
+
parslet (~> 1.5.0)
|
81
|
+
yajl-ruby (1.1.0)
|
82
|
+
|
83
|
+
PLATFORMS
|
84
|
+
ruby
|
85
|
+
|
86
|
+
DEPENDENCIES
|
87
|
+
bundler (~> 1.5)
|
88
|
+
jekyll (~> 2.0)
|
89
|
+
jekyll-prism!
|
90
|
+
rake
|
91
|
+
rspec
|
92
|
+
rspec-mocks
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Tim Oram
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# Jekyll Prisim Plugin
|
2
|
+
|
3
|
+
A Prism plugin for Jekyll with support included for the official plugins.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem jekyll-prism
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install jekyll-prism
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
These instructions assume you are familiar with using Prism. If not please read the [Prisim documentation](http://prismjs.com/index.html) from the Prism website. This plugin does not install prism but allows for easy inclusion of Prism code blocks in your Jekyll website.
|
24
|
+
|
25
|
+
To start using this plugin replace your `<pre><code class="language-*">...</code></pre>` block with `{% prism myLanguage %}...{% endprism %}` replacing `myLanguage` with any language supported by Prisim.
|
26
|
+
|
27
|
+
### Plugins
|
28
|
+
|
29
|
+
#### Line Highlighting
|
30
|
+
|
31
|
+
__Help document__: http://prismjs.com/plugins/line-highlight/
|
32
|
+
|
33
|
+
To use line highlighting provide the __highlight__ option with the values for the line-highlight plugin as specified on the plugins help page. The value is passed verbatim to the _data-line_ attribute used by Prism.
|
34
|
+
|
35
|
+
###### Example
|
36
|
+
|
37
|
+
{% prism javascript highlight="1-5,7,10-13" %}
|
38
|
+
// ...
|
39
|
+
{% endprism %}
|
40
|
+
|
41
|
+
#### Line Numbering
|
42
|
+
__Help document__: http://prismjs.com/plugins/line-numbers/
|
43
|
+
|
44
|
+
To use line numbering add the option __numbering__. To offset line numbering provide a value to the __numbering__ option as specified in the help page for the plugin. The value is passed verbatim to the _data-start_ attribute used by Prism.
|
45
|
+
|
46
|
+
###### Example
|
47
|
+
__No offset__
|
48
|
+
|
49
|
+
{% prism javascript numbering %}
|
50
|
+
// ...
|
51
|
+
{% endprism %}
|
52
|
+
|
53
|
+
__With offset__
|
54
|
+
|
55
|
+
{% prism javascript numbering=10 %}
|
56
|
+
// ...
|
57
|
+
{% endprism %}
|
58
|
+
|
59
|
+
#### Show invisibles
|
60
|
+
__Help document__: http://prismjs.com/plugins/show-invisibles/
|
61
|
+
|
62
|
+
Works without any further configuration assuming the plugin is installed.
|
63
|
+
|
64
|
+
#### Autolinker
|
65
|
+
__Help document__: http://prismjs.com/plugins/autolinker/
|
66
|
+
|
67
|
+
Works without any further configuration assuming the plugin is installed.
|
68
|
+
|
69
|
+
#### WebPlatform Docs
|
70
|
+
__Help document__: http://prismjs.com/plugins/wpd/
|
71
|
+
|
72
|
+
Works without any further configuration assuming the plugin is installed.
|
73
|
+
|
74
|
+
#### File Highlight
|
75
|
+
__Help document__: http://prismjs.com/plugins/file-highlight/
|
76
|
+
|
77
|
+
To use file highlighting add the option __file__ with the path to the file. See the help document for further information. There is no need to specifiy a language when using __File Highlight__ but you can provide one. The value is passed verbatim to the _data-src_ attribute used by Prism. Other plugins may not function with this plugin; this is a limitation of the Prism plugin.
|
78
|
+
|
79
|
+
###### Example
|
80
|
+
__No language__
|
81
|
+
|
82
|
+
{% prism file="myfile.js" %}
|
83
|
+
// ...
|
84
|
+
{% endprism %}
|
85
|
+
|
86
|
+
__With offset__
|
87
|
+
|
88
|
+
{% prism javascript file="myfile.js" %}
|
89
|
+
// ...
|
90
|
+
{% endprism %}
|
91
|
+
|
92
|
+
|
93
|
+
#### Show Language
|
94
|
+
__Help document__: http://prismjs.com/plugins/show-language/
|
95
|
+
|
96
|
+
Works without any further configuration assuming the plugin is installed.
|
97
|
+
|
98
|
+
|
99
|
+
## Contributing
|
100
|
+
|
101
|
+
1. Fork it ( https://github.com/mitmaro/jekyll-prism-plugin/fork )
|
102
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
103
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
104
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
105
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "mm-jekyll-prism"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Tim Oram"]
|
9
|
+
spec.email = ["mitmaro@gmail.com"]
|
10
|
+
spec.summary = %q{Prism plugin for Jekyll}
|
11
|
+
spec.description = %q{Provides support for prisim in Jekyll, including plugin support.}
|
12
|
+
spec.homepage = "https://github.com/mitmaro/jekyll-prism-plugin"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "jekyll", "~> 2.0"
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.3"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
spec.add_development_dependency "rspec-mocks", "~> 3.0"
|
25
|
+
|
26
|
+
end
|
data/lib/jekyll-prism.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
module Jekyll
|
2
|
+
|
3
|
+
class Prism < Liquid::Block
|
4
|
+
include Liquid::StandardFilters
|
5
|
+
|
6
|
+
LANGUAGE = /^[a-z\-]+$/
|
7
|
+
OPTION_PARAMS = /(file|highlight|numbering|language)(?:\s*=\s*("[a-zA-Z0-9.,\-\/\s]*"|\-?[0-9]+))?/
|
8
|
+
|
9
|
+
@language = nil
|
10
|
+
@file = nil
|
11
|
+
@numbering = false
|
12
|
+
@highlight = false
|
13
|
+
|
14
|
+
def initialize(tag_name, markup, tokens)
|
15
|
+
super
|
16
|
+
|
17
|
+
markup = markup.strip
|
18
|
+
|
19
|
+
tmp = markup.split(/\s+/, 2)
|
20
|
+
|
21
|
+
if tmp.count >= 1 then
|
22
|
+
param = tmp[0].strip.downcase
|
23
|
+
if LANGUAGE =~ param then
|
24
|
+
@language = param
|
25
|
+
if tmp.count == 2 then
|
26
|
+
markup = tmp[1]
|
27
|
+
else
|
28
|
+
return
|
29
|
+
end
|
30
|
+
elsif not param.start_with? "file" then
|
31
|
+
syntax_error
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
params = markup.strip.scan(OPTION_PARAMS).to_a
|
37
|
+
|
38
|
+
params.each { |x|
|
39
|
+
if x.count == 1 || x[1] == nil then
|
40
|
+
name = x[0]
|
41
|
+
|
42
|
+
if name.eql? "numbering" then
|
43
|
+
@numbering = true
|
44
|
+
else
|
45
|
+
syntax_error
|
46
|
+
end
|
47
|
+
elsif x.count == 2 then
|
48
|
+
name = x[0]
|
49
|
+
value = x[1]
|
50
|
+
if name.eql? "file" then
|
51
|
+
@file = value.tr('"', '')
|
52
|
+
elsif name.eql? "highlight" then
|
53
|
+
@highlight = value.tr('"', '')
|
54
|
+
elsif name.eql? "numbering" then
|
55
|
+
@numbering = value.to_i
|
56
|
+
end
|
57
|
+
else
|
58
|
+
syntax_error
|
59
|
+
end
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
def syntax_error
|
65
|
+
raise SyntaxError.new(
|
66
|
+
"Syntax Error in 'prism' - Valid syntax: prism <lang> [<option>(=<value>)] or prism file=path/to/file [<option>(=<value>)]"
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def render(context)
|
71
|
+
code = super.to_s.strip
|
72
|
+
dataline = ""
|
73
|
+
|
74
|
+
linenumber = ""
|
75
|
+
datastart = ""
|
76
|
+
|
77
|
+
language = ""
|
78
|
+
|
79
|
+
class_attr = ""
|
80
|
+
|
81
|
+
unless @language.nil? then
|
82
|
+
class_attr = class_attr + " language-" + @language + " "
|
83
|
+
end
|
84
|
+
|
85
|
+
if not @numbering.nil? then
|
86
|
+
class_attr = class_attr + " line-numbers "
|
87
|
+
end
|
88
|
+
|
89
|
+
if @numbering.is_a? Numeric then
|
90
|
+
datastart = "data-start='#{@numbering}'"
|
91
|
+
end
|
92
|
+
|
93
|
+
unless @highlight.nil? then
|
94
|
+
dataline = "data-line='#{@highlight}'"
|
95
|
+
end
|
96
|
+
|
97
|
+
if @file.nil?
|
98
|
+
"<pre class=\"#{class_attr}\" #{datastart} #{dataline}><code>#{code}</code></pre>"
|
99
|
+
else
|
100
|
+
"<pre class='#{class_attr}' #{datastart} #{dataline} data-src='#{@file}'></pre>"
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
Liquid::Template.register_tag('prism', Jekyll::Prism)
|
data/script/bootstrap
ADDED
data/script/cibuild
ADDED
data/spec/_test/doc.md
ADDED
File without changes
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Jekyll::Prism do
|
4
|
+
|
5
|
+
let(:doc) { doc_with_content(content) }
|
6
|
+
let(:content) { '{% prism javascript %} My Code {% endprism %}' }
|
7
|
+
let(:output) do
|
8
|
+
doc.content = content
|
9
|
+
doc.output = Jekyll::Renderer.new(doc.site, doc).run
|
10
|
+
end
|
11
|
+
context "valid parameters" do
|
12
|
+
it "Understands how to get a language parameter" do
|
13
|
+
prism = Jekyll::Prism.new("prism", 'javascript ', ["{% endprism %}"]);
|
14
|
+
expect(prism.instance_variable_get(:@language)).to eql("javascript")
|
15
|
+
prism = Jekyll::Prism.new("prism", 'javascript numbering ', ["{% endprism %}"]);
|
16
|
+
expect(prism.instance_variable_get(:@language)).to eql("javascript")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "Understands how to accept a file parameter" do
|
20
|
+
prism = Jekyll::Prism.new("prism", 'file="path/to/file.js" ', ["{% endprism %}"]);
|
21
|
+
expect(prism.instance_variable_get(:@file)).to eql("path/to/file.js")
|
22
|
+
prism = Jekyll::Prism.new("prism", 'javascript file="path/to/file.js" ', ["{% endprism %}"]);
|
23
|
+
expect(prism.instance_variable_get(:@file)).to eql("path/to/file.js")
|
24
|
+
prism = Jekyll::Prism.new("prism", 'javascript file="path/to/file.js" highlight=10', ["{% endprism %}"]);
|
25
|
+
expect(prism.instance_variable_get(:@file)).to eql("path/to/file.js")
|
26
|
+
end
|
27
|
+
|
28
|
+
it "Understands how to accept a highlight parameter" do
|
29
|
+
prism = Jekyll::Prism.new("prism", 'javascript highlight="1-2,4,5-9" ', ["{% endprism %}"]);
|
30
|
+
expect(prism.instance_variable_get(:@highlight)).to eql("1-2,4,5-9")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "Understands how to accept a numbering parameter" do
|
34
|
+
prism = Jekyll::Prism.new("prism", 'javascript numbering ', ["{% endprism %}"]);
|
35
|
+
expect(prism.instance_variable_get(:@numbering)).to eql(true)
|
36
|
+
prism = Jekyll::Prism.new("prism", 'javascript numbering=10 ', ["{% endprism %}"]);
|
37
|
+
expect(prism.instance_variable_get(:@numbering)).to eql(10)
|
38
|
+
prism = Jekyll::Prism.new("prism", 'javascript numbering=-10 ', ["{% endprism %}"]);
|
39
|
+
expect(prism.instance_variable_get(:@numbering)).to eql(-10)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "Valid render from code with all options" do
|
44
|
+
|
45
|
+
let(:content) { '{% prism cpp numbering=5 highlight="1,2-5,10" %} My Code {% endprism %}' }
|
46
|
+
|
47
|
+
it "Understands how to render code from code block" do
|
48
|
+
expect(output).to match("<pre class=\" language-cpp line-numbers \" data-start=\"5\" data-line=\"1,2-5,10\"><code>My Code</code></pre>")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "Valid render from file with all options" do
|
53
|
+
|
54
|
+
let(:content) { '{% prism cpp file="path/to/file.cpp" numbering=5 highlight="1,2-5,10" %}{% endprism %}' }
|
55
|
+
|
56
|
+
it "Understands how to render code from code block" do
|
57
|
+
expect(output).to match("<pre class=\" language-cpp line-numbers \" data-start=\"5\" data-line=\"1,2-5,10\" data-src=\"path/to/file.cpp\"></pre>")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "Valid render from file with all options without language" do
|
62
|
+
|
63
|
+
let(:content) { '{% prism file="path/to/file.cpp" numbering=5 highlight="1,2-5,10" %}{% endprism %}' }
|
64
|
+
|
65
|
+
it "Understands how to render code from code block" do
|
66
|
+
expect(output).to match("<pre class=\" line-numbers \" data-start=\"5\" data-line=\"1,2-5,10\" data-src=\"path/to/file.cpp\"></pre>")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
TEST_DIR = File.dirname(__FILE__)
|
2
|
+
TMP_DIR = File.expand_path("../tmp", TEST_DIR)
|
3
|
+
|
4
|
+
require 'jekyll'
|
5
|
+
require File.expand_path("../lib/jekyll-prism.rb", TEST_DIR)
|
6
|
+
|
7
|
+
Jekyll.logger.log_level = :error
|
8
|
+
STDERR.reopen(test(?e, '/dev/null') ? '/dev/null' : 'NUL:')
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
|
15
|
+
def tmp_dir(*files)
|
16
|
+
File.join(TMP_DIR, *files)
|
17
|
+
end
|
18
|
+
|
19
|
+
def source_dir(*files)
|
20
|
+
tmp_dir('source', *files)
|
21
|
+
end
|
22
|
+
|
23
|
+
def dest_dir(*files)
|
24
|
+
tmp_dir('dest', *files)
|
25
|
+
end
|
26
|
+
|
27
|
+
def doc_with_content(content, opts = {})
|
28
|
+
my_site = site
|
29
|
+
Jekyll::Document.new(source_dir('_test/doc.md'), {site: my_site, collection: collection(my_site)})
|
30
|
+
end
|
31
|
+
|
32
|
+
def collection(site, label = 'test')
|
33
|
+
Jekyll::Collection.new(site, label)
|
34
|
+
end
|
35
|
+
|
36
|
+
def site(opts = {})
|
37
|
+
conf = Jekyll::Utils.deep_merge_hashes(Jekyll::Configuration::DEFAULTS, opts.merge({
|
38
|
+
"source" => source_dir,
|
39
|
+
"destination" => dest_dir
|
40
|
+
}))
|
41
|
+
Jekyll::Site.new(conf)
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mm-jekyll-prism
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Oram
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-mocks
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: Provides support for prisim in Jekyll, including plugin support.
|
84
|
+
email:
|
85
|
+
- mitmaro@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
92
|
+
- LICENSE
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- jekyll_prism_plugin.gemspec
|
96
|
+
- lib/jekyll-prism.rb
|
97
|
+
- script/bootstrap
|
98
|
+
- script/cibuild
|
99
|
+
- spec/_test/doc.md
|
100
|
+
- spec/jekyll_prism_spec.rb
|
101
|
+
- spec/spec_helper.rb
|
102
|
+
homepage: https://github.com/mitmaro/jekyll-prism-plugin
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.4.1
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Prism plugin for Jekyll
|
126
|
+
test_files:
|
127
|
+
- spec/_test/doc.md
|
128
|
+
- spec/jekyll_prism_spec.rb
|
129
|
+
- spec/spec_helper.rb
|