lib/jekyll-bits/picture.rb in jekyll-bits-0.8 vs lib/jekyll-bits/picture.rb in jekyll-bits-0.9
- old
+ new
@@ -22,10 +22,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
require 'digest/md5'
require 'liquid'
+require 'uri'
# Jekyll module
module Jekyll
# All our custom filters
module JbFilters
@@ -76,10 +77,15 @@
uri = yaml['src'] if yaml['src']
else
uri = yaml
end
end
- uri
+ uri = URI.parse(uri)
+ unless %w(http https).include?(uri.scheme)
+ home = Jekyll.configuration({})['url']
+ uri = home.gsub(%r{/$}, '') + uri unless home.nil?
+ end
+ uri.to_s
end
end
# Box for testing and calling static methods.
class JbBox