jekyll-file-protocol 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/README.md +4 -2
- data/lib/jekyll-file-protocol.rb +3 -1
- data/lib/{jekyll → jekyll-file-protocol/jekyll}/filters/relative_path.rb +1 -0
- data/lib/jekyll-file-protocol/jekyll/tags/url_filename.rb +27 -0
- data/lib/jekyll-file-protocol/jekyll/tags/url_filename_with_ext.rb +27 -0
- data/lib/jekyll-file-protocol/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e418656e1f83e82a737545da93852ef808324a35
|
4
|
+
data.tar.gz: d344d91df65bfe4aca4dd06d365d540658d9e51c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91ef34632a1f22eb06ab6ab3837ed1d790e730ab50502d391155bec1ed06974c5c1643ab38bb0314f3f40d4a167c359d05b15064238338a5345cc48be72a74c1
|
7
|
+
data.tar.gz: e8e4c45719a32436ec80cfc633d3f275ab0e508374dbd0a1e4e61bdf85d37ea5225b9a31d4f07a1bd17b3d6c13c279ab4c74318eafe4ad649ab3276f561ad9d7
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ This gem is born to help me creating relative paths for filters of the gem [jeky
|
|
10
10
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
|
-
gem 'jekyll-file-protocol', '~> 0.
|
13
|
+
gem 'jekyll-file-protocol', '~> 0.3.0'
|
14
14
|
|
15
15
|
And then execute:
|
16
16
|
|
@@ -66,7 +66,9 @@ The other filter is `relative_tag` which can be used with `stylesheet`,
|
|
66
66
|
</html>
|
67
67
|
```
|
68
68
|
|
69
|
-
And the output is the same as before.
|
69
|
+
And the output is the same as before.
|
70
|
+
There are also some useful helpers (tags) to get url filename with and without
|
71
|
+
extension: `url_filename` and `url_filename_with_ext`.
|
70
72
|
|
71
73
|
## TODO
|
72
74
|
|
data/lib/jekyll-file-protocol.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'jekyll-file-protocol/version'
|
2
2
|
require 'jekyll-file-protocol/relative_path_renderer'
|
3
|
-
require 'jekyll/filters/relative_path'
|
3
|
+
require 'jekyll-file-protocol/jekyll/filters/relative_path'
|
4
|
+
require 'jekyll-file-protocol/jekyll/tags/url_filename'
|
5
|
+
require 'jekyll-file-protocol/jekyll/tags/url_filename_with_ext'
|
4
6
|
|
5
7
|
|
6
8
|
module JekyllFileProtocol
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'liquid'
|
3
|
+
|
4
|
+
module JekyllFileProtocol
|
5
|
+
|
6
|
+
module Jekyll
|
7
|
+
|
8
|
+
class UrlFilenameTag < Liquid::Tag
|
9
|
+
|
10
|
+
def initialize(tag_name, param, tokens)
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def render(context)
|
15
|
+
uri = URI.parse(context.registers[:page]['url'])
|
16
|
+
|
17
|
+
File.basename(uri.path, File.extname(uri.path))
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
Liquid::Template.register_tag 'url_filename', JekyllFileProtocol::Jekyll::UrlFilenameTag
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'liquid'
|
3
|
+
|
4
|
+
module JekyllFileProtocol
|
5
|
+
|
6
|
+
module Jekyll
|
7
|
+
|
8
|
+
class UrlFilenameWithExtTag < Liquid::Tag
|
9
|
+
|
10
|
+
def initialize(tag_name, param, tokens)
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def render(context)
|
15
|
+
uri = URI.parse(context.registers[:page]['url'])
|
16
|
+
|
17
|
+
File.basename(uri.path)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
Liquid::Template.register_tag 'url_filename_with_ext', JekyllFileProtocol::Jekyll::UrlFilenameWithExtTag
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-file-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fire-Dragon-DoL
|
@@ -95,9 +95,11 @@ files:
|
|
95
95
|
- Rakefile
|
96
96
|
- jekyll-file-protocol.gemspec
|
97
97
|
- lib/jekyll-file-protocol.rb
|
98
|
+
- lib/jekyll-file-protocol/jekyll/filters/relative_path.rb
|
99
|
+
- lib/jekyll-file-protocol/jekyll/tags/url_filename.rb
|
100
|
+
- lib/jekyll-file-protocol/jekyll/tags/url_filename_with_ext.rb
|
98
101
|
- lib/jekyll-file-protocol/relative_path_renderer.rb
|
99
102
|
- lib/jekyll-file-protocol/version.rb
|
100
|
-
- lib/jekyll/filters/relative_path.rb
|
101
103
|
homepage: ''
|
102
104
|
licenses:
|
103
105
|
- MIT
|