octopress-filters 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/octopress-filters.rb +11 -10
- data/lib/octopress-filters/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2002356620eb54fcc5b5ca13a69e33d42c72c0ee
|
4
|
+
data.tar.gz: b6b85128aee57ca486cace37c545952e562a8a83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7de67e476e900952f27cdd7c7d640f85ffcd11e2e1b73c14b811145fc781b7f7cd1e5195ea30e28d491bba3820e21b09aa4a67a2c8ec48d562f09e1576d8a0e8
|
7
|
+
data.tar.gz: 2f2c54300ebdf183a7cab6a10963000b2bfc130815697c7994548bd9a450c9ac64403bacb3c7d4679081da12641930c4c54ff0d6d9ea2443b272551c97c24662
|
data/CHANGELOG.md
CHANGED
data/lib/octopress-filters.rb
CHANGED
@@ -62,8 +62,8 @@ module Octopress
|
|
62
62
|
input.sub(/\s+(\S+)\s*$/, ' \1')
|
63
63
|
end
|
64
64
|
|
65
|
-
# Convert url input into a standard canonical url
|
66
|
-
#
|
65
|
+
# Convert url input into a standard canonical url by expanding urls and
|
66
|
+
# removing url fragments ending with `index.[ext]`
|
67
67
|
def canonical_url(input)
|
68
68
|
full_url(input).downcase.sub(/index\.\w+$/i, '')
|
69
69
|
end
|
@@ -99,20 +99,21 @@ module Octopress
|
|
99
99
|
#
|
100
100
|
def expand_url(input, url=nil)
|
101
101
|
url ||= root
|
102
|
-
url = if input
|
102
|
+
url = if input.start_with?("http", url)
|
103
103
|
input
|
104
104
|
else
|
105
105
|
File.join(url, input)
|
106
106
|
end
|
107
107
|
|
108
|
-
#
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
# The url ends with a directory
|
108
|
+
# Ensure a trailing slash if a url:
|
109
|
+
# - is a site url, eg: http://site.com
|
110
|
+
# - or ends with a directory
|
111
|
+
if !(url =~ /\.\w+$/) || url =~ /:\/\/[^\/]+$/
|
113
112
|
# Add trailing slash if necessary
|
114
|
-
File.join(url, '/')
|
113
|
+
url = File.join(url, '/')
|
115
114
|
end
|
115
|
+
|
116
|
+
url
|
116
117
|
end
|
117
118
|
|
118
119
|
# Prepend all absolute urls with a url fragment
|
@@ -124,7 +125,7 @@ module Octopress
|
|
124
125
|
#
|
125
126
|
def expand_urls(input, url=nil)
|
126
127
|
url ||= root
|
127
|
-
input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\/>]{1}[^\"'>]*)/ do
|
128
|
+
input.gsub /(\s+(href|src|poster)\s*=\s*["|']{1})(\/[^\/>]{1}[^\"'>]*)/ do
|
128
129
|
$1 + expand_url($3, url)
|
129
130
|
end
|
130
131
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-filters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|