コード例 #1
0
ファイル: ApiTocRenderer.cs プロジェクト: kusma/fuse-docs
        public async Task <ApiTocRenderingResult> RenderAsync(ApiReferenceId id,
                                                              ApiReferenceUri uri,
                                                              ApiReferenceTitle title,
                                                              ApiReferenceFlags flags,
                                                              ApiReferenceReturns returns,
                                                              ApiReferenceComment comment,
                                                              Dictionary <string, ApiReferenceEntity> entityCache,
                                                              string currentPath,
                                                              bool isAdvanced)
        {
            var state = new RenderingState(new StringBuilder(), id, uri, title, flags, returns, comment, entityCache, currentPath);

            var cssClasses = new List <string> {
                "table-of-contents-item"
            };

            if (isAdvanced)
            {
                cssClasses.Add("is-advanced");
            }

            state.AppendString($"<article class=\"{string.Join(" ", cssClasses)}\">");
            WriteType(state);
            WriteLink(state);
            await WriteCommentAsync(state);

            state.AppendString($"</article>");

            return(new ApiTocRenderingResult(state.Builder.ToString(), state.DeferredMarkdownIds, state.NumberOfCommentLines));
        }
コード例 #2
0
ファイル: ApiTocRenderer.cs プロジェクト: kusma/fuse-docs
 public RenderingState(StringBuilder builder,
                       ApiReferenceId id,
                       ApiReferenceUri uri,
                       ApiReferenceTitle title,
                       ApiReferenceFlags flags,
                       ApiReferenceReturns returns,
                       ApiReferenceComment comment,
                       Dictionary <string, ApiReferenceEntity> entityCache,
                       string currentPath)
 {
     Builder     = builder;
     Id          = id;
     Uri         = uri;
     Title       = title;
     Flags       = flags;
     Returns     = returns;
     Comment     = comment;
     EntityCache = entityCache;
     CurrentPath = currentPath;
 }