public IEncodedString Link(PropertyReference property) { var signature = property.GetPropertySignature(_context.UrlResolver); var builder = new EncodedStringBuilder(); builder.AppendRaw(@"<a href=""{0}"">", _context.UrlResolver.GetUrl(signature.Identity)); builder.AppendEncoded(signature.Name); builder.AppendRaw("</a>"); return(builder.ForceRaw()); }
public IEncodedString Link(DocumentedNamespace @namespace) { var builder = new EncodedStringBuilder(); var url = _context.UrlResolver.GetUrl(@namespace.Identity); builder.AppendRaw(@"<a href=""{0}"">", url); builder.AppendEncoded(@namespace.Identity); builder.AppendRaw("</a>"); return(builder.ToRaw()); }
public string Render( ILanguageProvider language, TypeSignature signature, TypeRenderOption options) { var builder = new EncodedStringBuilder(); Render(builder, language, signature, options, false); return(builder.ToString()); }
public string Render(ApiContext context, Comment comment) { if (comment == null) { return(string.Empty); } var builder = new EncodedStringBuilder(); comment.Accept(this, new CommentRendererContext(context, builder)); return(builder.ToString()); }
public CommentRendererContext(ApiContext apiContext, EncodedStringBuilder builder) { _apiContext = apiContext; _builder = builder; }
private void Render( EncodedStringBuilder builder, ILanguageProvider language, TypeSignature signature, TypeRenderOption options, bool isWritingLink) { var needToCloseLink = false; var documentedType = _model.FindType(signature.Identity); // Writing link? if ((options & TypeRenderOption.Link) == TypeRenderOption.Link) { if (!isWritingLink && documentedType != null) { if (signature.Url != null) { isWritingLink = needToCloseLink = true; builder.AppendRaw("<a href=\"{0}\">", signature.Url); } } } // Write type namespace? if ((options & TypeRenderOption.Namespace) == TypeRenderOption.Namespace) { builder.AppendEncoded(signature.Namespace.Name); if ((options & TypeRenderOption.Namespace) == TypeRenderOption.Namespace) { builder.AppendEncoded("."); } } // Write type name? if ((options & TypeRenderOption.Name) == TypeRenderOption.Name) { var alias = language.GetAlias(signature.Identity); var name = alias ?? signature.Name; builder.AppendEncoded(name); } if (signature.GenericArguments.Count != 0) { // Write generic arguments. builder.AppendEncoded("<"); var result = new List <string>(); foreach (var argument in signature.GenericArguments) { result.Add(argument); } builder.AppendEncoded(string.Join(", ", result)); builder.AppendEncoded(">"); } else if (signature.GenericParameters.Count != 0) { // Write generic parameters. builder.AppendEncoded("<"); var result = new List <string>(); foreach (var parameter in signature.GenericParameters) { Render(builder, language, parameter, options, isWritingLink); } builder.AppendEncoded(string.Join(", ", result)); builder.AppendEncoded(">"); } // Writing link? if ((options & TypeRenderOption.Link) == TypeRenderOption.Link) { if (needToCloseLink) { builder.AppendRaw("</a>"); } } }