jekyll-file-protocol 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1d3e1d1aed29f648b06fc2572688b72a51f1989
4
- data.tar.gz: d15f322fe4310db5687eb0a00b25d38f6a1750bb
3
+ metadata.gz: e418656e1f83e82a737545da93852ef808324a35
4
+ data.tar.gz: d344d91df65bfe4aca4dd06d365d540658d9e51c
5
5
  SHA512:
6
- metadata.gz: edc65010bb4c171614a76a54764446c22fcef1f614f098b7b386a525d53ebb5f452ed4e84abd8e7830f2a804aefa1a26249dc4f783a71b597670c2fad109aecc
7
- data.tar.gz: 1258ed9476682d6b664d767b49a19a0d7890cf47c9af91218c73cfc07e9fd690d2bf5cf0a2d83bb5c538bbcf64649802ee5bc72dcd4f39cc8a5a7b484e5c0fbe
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.2.1'
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
 
@@ -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
@@ -1,3 +1,4 @@
1
+ require 'liquid'
1
2
  require 'nokogiri'
2
3
  require 'jekyll-file-protocol/relative_path_renderer'
3
4
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module JekyllFileProtocol
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.1
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