Absolute URL to the HTTP(S) rendered/served representation of this resource
7488
def http_url
      return if is_a?(Jekyll::Collection) || is_a?(JekyllAdmin::DataFile)
      return if is_a?(Jekyll::Document) && !collection.write?
      @http_url ||= Addressable::URI.new(
        :scheme => scheme, :host => host, :port => port,
        :path => path_with_base(JekyllAdmin.site.config["baseurl"], url)
      ).normalize.to_s
    end
456393
def renderLink(self, relpath=""):
        
        # return from cache if available
        cachekey, html = self.checkCache('Link', relpath)
        if html is not None:
            return html
        # else regenerate
        html = CachingRenderer.renderLink(self, relpath)
        if self.headerfile is not None:
            html += """ (<A HREF="%s">header</A>)""" % quote_url(relpath + self.headerfile)
        # save to cache
        return self.writeCache(cachekey, html)
786437
def get_api_url(server):
    
    parsed = urlparse(server)
    base_url = parsed.netloc if parsed.netloc else parsed.path
    base_url.replace('/', '')
    return 'https://' + base_url + '/apiv1'
1173739
def absolute_uri(path)
      if path.match(/^https?:\/{2}/)
        path
      else
        (request.base_url.chomp("/") + path).chomp("/")
      end
    end
615159
def _url(endpoint: str, sandbox: bool=False) -> str:
    """"""
    if sandbox is True:
        url = BASE_URL_SANDBOX
    else:
        url = BASE_URL
    return "{0}{1}".format(url, endpoint)
93770
def absolute_uri(self, location=None, scheme=None, **query):
        
        if not is_absolute_uri(location):
            if location or location is None:
                location = self.full_path(location, **query)
            if not scheme:
                scheme = self.is_secure and 'https' or 'http'
            base = '%s://%s' % (scheme, self.get_host())
            return '%s%s' % (base, location)
        elif not scheme:
            return iri_to_uri(location)
        else:
            raise ValueError('Absolute location with scheme not valid')
1230720
def _url(self, uri):
        """"""
        prefix = "{}://{}{}".format(
            self._protocol,
            self.real_connection.host,
            self._port_postfix(),
        )
        return uri.replace(prefix, '', 1)
1296660
def main_page(request):
    
    p = get_object_or_404(Page, slug='main', active=True)
    return render(request, p.tpl, get_page_tpl_ctx(p, request))
1312292
def as_url(self):
        '''
        
        '''
        if '' in self._scope:
            return self._finalize().as_url

        if not self._is_endpoint:
            raise UrlBuildingError('Not an endpoint {}'.format(repr(self)))

        if self._ready:
            path, host = self._path, self._host
        else:
            return self().as_url

        # XXX there is a little mess with `domain` and `host` terms
        if ':' in host:
            domain, port = host.split(':')
        else:
            domain = host
            port = None

        if self._bound_env:
            request = self._bound_env.request
            scheme_port = {'http': '80',
                           'https': '443'}.get(request.scheme, '80')

            # Domain to compare with the result of build.
            # If both values are equal, domain part can be hidden from result.
            # Take it from route_state, not from env.request, because
            # route_state contains domain values with aliased replaced by their
            # primary value
            primary_domain = self._bound_env._route_state.primary_domain
            host_split = request.host.split(':')
            request_domain = host_split[0]
            request_port = host_split[1] if len(host_split) > 1 else scheme_port
            port = port or request_port

            return URL(path, host=domain or request_domain,
                       port=port if port != scheme_port else None,
                       scheme=request.scheme, fragment=self._fragment,
                       show_host=host and (domain != primary_domain \
                                           or port != request_port))
        return URL(path, host=domain, port=port,
                   fragment=self._fragment, show_host=True)
249155
def construct_url(self, style):
        
        if style is API_URL:
            if self._ssl:
                return 'https://{}:{}'.format(self._host, self._port)
            else:
                return 'http://{}:{}'.format(self._host, self._port)
        elif style is SOCKET_URL:
            if self._ssl:
                return 'wss://{}:{}'.format(self._host, self._port)
            else:
                return 'ws://{}:{}'.format(self._host, self._port)
        else:
            return None
1143134
def absolute(parser, token):
    '''
    
    '''
    node = url(parser, token)
    return AbsoluteUrlNode(
        view_name=node.view_name,
        args=node.args,
        kwargs=node.kwargs,
        asvar=node.asvar
    )
691156
def _build_url(self, endpoint):
        
        try:
            path = self.endpoints[endpoint]
        except KeyError:
            msg = 'Unknown endpoint `{0}`'
            raise ValueError(msg.format(endpoint))
        absolute_url = urljoin(self.target, path)
        return absolute_url
1234385
def get_absolute_url(self):
        
        try:
            node = Node.objects.select_related().filter(page=self)[0]
            return node.get_absolute_url()
        except Exception, e:
            raise ValueError(u"Error in {0}.{1}: {2}".format(self.__module__, self.__class__.__name__, e))
            return u""
1205206
def base_url(self):
        """"""
        if self.location in self.known_locations:
            return self.known_locations[self.location]
        elif '.' in self.location or self.location == 'localhost':
            return 'https://' + self.location
        else:
            return 'https://' + self.location + API_HOST_SUFFIX
96578
def getClientURL(self):
        
        request = self.getRequest()
        if request:
            client = request.getClient()
            if client:
                return client.absolute_url_path()
278949
def resource_uri(self):
        
        primary_key_value = getattr(self, self.primary_key(), None)
        return '/{}/{}'.format(self.endpoint(), primary_key_value)
731728
def absolute_urls(html):
    

    from bs4 import BeautifulSoup
    from yacms.core.request import current_request

    request = current_request()
    if request is not None:
        dom = BeautifulSoup(html, "html.parser")
        for tag, attr in ABSOLUTE_URL_TAGS.items():
            for node in dom.findAll(tag):
                url = node.get(attr, "")
                if url:
                    node[attr] = request.build_absolute_uri(url)
        html = str(dom)
    return html