jekyll-file-protocol 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64e838dd7ebf0f0d155dfa3f74897ce594ffc317
4
- data.tar.gz: ff5a034ca706b37c36556a297178a8d2026a1d0b
3
+ metadata.gz: bb0e572a1078b3b5436abd0809aee6e4b62df780
4
+ data.tar.gz: d0311c4bdb469ec445a5258409e50c6b60e31bbd
5
5
  SHA512:
6
- metadata.gz: 9e380eddfcf6db1841c55577250daf729c42c1c5f2b52faafac820af405462cf093702e4141900e0826d87890eef9ffe1264d11d5ec4175578d87b3987098d01
7
- data.tar.gz: a2b7e38b17dfd3f326d9bec203ccf7bf793e8442f934df2c79a4abce5306e9a027cc73e22cf1f480f8e49008bdf1eb48ef096beb5983997b416c061b1614dfae
6
+ metadata.gz: a785f5cceef4cda6be7e45bc4887ed0a974cf9f58a7e5a4de758a33111f97b51622c300ccbeb0e579e01b4cdb2825f9d37c5d54fb4ae27b2d99cf4f4ceac8779
7
+ data.tar.gz: fefdc757f6f87c76dc2db442b64b4bda034d57cf1b9ce2dfb6a749e95e2087f1480f968ada03b13079f3cfee59a8c42cd62b605ff9773754c0a8434dd2cb6034
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.1.3'
13
+ gem 'jekyll-file-protocol', '~> 0.1.4'
14
14
 
15
15
  And then execute:
16
16
 
@@ -17,7 +17,7 @@ module JekyllFileProtocol
17
17
  protected
18
18
 
19
19
  def count_depth(path)
20
- @page_url.scan('/').size
20
+ clear_leading_slashes(@page_url).scan('/').size
21
21
  end
22
22
 
23
23
  def is_absolute_path?
@@ -30,16 +30,25 @@ module JekyllFileProtocol
30
30
 
31
31
  return unless is_absolute_path?
32
32
 
33
- if relative.start_with?('//')
34
- relative = relative[2..-1]
35
- else
36
- relative = relative[1..-1]
37
- end
33
+ relative = clear_leading_slashes(relative)
38
34
 
39
35
  relative = ("../" * count_depth(@page_url)) + relative
40
36
  @relative_path = relative
41
37
  end
42
38
 
39
+ private
40
+
41
+ def clear_leading_slashes(path)
42
+ return path unless path.start_with?('/')
43
+ real_path = path
44
+
45
+ if real_path.start_with?('//')
46
+ real_path = real_path[2..-1]
47
+ else
48
+ real_path = real_path[1..-1]
49
+ end
50
+ end
51
+
43
52
  end
44
53
 
45
54
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllFileProtocol
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fire-Dragon-DoL