lv-jekyll-plugins 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +11 -1
- data/lib/plugins/asset.rb +8 -1
- data/lib/plugins/download.rb +8 -1
- data/lib/plugins/preview.rb +8 -1
- data/lib/plugins/project.rb +7 -0
- data/lib/version.rb +1 -1
- data/spec/plugins/asset_spec.rb +15 -0
- data/spec/plugins/download_spec.rb +15 -0
- data/spec/plugins/preview_spec.rb +15 -0
- data/spec/plugins/project_spec.rb +15 -0
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eb76f46358bc07f122b9b1fa33d38e8d522202e
|
4
|
+
data.tar.gz: f343c975788f72d6cba48d78e86c477d69c9e6ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9280a13de1d4d626ef54d2f2e4465ee2d5edb2af5e3698c67926d45b91c1f981be13dee057a35f0246eb63353440fe135421dfa7b5bc84a583fd9fd7fef0417a
|
7
|
+
data.tar.gz: 79f0d7ba729aed366640fc37b0ab9490acb6b64af5305e6ec07985ada6a9dc0444ac239673abe432d79cfba1d4dade15bc78f2fdd3de4c2f208dabcc79bf00ef
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -60,9 +60,19 @@ All plugins return a URL. You must build the HTML element yourself.
|
|
60
60
|
|
61
61
|
## Self-Hosting
|
62
62
|
|
63
|
-
|
63
|
+
First, add the gem to your Gemfile and `bundle install`.
|
64
|
+
|
65
|
+
``` ruby
|
66
|
+
gem 'lv-jekyll-plugins'
|
67
|
+
```
|
68
|
+
|
69
|
+
Next, the Jekyll `_config.yml` must contain entries for your organization and a project. You should also add the plugin to the list of gems.
|
64
70
|
|
65
71
|
``` yaml
|
66
72
|
organization: your-organization
|
67
73
|
project: your-project
|
74
|
+
gems:
|
75
|
+
- lv-jekyll-plugins
|
68
76
|
```
|
77
|
+
|
78
|
+
And that should do it! When you build your project, all LayerVault tags should be correctly generated. If you run into any issues, please open a GitHub issue with as many details as you can provide.
|
data/lib/plugins/asset.rb
CHANGED
@@ -8,7 +8,7 @@ module Jekyll
|
|
8
8
|
|
9
9
|
def initialize(tag_name, text, tokens)
|
10
10
|
super
|
11
|
-
@text = text
|
11
|
+
@text = text.strip
|
12
12
|
end
|
13
13
|
|
14
14
|
def render(context)
|
@@ -32,7 +32,14 @@ module Jekyll
|
|
32
32
|
map(&:first)
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
class ExampleAsset < Asset
|
37
|
+
def render(context)
|
38
|
+
"{% lv_asset #{@text.gsub 'lv_asset_example', 'lv_asset'} %}"
|
39
|
+
end
|
40
|
+
end
|
35
41
|
end
|
36
42
|
end
|
37
43
|
|
38
44
|
Liquid::Template.register_tag('lv_asset', Jekyll::LayerVault::Asset)
|
45
|
+
Liquid::Template.register_tag('lv_asset_example', Jekyll::LayerVault::ExampleAsset)
|
data/lib/plugins/download.rb
CHANGED
@@ -11,7 +11,7 @@ module Jekyll
|
|
11
11
|
|
12
12
|
def initialize(tag_name, text, tokens)
|
13
13
|
super
|
14
|
-
@text = text
|
14
|
+
@text = text.strip
|
15
15
|
end
|
16
16
|
|
17
17
|
def render(context)
|
@@ -34,7 +34,14 @@ module Jekyll
|
|
34
34
|
tap { |m| m[1] = nil if m[1] == '-' }
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
class DownloadExample < Download
|
39
|
+
def render(context)
|
40
|
+
"{% lv_download #{@text.gsub 'lv_download_example', 'lv_download' } %}"
|
41
|
+
end
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
39
45
|
|
40
46
|
Liquid::Template.register_tag('lv_download', Jekyll::LayerVault::Download)
|
47
|
+
Liquid::Template.register_tag('lv_download_example', Jekyll::LayerVault::DownloadExample)
|
data/lib/plugins/preview.rb
CHANGED
@@ -12,7 +12,7 @@ module Jekyll
|
|
12
12
|
|
13
13
|
def initialize(tag_name, text, tokens)
|
14
14
|
super
|
15
|
-
@text = text
|
15
|
+
@text = text.strip
|
16
16
|
end
|
17
17
|
|
18
18
|
def render(context)
|
@@ -39,7 +39,14 @@ module Jekyll
|
|
39
39
|
tap { |m| m[1] = nil if m[1] == '-' }
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
class PreviewExample < Preview
|
44
|
+
def render(context)
|
45
|
+
"{% lv_preview #{@text.gsub 'lv_preview_example', 'lv_preview'} %}"
|
46
|
+
end
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
|
45
51
|
Liquid::Template.register_tag('lv_preview', Jekyll::LayerVault::Preview)
|
52
|
+
Liquid::Template.register_tag('lv_preview_example', Jekyll::LayerVault::PreviewExample)
|
data/lib/plugins/project.rb
CHANGED
@@ -11,7 +11,14 @@ module Jekyll
|
|
11
11
|
File.join(URL_BASE, config['organization'], config['project'])
|
12
12
|
end
|
13
13
|
end
|
14
|
+
|
15
|
+
class ProjectExample < Project
|
16
|
+
def render(context)
|
17
|
+
"{% lv_project %}"
|
18
|
+
end
|
19
|
+
end
|
14
20
|
end
|
15
21
|
end
|
16
22
|
|
17
23
|
Liquid::Template.register_tag('lv_project', Jekyll::LayerVault::Project)
|
24
|
+
Liquid::Template.register_tag('lv_project_example', Jekyll::LayerVault::ProjectExample)
|
data/lib/version.rb
CHANGED
data/spec/plugins/asset_spec.rb
CHANGED
@@ -59,5 +59,20 @@ describe Jekyll::LayerVault::Asset do
|
|
59
59
|
expect(template.render(nil, options)).to eq target
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
context "with example tag" do
|
64
|
+
let (:source) { "{% lv_asset_example #{q}#{file}#{q} #{q}-#{q} #{q}#{asset}#{q} %}" }
|
65
|
+
let (:target) { "{% lv_asset #{q}#{file}#{q} #{q}-#{q} #{q}#{asset}#{q} %}" }
|
66
|
+
|
67
|
+
it "parses successfully" do
|
68
|
+
expect {
|
69
|
+
template.render nil, options
|
70
|
+
}.to_not raise_error
|
71
|
+
end
|
72
|
+
|
73
|
+
it "produces valid content" do
|
74
|
+
expect(template.render(nil, options)).to eq target
|
75
|
+
end
|
76
|
+
end
|
62
77
|
end
|
63
78
|
end
|
@@ -58,5 +58,20 @@ describe Jekyll::LayerVault::Download do
|
|
58
58
|
expect(template.render(nil, options)).to eq target
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
context "with example tag" do
|
63
|
+
let (:source) { "{% lv_download_example #{q}#{file}#{q} %}" }
|
64
|
+
let (:target) { "{% lv_download #{q}#{file}#{q} %}" }
|
65
|
+
|
66
|
+
it "parses successfully" do
|
67
|
+
expect {
|
68
|
+
template.render nil, options
|
69
|
+
}.to_not raise_error
|
70
|
+
end
|
71
|
+
|
72
|
+
it "produces valid content" do
|
73
|
+
expect(template.render(nil, options)).to eq target
|
74
|
+
end
|
75
|
+
end
|
61
76
|
end
|
62
77
|
end
|
@@ -92,5 +92,20 @@ describe Jekyll::LayerVault::Preview do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
95
|
+
|
96
|
+
context "with example tag" do
|
97
|
+
let (:source) { "{% lv_preview_example #{q}#{file}#{q} %}" }
|
98
|
+
let (:target) { "{% lv_preview #{q}#{file}#{q} %}" }
|
99
|
+
|
100
|
+
it "parses successfully" do
|
101
|
+
expect {
|
102
|
+
template.render nil, options
|
103
|
+
}.to_not raise_error
|
104
|
+
end
|
105
|
+
|
106
|
+
it "produces valid content" do
|
107
|
+
expect(template.render(nil, options)).to eq target
|
108
|
+
end
|
109
|
+
end
|
95
110
|
end
|
96
111
|
end
|
@@ -23,4 +23,19 @@ describe Jekyll::LayerVault::Project do
|
|
23
23
|
it "produces a valid URL" do
|
24
24
|
expect(template.render(nil, options)).to eq target
|
25
25
|
end
|
26
|
+
|
27
|
+
context "with example tag" do
|
28
|
+
let (:source) { "{% lv_project_example %}" }
|
29
|
+
let (:target) { "{% lv_project %}" }
|
30
|
+
|
31
|
+
it "parses successfully" do
|
32
|
+
expect {
|
33
|
+
template.render nil, options
|
34
|
+
}.to_not raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
it "produces valid content" do
|
38
|
+
expect(template.render(nil, options)).to eq target
|
39
|
+
end
|
40
|
+
end
|
26
41
|
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lv-jekyll-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan LeFevre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.6'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2'
|
69
69
|
description:
|
@@ -73,8 +73,8 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .rspec
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
78
|
- Gemfile
|
79
79
|
- LICENSE.txt
|
80
80
|
- README.md
|
@@ -102,12 +102,12 @@ require_paths:
|
|
102
102
|
- lib
|
103
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
|
-
- -
|
105
|
+
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|