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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c03a48072acdfaa98fc2e5df1a3762bcdf35e40
4
- data.tar.gz: 5d4a041d2041a0d07fe96d63a63af55c9c0e6582
3
+ metadata.gz: 2002356620eb54fcc5b5ca13a69e33d42c72c0ee
4
+ data.tar.gz: b6b85128aee57ca486cace37c545952e562a8a83
5
5
  SHA512:
6
- metadata.gz: 71dd711640a5c418a61b37693be4aa5b8c5799d79c1b1500dc1bc5c324337ad87de3d0585a62df87b08dd73f29485103226b4f776bdec440ab53accca5dc60a9
7
- data.tar.gz: 93532fdce07a3ae9e072b7aa002b3dd6168468d6b95abdea56352e66db7845310b560610ff0d40a344454056cb830b0c6af67cc8e08a6130aa53334ca8640782
6
+ metadata.gz: 7de67e476e900952f27cdd7c7d640f85ffcd11e2e1b73c14b811145fc781b7f7cd1e5195ea30e28d491bba3820e21b09aa4a67a2c8ec48d562f09e1576d8a0e8
7
+ data.tar.gz: 2f2c54300ebdf183a7cab6a10963000b2bfc130815697c7994548bd9a450c9ac64403bacb3c7d4679081da12641930c4c54ff0d6d9ea2443b272551c97c24662
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.2.3 - 2015-01-23
4
+
5
+ - Full urls will end with trailing slashes when appropriate
6
+
3
7
  ### 1.2.2 - 2015-01-23
4
8
 
5
9
  - Added support for baseurl
@@ -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 =~ /^#{url}/
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
- # If url has a file.extension
109
- if url =~ /\.\w+$/
110
- url
111
- else
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
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Filters
3
- VERSION = "1.2.2"
3
+ VERSION = "1.2.3"
4
4
  end
5
5
  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.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-23 00:00:00.000000000 Z
11
+ date: 2015-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll