INTERNAL: Searches the list of SEO Friendly defined substitutions for
 the corresponding to the given path

 @param [String] The path we want the substitution for.
 @returns [String] The SEO Friendly Slugh for the required path.
190788
def friendly(path)
      @all_friendly ||= Hash[*RailsFriendlyUrls::Manager.urls.map { |f_url| [f_url.path, f_url.slug] }.flatten]
      @all_friendly[path] || path
    end
541323
def route
      # Sanitize the URI:
      # * Unescape escaped characters
      # * Replace runs of / with a single /
      path_info = Rack::Utils.unescape(request.path_info).gsub(%r{/+}, '/')

      ROUTES.each do |path_matcher, verb, handler|
        path_info.match(path_matcher) do |match|
          @repository_uri = match[1]
          @request_verb = verb

          return method_not_allowed unless verb == request.request_method
          return bad_request if bad_uri?(@repository_uri)

          git.repository_path = root + @repository_uri
          return not_found unless git.exist?

          return send(handler, *match[2..-1])
        end
      end
      not_found
    end
591450
def find_chapter(slug)
      chapters.find { |c| c.slug.to_s == slug.to_s }
    end
423158
def get(path, headers: {}, query: {})
      @parent.get("/#{@segment}/#{path}".gsub(%r{/+}, '/'),
                  headers: @default_headers.merge(headers), query: query)
    end
859547
def translate_path(self, path):
        
        # abandon query parameters
        path = path.split('?', 1)[0]
        path = path.split('#', 1)[0]
        # Don't forget explicit trailing slash when normalizing. Issue17324
        trailing_slash = path.rstrip().endswith('/')
        path = posixpath.normpath(urllib.unquote(path))
        # remove url_prefix
        #print "PATH 1: ", path, self._url_prefix
        path = path.replace(self._url_prefix, '/', 1)
        #print "PATH 2: ", path
        words = path.split('/')
        words = filter(None, words)
        # This the new way to NOT only work in CWD
        path = self._root
        for word in words:
            if os.path.dirname(word) or word in (os.curdir, os.pardir):
                # Ignore components that are not a simple file/directory name
                continue
            path = os.path.join(path, word)
        if trailing_slash:
            path += '/'
        #print "PATH: ", path
        #print "URL_PREFIX", self._url_prefix
        #print "PREFIX", self.prefix
        return path
967717
def build_query(path, details)
        query = @pattern.dup

        prefix = path.prefix.empty? ? "" : "#{escape_entry(path.prefix)}\\1"
        query.gsub!(/:prefix(\/)?/, prefix)

        partial = escape_entry(path.partial? ? "_#{path.name}" : path.name)
        query.gsub!(/:action/, partial)

        details.each do |ext, candidates|
          if ext == :variants && candidates == :any
            query.gsub!(/:#{ext}/, "*")
          else
            query.gsub!(/:#{ext}/, "{#{candidates.compact.uniq.join(',')}}")
          end
        end

        File.expand_path(query, @path)
      end
512055
function url_for(path) {
  path = urljoin([agneta.root, path]);

  if (path[0] != '/') {
    path = '/' + path;
  }

  return path;
}
1231593
def url_to_params(*args)
      if args.size < 2
        path = args[0]
        method = :client
      else
        path = args[1]
        method = args[0].to_sym
      end

      # First try a direct match
      result = @direct_routes[method][path]
      return result if result

      # Next, split the url and walk the sections
      parts = url_parts(path)

      match_path(parts, parts, @indirect_routes[method])
    end
779612
def url_for(options={})
      if templated?
        template = Addressable::Template.new(base_path)
        template = template.expand(options)
        template.to_s
      else
        base_path
      end
    end
766051
def url_path_replace(url, old, new, count=None):
    
    args = []
    scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
    if count is not None:
        args.append(count)
    return urlparse.urlunsplit((
        scheme, netloc, path.replace(old, new, *args), query, fragment))
896120
def url_path
      path = if self.path.include?('/')
               self.path.sub(/\/[^\/]+$/, '/')
             else
               ''
             end

      path << Page.cname(self.name, '-', '-')
      path
    end
624029
def find(uri)
      _try_variations_of(uri) do |path|
        content= get path
        return [content] unless content.nil?
      end unless uri.nil?
      []
    end
286972
def prepend_path(path)
      self.config = hash_reassoc(config, :paths) do |paths|
        path = File.expand_path(path, config[:root]).freeze
        paths.unshift(path)
      end
    end
803641
def uri_join(*paths)
      return nil if paths.length == 0
      leadingslash = paths[0][0] == '/' ? '/' : ''
      trailingslash = paths[-1][-1] == '/' ? '/' : ''
      paths.map! { |path| path.sub(/^\/+/, '').sub(/\/+$/, '') }
      leadingslash + paths.join('/') + trailingslash
    end
254983
def normalize(path, extra=nil, params={})
      if extra.is_a?(Hash) and params.empty?
        params = extra
        extra = nil
      end

      path = "#{path}/#{extra}" if extra
      path = "/#{path}" unless path[0] == '/'

      query = default_query.merge params

      params[:query] = query unless query.empty?
      params = default_params.merge params

      [path, extra, params]
    end
196763
def subs(self, path):
        
        #print_v('Checking for: \n  %s, \n  %s \n  in %s'%(self.substitutes,self.init_substitutes,path))
        if type(path) == int or type(path) == float:
            return path
        for s in self.init_substitutes:
            if path.startswith(s):
                path = path.replace(s,self.init_substitutes[s], 1)
        #print_v('  So far: %s'%path)
        for s in self.substitutes:
            if s in path:
                path = path.replace(s,self.substitutes[s])
        #print_v('  Returning: %s'%path)
        return path
572408
def virtual_path(path, partial)
      return path unless partial
      if index = path.rindex("/")
        path.insert(index + 1, "_")
      else
        "_#{path}"
      end
    end