コード例 #1
0
ファイル: HtmlGenerator.cs プロジェクト: Dahlgren/DocForge
        /// <summary>
        /// Generate table of contents
        /// </summary>
        /// <param name="c">
        /// The class.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        private string GenerateToc(Class c)
        {
            var sb = new StringBuilder();

            var containers = c.Containers();
            containers.Reverse();

            // some code sb.AppendLine(string.Format("<img src=\"{0}\" width=\"260\"/>", "public/logo.png"));
            sb.AppendLine(string.Format("<h4><a href=\"index.html\">{0}</a></h4>", this.projectNameLiteral));
            sb.AppendLine(string.Format("<h5>Version: {0}</h5>", this.modelVersionLiteral));
            sb.AppendLine("<ul class=\"nav nav-pills nav-stacked\">");

            foreach (var modelClass in this.model.Classes)
            {
                if (modelClass != containers.First())
                {
                    sb.AppendLine(string.Format("<li>{0}</li>", modelClass.HtmlLinkToTopPage()));
                }
                else
                {
                    this.GenerateNestedToc(modelClass, containers, sb);
                }
            }

            sb.AppendLine("</ul>");

            return sb.ToString();
        }