Generate <link /> tag.

@param {String} linkTpl - template to use for tag generation
@param {String} scheme - host scheme
@param {String} host - host name
@param {String} path - host path
@return {String} <link /> tag
548436
function generateLinkTag(linkTpl, scheme, host, path) {
  linkTpl = linkTpl.replace('<scheme>', scheme).replace('<host>', host);
  if (path == null || path === '*') {
    return linkTpl.replace('<path>', '');
  }

  // for android we need to replace * with .* for pattern matching
  if (path.indexOf('*') >= 0) {
    path = path.replace(/\*/g, '.*');
  }

  // path should start with /
  if (path.indexOf('/') != 0) {
    path = '/' + path;
  }

  return linkTpl.replace('<path>', path);
}
650464
def link(rel, uri, attributes = {})
      headers['Link'] ||= []
      attributes = {:rel => rel}.merge(attributes)
      link = "<#{uri}>"
      attributes.each_pair { |k, v| link << "; #{k}=\"#{v}\"" }
      headers['Link'] << link
    end
1369895
function linkToSrc(shortPath, lineNumber) {
    var splitPath = shortPath.split("/");
    return '<a href="{{srcroot}}' + shortPath+'">' + splitPath[splitPath.length - 1] + '</a>, <a href="{{srcroot}}' + shortPath+'#L'+lineNumber+'">' + lineNumber + '</a>';
    
}
899606
def render_link(self, template_pack=TEMPLATE_PACK, **kwargs):
        
        link_template = self.link_template % template_pack
        return render_to_string(link_template, {'link': self})
457922
function(url, base) {
			if (!url || url.indexOf('://') !== -1) { return url; }

			var anchor = document.createElement('a');
			anchor.href = (base || location.href);

			var protocol	= anchor.protocol + '//',
				host		= anchor.host,
				path		= anchor.pathname,
				parts		= filter(path.split('/'), function(part) { return part !== ''; });

			each(url.replace(/\?.*/, '').split('/'), function(part, index) {
				switch(part) {
					case '..':
						if (!parts.length) {
							throw new Error('Path outside of root: ' + url);
						}
						parts.length--;
						break;
					case '.':	break;
					default:	parts.push(part); break
				}
			});
			return protocol + host + '/' + parts.join('/');
		}
817538
function parseLinks(target, resp) {
  target._links = parseLinkHeader(resp.headers.get('link'));
  target._linkTemplates = parseLinkHeader(resp.headers.get('link-template'));
  return resp
}
1293604
function addPath(immSet, urlObj, mode) {
    return immSet.add(
        mode === "snippet"
            ? urlObj.href
            : urlObj.path
    );
}
832962
def file_url(path = "sitemap.xml")
      if context
        file_path = File.join("/", context, path)
      else
        file_path = File.join("/", path)
      end

      URI::HTTP.build(:host => host, :path => file_path).to_s
    end
1305678
def oembed_provider_links
      host_url = request.host
      escaped_request_url = request.url.sub('://', '%3A//')
      html = tag(:link, :rel => "alternate",
                 :type => "application/json+oembed",
                 :href => "http://#{host_url}/oembed?url=#{escaped_request_url}",
                 :title => "JSON oEmbed for #{@title}")
      html += tag(:link, :rel => "alternate",
                 :type => "application/xml+oembed",
                 :href => "http://#{host_url}/oembed.xml?url=#{escaped_request_url}",
                 :title => "XML oEmbed for #{@title}")
    end
456540
def linkify(props):
    
    match = props['match']
    protocol = match.group(1)
    url = match.group(2)
    href = protocol + url

    if props['block']['type'] == BLOCK_TYPES.CODE:
        return href

    link_props = {
        'href': href,
    }

    if href.startswith('www'):
        link_props['href'] = 'http://' + href

    return DOM.create_element('a', link_props, href)
313785
def get_url(self, *paths, **params):
        
        path_stack = self._attribute_stack[:]
        if paths:
            path_stack.extend(paths)

        u = self._stack_collapser(path_stack)
        url = self._url_template % {
            "domain": self._api_url,
            "generated_url" : u,
        }

        if self._params or params:
            internal_params = self._params.copy()
            internal_params.update(params)
            url += self._generate_params(internal_params)

        return url
236003
public void createLink(HalRelation rel, String... pathParams) {
    if(pathParams != null && pathParams.length > 0 && pathParams[0] != null) {
      Set<String> linkedResourceIds = linkedResources.get(rel);
      if(linkedResourceIds == null) {
        linkedResourceIds = new HashSet<String>();
        linkedResources.put(rel, linkedResourceIds);
      }

      // Hmm... use the last id in the pathParams as linked resource id
      linkedResourceIds.add(pathParams[pathParams.length - 1]);

      resource.addLink(rel.relName, rel.uriTemplate.build((Object[])pathParams));
    }
  }
1122610
function constructHostEntry(xmlElement) {
  var host = {
      scheme: DEFAULT_SCHEME,
      name: '',
      paths: []
    };
  var hostProperties = xmlElement['$'];

  if (hostProperties == null || hostProperties.length == 0) {
    return null;
  }

  // read host name
  host.name = hostProperties.name;

  // read scheme if defined
  if (hostProperties['scheme'] != null) {
    host.scheme = hostProperties.scheme;
  }

  // construct paths list, defined for the given host
  host.paths = constructPaths(xmlElement);

  return host;
}
714985
function _link (input, options) {
  if (typeof input !== 'string') return null

  var linked, matches, namepath
  var output = {}

  /*
  test input for
  1. A type expression containing a namepath, e.g. Array.<module:Something>
  2. a namepath referencing an `id`
  3. a namepath referencing a `longname`
  */
  if ((matches = input.match(/.*?<(.*?)>/))) {
    namepath = matches[1]
  } else {
    namepath = input
  }

  options.hash = { id: namepath }
  linked = _identifier(options)
  if (!linked) {
    options.hash = { longname: namepath }
    linked = _identifier(options)
  }
  if (!linked) {
    return { name: input, url: null }
  } else {
    output.name = input.replace(namepath, linked.name)
    if (isExternal.call(linked)) {
      if (linked.description) {
        output.url = '#' + anchorName.call(linked, options)
      } else {
        if (linked.see && linked.see.length) {
          var firstLink = parseLink(linked.see[0])[0]
          output.url = firstLink ? firstLink.url : linked.see[0]
        } else {
          output.url = null
        }
      }
    } else {
      output.url = '#' + anchorName.call(linked, options)
    }
    return output
  }
}
76930
def _createLink(self, linkResult, replaceParamFile):
        
        link = None

        # Cases
        if linkResult['type'] == 'XSEC':
            # Cross section link handler
            link = self._createCrossSection(linkResult, replaceParamFile)

        elif linkResult['type'] == 'STRUCTURE':
            # Structure link handler
            link = self._createStructure(linkResult, replaceParamFile)

        elif linkResult['type'] in ('RESERVOIR', 'LAKE'):
            # Reservoir/lake handler
            link = self._createReservoir(linkResult, replaceParamFile)

        return link
45516
function linkEntity (cls, url, text) {
  return dom.create('div')
    .class(cls)
    .add(dom.create('a').attr('href', url).add(text))
}
806579
String buildUrl(String relativePath)
    {
        return String.format("%s://%s:%s%s%s", this.protocol, this.hostname, this.port, this.uriPrefix, relativePath);
    }