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 +4 -4
- data/README.md +1 -1
- data/lib/jekyll-file-protocol/relative_path_renderer.rb +15 -6
- data/lib/jekyll-file-protocol/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb0e572a1078b3b5436abd0809aee6e4b62df780
|
4
|
+
data.tar.gz: d0311c4bdb469ec445a5258409e50c6b60e31bbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a785f5cceef4cda6be7e45bc4887ed0a974cf9f58a7e5a4de758a33111f97b51622c300ccbeb0e579e01b4cdb2825f9d37c5d54fb4ae27b2d99cf4f4ceac8779
|
7
|
+
data.tar.gz: fefdc757f6f87c76dc2db442b64b4bda034d57cf1b9ce2dfb6a749e95e2087f1480f968ada03b13079f3cfee59a8c42cd62b605ff9773754c0a8434dd2cb6034
|
data/README.md
CHANGED
@@ -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
|
-
|
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
|