Return URL string of Atom link element under parent element. Link with no rel attribute is
considered to be rel="alternate"

@param parent Consider only children of this parent element
@param rel Consider only links with this relationship
550
private String findAtomLink(final Element parent, final String rel) {
        String ret = null;
        final List<Element> linksList = parent.getChildren("link", ATOM_10_NS);
        if (linksList != null) {
            for (final Element element : linksList) {
                final Element link = element;
                final Attribute relAtt = getAttribute(link, "rel");
                final Attribute hrefAtt = getAttribute(link, "href");
                if (relAtt == null && "alternate".equals(rel) || relAtt != null && relAtt.getValue().equals(rel)) {
                    ret = hrefAtt.getValue();
                    break;
                }
            }
        }
        return ret;
    }
63368
private Links createLinksFrom(Object parseResult, LinkRelation rel) {

		if (JSONArray.class.isInstance(parseResult)) {

			JSONArray jsonArray = (JSONArray) parseResult;

			return jsonArray.stream() //
					.flatMap(it -> JSONArray.class.isInstance(it) ? ((JSONArray) it).stream() : Stream.of(it)) //
					.map(it -> extractLink(it, rel)) //
					.collect(Collectors.collectingAndThen(Collectors.toList(), Links::of));
		}

		return Links.of(Map.class.isInstance(parseResult) //
				? extractLink(parseResult, rel) //
				: new Link(parseResult.toString(), rel));
	}
853502
protected Link extractLink(Object element, LinkRelation rel) {
		return new Link(element.toString(), rel);
	}
292
function link(node, href) {
  var self = this
  var value = 'children' in node ? self.all(node).join('') : node.alt
  var url = escape(typeof href === 'string' ? href : node.url || '')
  var head

  if (url && url.slice(0, mailto.length) === mailto) {
    url = url.slice(mailto.length)
  }

  head = url.charAt(0) === '#' && self.headings[url.slice(1)]

  if (head) {
    url = '(' + escape(toString(head)) + ')'
  } else {
    if (value && escape(url) === value) {
      value = ''
    }

    if (url) {
      url = '\\(la' + escape(url) + '\\(ra'
    }
  }

  if (value) {
    value = bold.call(self, value)

    if (url) {
      value += ' '
    }
  }

  return value + (url ? italic.call(self, url) : '')
}
645569
public String linkRel() {
		if (this.linkRel!=null) return this.linkRel;
		
		if (node.hasAttribute("rel")) return node.getAttribute("rel");
		
		//else 
		return node.getName();
	}
1262992
def child_url_record(self, url: str, inline: bool=False,
                         link_type: Optional[LinkType]=None,
                         post_data: Optional[str]=None,
                         level: Optional[int]=None):
        '''
        '''
        url_record = URLRecord()
        url_record.url = url
        url_record.status = Status.todo
        url_record.try_count = 0
        url_record.level = self.url_record.level + 1 if level is None else level
        url_record.root_url = self.url_record.root_url or self.url_record.url
        url_record.parent_url = self.url_record.url
        url_record.inline_level = (self.url_record.inline_level or 0) + 1 if inline else 0
        url_record.link_type = link_type
        url_record.post_data = post_data

        return url_record
146800
def link_href(self, rel):
        """"""
        link = self.link(rel)
        if (link is not None):
            link = link['href']
        return(link)
418383
public function addLink(string $rel, $uri): Link
    {
        return $this->links->add($rel, $uri);
    }
910957
def linkHasRel(link_attrs, target_rel):
    """"""
    # XXX: TESTME
    rel_attr = link_attrs.get('rel')
    return rel_attr and relMatches(rel_attr, target_rel)
598242
function(element) {
		//We reached the top, no link found.
		if(element === document || !element) {
			return false;
		}

		//Yay, it's a link!
		if(element.tagName.toUpperCase() === 'A') {
			return element;
		}

		//Maybe the parent is a link.
		return findParentLink(element.parentNode);
	}
471980
def _get_link(element: Element) -> Optional[str]:
    
    link = get_text(element, 'link')
    if link is not None:
        return link

    guid = get_child(element, 'guid')
    if guid is not None and guid.attrib.get('isPermaLink') == 'true':
        return get_text(element, 'guid')

    return None
195483
function getRelativeServerUrl(sUrl) {
	oLinkElement.href = sUrl;
	return URI.parse(oLinkElement.href).path;
}
1122197
function(rel, href, mimetype) {
            if (_.isObject(rel)) {
                _.each(rel, function(value, name) {
                    this.link(name, value);
                }, this);
                return;
            }

            var mt =  this.$('link[rel="'+rel+'"]');
            if (mt.length === 0) {
                mt =  $("<link>", {}).attr("rel", rel).appendTo(this.$el);
            }
            if (mimetype != null) mt.attr("type", mimetype);
            if (href != null) {
                mt.attr('href', href);
            } else {
                return mt.attr('href');
            }
        }
442229
def link_with_parents(self, parent, c_selectors, c_rules):
        
        parent_found = None
        for p_selectors, p_rules in self.parts.items():
            _p_selectors, _, _ = p_selectors.partition(' extends ')
            _p_selectors = _p_selectors.split(',')

            new_selectors = set()
            found = False

            # Finds all the parent selectors and parent selectors with another
            # bind selectors behind. For example, if `.specialClass extends
            # .baseClass`,
            # and there is a `.baseClass` selector, the extension should create
            # `.specialClass` for that rule, but if there's also a `.baseClass
            # a`
            # it also should create `.specialClass a`
            for p_selector in _p_selectors:
                if parent in p_selector:
                    # get the new child selector to add (same as the parent
                    # selector but with the child name)
                    # since selectors can be together, separated with # or .
                    # (i.e. something.parent) check that too:
                    for c_selector in c_selectors.split(','):
                        # Get whatever is different between the two selectors:
                        _c_selector, _parent = c_selector, parent
                        lcp = self.longest_common_prefix(_c_selector, _parent)
                        if lcp:
                            _c_selector = _c_selector[lcp:]
                            _parent = _parent[lcp:]
                        lcs = self.longest_common_suffix(_c_selector, _parent)
                        if lcs:
                            _c_selector = _c_selector[:-lcs]
                            _parent = _parent[:-lcs]
                        if _c_selector and _parent:
                            # Get the new selectors:
                            prev_symbol = '(?<![#.:])' if _parent[
                                0] in ('#', '.', ':') else r'(?<![-\w#.:])'
                            post_symbol = r'(?![-\w])'
                            new_parent = re.sub(prev_symbol + _parent +
                                                post_symbol, _c_selector, p_selector)
                            if p_selector != new_parent:
                                new_selectors.add(new_parent)
                                found = True

            if found:
                # add parent:
                parent_found = parent_found or []
                parent_found.extend(p_rules)

            if new_selectors:
                new_selectors = self.normalize_selectors(
                    p_selectors, new_selectors)
                # rename node:
                if new_selectors != p_selectors:
                    del self.parts[p_selectors]
                    self.parts.setdefault(new_selectors, [])
                    self.parts[new_selectors].extend(p_rules)

                deps = set()
                # save child dependencies:
                for c_rule in c_rules or []:
                    c_rule[SELECTORS] = c_selectors  # re-set the SELECTORS for the rules
                    deps.add(c_rule[POSITION])

                for p_rule in p_rules:
                    p_rule[SELECTORS] = new_selectors  # re-set the SELECTORS for the rules
                    p_rule[DEPS].update(
                        deps)  # position is the "index" of the object

        return parent_found
783680
public function getPageLinkWrapper($url, $page, $rel = null)
    {
        $rel = is_null($rel) ? '' : ' rel="'.$rel.'"';
        $class = Config::get('pagination::scroll.infinite_more_link_class');

        return '<li><a class='.$class.' href="'.$url.'"'.$rel.'>'.$page.'</a></li>';
    }
1325939
private static String extractRelativeUrl(String resURI, String parentUri) {

        if (Strings.isNullOrEmpty(parentUri)) {
            if (resURI.isEmpty()) {
                return "/";
            }
            return resURI;
        }

        String url;

        //Get the relative part of the url
        String root = parentUri;
        if (!root.endsWith("/")) {
            root += "/";
        }

        if (!resURI.startsWith(root)) {
            url = resURI;
        } else {
            url = resURI.substring(parentUri.length(), resURI.length());
        }

        if (url.isEmpty()) {
            return "/";
        }

        return url;
    }
1318749
private Link getAnchorLink(Element element) {
    SyntheticLinkResource resource = new SyntheticLinkResource(resourceResolver);
    ValueMap resourceProps = resource.getValueMap();

    // get link metadata from data element
    boolean foundMetadata = getAnchorMetadataFromData(resourceProps, element);
    if (!foundMetadata) {
      // support for legacy metadata stored in single "data" attribute
      foundMetadata = getAnchorLegacyMetadataFromSingleData(resourceProps, element);
      if (!foundMetadata) {
        // support for legacy metadata stored in rel attribute
        getAnchorLegacyMetadataFromRel(resourceProps, element);
      }
    }

    // build anchor via linkhandler
    return linkHandler.get(resource).build();
  }