Sha256: ca9f6607b855634a4a0ff4f308ea4ddd882c8def44e34818fa004df529aa91b7
Contents?: true
Size: 618 Bytes
Versions: 2
Compression:
Stored size: 618 Bytes
Contents
require "erb" module Octopress module UrlHelpers include ERB::Util def page_url(context) url = (context['post'] || context['page'])['url'] prepend_url(url, context['site']['url']) end def encode_url(input) url_encode input end # Prepend a local url with a file path # remote urls and urls beginning with ! will be ignored def prepend_url(input, path='') path += '/' unless path.match /\/$/ if input.match /^!/ input.gsub(/^(!)(.+)/, '\2') else input.gsub(/^(\/)?([^:]+?)$/, "#{path}"+'\2') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
octopress-3.0.0.alpha2 | lib/octopress/liquid_helpers/url.rb |
octopress-3.0.0.alpha1 | lib/octopress/liquid_helpers/url.rb |