@func link(token, base)

Create a toc link.

@param token The lexer token.
@param base A base url to prefix to the href.

@return The token text wrapped in a link.
333061
function link(token, meta) {
  var text = token.text;
  if(!meta.base || !meta.hash) return anchor(
    text, '#' + gfm(text) + (token.suffix || ''));
  var href = hash(token, base);
  return anchor(text, href);
}
686182
public CoreLabel makeToken(String tokenText, int begin, int length) {
    return makeToken(tokenText, tokenText, begin, length);
  }
1224017
def base_link(rel, self_rel=False):
    """"""
    link = _BASE_LINKS[rel].copy()
    link['rel'] = 'self' if self_rel else rel
    return link
810246
func (c ConstantInt) Link(scope Scope, t TypeSpec) (ConstantValue, error) {
	rt := RootTypeSpec(t)
	switch spec := rt.(type) {
	case *I8Spec, *I16Spec, *I32Spec, *I64Spec:
		// TODO bounds checks?
		return c, nil
	case *DoubleSpec:
		return ConstantDouble(float64(c)).Link(scope, t)
	case *BoolSpec:
		switch v := int64(c); v {
		case 0, 1:
			return ConstantBool(v == 1).Link(scope, t)
		default:
			return nil, constantValueCastError{
				Value:  c,
				Type:   t,
				Reason: errors.New("the value must be 0 or 1"),
			}
		}
	case *EnumSpec:
		for _, item := range spec.Items {
			if item.Value == int32(c) {
				return EnumItemReference{Enum: spec, Item: &item}, nil
			}
		}

		return nil, constantValueCastError{
			Value: c,
			Type:  t,
			Reason: fmt.Errorf(
				"%v is not a valid value for enum %q", int32(c), spec.ThriftName()),
		}
	}

	return nil, constantValueCastError{Value: c, Type: t}
	// TODO: AST for constants will need to track positions for us to
	// include them in the error messages.
}
108606
private static URI createBare(final URI link) {
        final URI uri;
        if (link.getRawQuery() == null && link.getRawFragment() == null) {
            uri = link;
        } else {
            final String href = link.toString();
            final int idx;
            if (link.getRawQuery() == null) {
                idx = href.indexOf('#');
            } else {
                idx = href.indexOf('?');
            }
            uri = URI.create(href.substring(0, idx));
        }
        return uri;
    }
11258
func (c ConstantBool) Link(scope Scope, t TypeSpec) (ConstantValue, error) {
	if _, ok := RootTypeSpec(t).(*BoolSpec); !ok {
		return nil, constantValueCastError{Value: c, Type: t}
	}
	return c, nil
}
1242943
public Token createToken(Token token) throws BaseException {
		
		logger.debug("Enter TokenService::createToken");

		// prepare API url
		String apiUrl = requestContext.getBaseUrl() + "tokens";
		logger.info("apiUrl - " + apiUrl);

		// assign TypeReference for deserialization
		TypeReference<Token> typeReference = new TypeReference<Token>() {
		};

		// prepare service request
		Request request = new Request.RequestBuilder(MethodType.POST, apiUrl).ignoreAuthHeader(true)
				.requestObject(token).typeReference(typeReference).context(requestContext).build();

		// make API call
		Response response = sendRequest(request);
		// retrieve response
		Token tokenResponse = (Token) response.getResponseObject();

		// set additional attributes
		prepareResponse(request, response, tokenResponse);
		return tokenResponse;
	}
993108
public static Link create(final String text, final String ref) {
		return new Link(text, null, '#'+ref);
	}
582371
public Content getDocLink(LinkInfoImpl.Kind context, MemberDoc doc, String label) {
        return getDocLink(context, doc.containingClass(), doc,
                new StringContent(label));
    }
775875
public final Page setBase(String target, String href)
    {
        base="<base " +
            ((target!=null)?("TARGET=\""+target+"\""):"") +
            ((href!=null)?("HREF=\""+href+"\""):"") +
            ">";
        return this;
    }
541671
public static Link parseMessageDestinationLink(String origin, String link) {
        return parse(origin, link, false);
    }
791256
private boolean isSymlink(File base, String path) {
        return isSymlink(base, SelectorUtils.tokenizePath(path));
    }
1290464
func (l *ListSpec) Link(scope Scope) (TypeSpec, error) {
	if l.linked() {
		return l, nil
	}

	var err error
	l.ValueSpec, err = l.ValueSpec.Link(scope)
	return l, err
}
1350485
func (c ConstReference) Link(scope Scope, t TypeSpec) (ConstantValue, error) {
	if t == c.Target.Type {
		return c, nil
	}
	return c.Target.Value.Link(scope, t)
}
927873
function _default(base, link) {
  // Dynamic stuff:
  if (typeof link !== "string" || link.match(REGEX_DYNAMIC)) {
    return base;
  } // Link is absolute:


  if (link.match(REGEX_ABSOLUTE)) {
    try {
      const parsedBase = parseLink(base);
      const parsedLink = parseLink(link); // Both `base` and `link` are on different domains:

      if (parsedBase.domain !== parsedLink.domain) {
        return false;
      } // Absolute path from same domain:


      if (parsedLink.path) {
        return (0, _url.resolve)(base, parsedLink.path);
      } // Same domains without path:


      return (0, _url.parse)(base).href;
    } catch (err) {
      return false;
    }
  } // Relative stuff:


  return regenerateLink(base, link);
}
117867
public void addContent(DroolsToken token) {
        if (startOffset == -1) {
            startOffset = token.getStartIndex();
        }
        endOffset = token.getStopIndex();
        this.content.add(token);
    }
456192
func (r typeSpecReference) Link(scope Scope) (TypeSpec, error) {
	src := ast.TypeReference(r)
	t, err := scope.LookupType(src.Name)
	if err == nil {
		return t.Link(scope)
	}

	mname, iname := splitInclude(src.Name)
	if len(mname) == 0 {
		return nil, referenceError{
			Target:    src.Name,
			Line:      src.Line,
			ScopeName: scope.GetName(),
			Reason:    err,
		}
	}

	includedScope, err := getIncludedScope(scope, mname)
	if err != nil {
		return nil, referenceError{
			Target:    src.Name,
			Line:      src.Line,
			ScopeName: scope.GetName(),
			Reason:    err,
		}
	}

	t, err = typeSpecReference{Name: iname}.Link(includedScope)
	if err != nil {
		return nil, referenceError{
			Target:    src.Name,
			Line:      src.Line,
			ScopeName: scope.GetName(),
			Reason:    err,
		}
	}

	return t, nil
}