jekyll-gist 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.markdown +11 -0
- data/README.md +2 -0
- data/lib/jekyll-gist/gist_tag.rb +6 -7
- data/lib/jekyll-gist/version.rb +1 -1
- data/spec/gist_tag_spec.rb +22 -18
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 956dde53efdc7ba004b745ad63965672a082de7b
|
4
|
+
data.tar.gz: 1bb48861f6d8676f0450b3508390f28da05b0040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 579e357cb1bc2996bb2d4c2a6fb4daf5f1c9a33e794ab7eef245a7c20197cd88cac90dc81cfae6fdc33b1d15de1101801e6341ceb3c97e4f0d9a2105f27d3c6a
|
7
|
+
data.tar.gz: 3e286821b3a9820c1049908d1cae54e9b7df2d6892499f8fadc475a36b401f7acc7269e3510b22f5dad4c77ac2544f901bf48d6b46951395c4660b4960cc2a6d
|
data/History.markdown
ADDED
data/README.md
CHANGED
data/lib/jekyll-gist/gist_tag.rb
CHANGED
@@ -13,7 +13,10 @@ module Jekyll
|
|
13
13
|
#{@markup}
|
14
14
|
|
15
15
|
Valid syntax:
|
16
|
-
|
16
|
+
{% gist user/1234567 %}
|
17
|
+
{% gist user/1234567 foo.js %}
|
18
|
+
{% gist 28949e1d5ee2273f9fd3 %}
|
19
|
+
{% gist 28949e1d5ee2273f9fd3 best.md %}
|
17
20
|
eos
|
18
21
|
end
|
19
22
|
end
|
@@ -21,11 +24,7 @@ module Jekyll
|
|
21
24
|
private
|
22
25
|
|
23
26
|
def determine_arguments(input)
|
24
|
-
matched =
|
25
|
-
input.match(/\A([a-zA-Z0-9\/\-_]+) ?(\S*)\Z/)
|
26
|
-
else
|
27
|
-
input.match(/\A(\d+) ?(\S*)\Z/)
|
28
|
-
end
|
27
|
+
matched = input.match(/\A([\S]+|.*(?=\/).+)\s?(\S*)\Z/)
|
29
28
|
[matched[1].strip, matched[2].strip] if matched && matched.length >= 3
|
30
29
|
end
|
31
30
|
|
@@ -41,4 +40,4 @@ module Jekyll
|
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
44
|
-
Liquid::Template.register_tag('gist', Jekyll::Gist::GistTag)
|
43
|
+
Liquid::Template.register_tag('gist', Jekyll::Gist::GistTag)
|
data/lib/jekyll-gist/version.rb
CHANGED
data/spec/gist_tag_spec.rb
CHANGED
@@ -8,18 +8,26 @@ describe(Jekyll::Gist::GistTag) do
|
|
8
8
|
doc.output = Jekyll::Renderer.new(doc.site, doc).run
|
9
9
|
end
|
10
10
|
|
11
|
-
context "simple gist" do
|
12
|
-
let(:gist) { 358471 }
|
13
11
|
|
14
|
-
|
15
|
-
|
12
|
+
context "valid gist" do
|
13
|
+
context "with user prefix" do
|
14
|
+
let(:gist) { "mattr-/24081a1d93d2898ecf0f" }
|
15
|
+
|
16
|
+
it "produces the correct script tag" do
|
17
|
+
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/)
|
18
|
+
end
|
16
19
|
end
|
17
|
-
end
|
18
20
|
|
19
|
-
|
21
|
+
context "without user prefix" do
|
22
|
+
let(:gist) { "28949e1d5ee2273f9fd3" }
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
it "produces the correct script tag" do
|
25
|
+
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "classic Gist id style" do
|
30
|
+
let(:gist) { "1234321" }
|
23
31
|
|
24
32
|
it "produces the correct script tag" do
|
25
33
|
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js">\s<\/script>/)
|
@@ -35,9 +43,13 @@ describe(Jekyll::Gist::GistTag) do
|
|
35
43
|
expect(output).to match(/<script src="https:\/\/gist.github.com\/#{gist}.js\?file=#{filename}">\s<\/script>/)
|
36
44
|
end
|
37
45
|
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
context "invalid gist" do
|
38
50
|
|
39
|
-
context "
|
40
|
-
let(:gist) { "
|
51
|
+
context "no gist id present" do
|
52
|
+
let(:gist) { "" }
|
41
53
|
|
42
54
|
it "raises an error" do
|
43
55
|
expect(->{ output }).to raise_error
|
@@ -46,12 +58,4 @@ describe(Jekyll::Gist::GistTag) do
|
|
46
58
|
|
47
59
|
end
|
48
60
|
|
49
|
-
context "no gist id present" do
|
50
|
-
let(:gist) { "" }
|
51
|
-
|
52
|
-
it "raises an error" do
|
53
|
-
expect(->{ output }).to raise_error
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-gist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
78
|
- Gemfile
|
79
|
+
- History.markdown
|
79
80
|
- LICENSE.txt
|
80
81
|
- README.md
|
81
82
|
- Rakefile
|