示例#1
0
 public override void RenderControl(HtmlTextWriter writer)
 {
     using (HtmlBuilder builder = new HtmlBuilder())
     {
         using (Element el = builder.CreateElement("button"))
         {
             AddAttributes(el);
             using (Element bRight = builder.CreateElement("span"))
             {
                 bRight.AddAttribute("class", "bRight");
                 using (Element bLeft = builder.CreateElement("span"))
                 {
                     bLeft.AddAttribute("class", "bLeft");
                     using (Element bCenter = builder.CreateElement("span"))
                     {
                         bCenter.AddAttribute("class", "bCenter");
                         using (Element content = builder.CreateElement("span"))
                         {
                             content.AddAttribute("id", ClientID + "_LBL");
                             content.Write(Text);
                         }
                     }
                 }
             }
         }
         writer.Write(builder.ToString());
     }
 }
示例#2
0
        public void Write(DoxDocument dox, DoxFormattingContext outputContext)
        {
            var output = outputContext.Output;

            using (var hw = new HtmlTextWriter(output))
            {
                var html = new HtmlBuilder(hw);
                html.div().attCls("dox").att("dox:format", "sql");

                if (dox.DbElement != null)
                {
                    var context = new DatabaseContext
                    {
                        BookName = outputContext.BookName,
                        DbName = dox.DbElement.DbName
                    };

                    if (dox.DbElement.Database != null)
                        WriteDatabaseDocument(dox.DbElement.Database, html, context);

                    else if (dox.DbElement.Table != null)
                        WriteTableDocument(dox.DbElement.Table, html, context);

                    else if (dox.DbElement.View != null)
                        WriteViewDocument(dox.DbElement.View, html, context);

                    else if (dox.DbElement.StoredProcedure != null)
                        WriteStoredProcedureDocument(dox.DbElement.StoredProcedure, html, context);
                }

                html.c(); // dox div
            }
        }
 protected override void Process(Action<HtmlBuilder> callback)
 {
     _html = HtmlBuilder.New;
     _html.div.Class("content").enter();
     callback(_html);
     _html.end.enter();
 }
示例#4
0
        private void WriteViewDocument(View view, HtmlBuilder html, DatabaseContext context)
        {
            html.h1(String.Format("View: {0}", view.Name));

            html.e("table");
            html.tr().td().attCls("label").text("Database:").c().td();
            String relDoc = String.Format("{0}.{1}.{1}", context.BookName, context.DbName);
            html.internalLink(context.DbName, "db-entity-name", relDoc, view.Name);
            html.c().c();
            html.c(); //table

            RenderColumnsTable(view.Columns, html, context);
        }
        private static void RenderParametersSection(IEnumerable<StoredProcedureParameter> parameters, HtmlBuilder html)
        {
            html.div().attCls("section");

            html.h4("Parameters");
            if (parameters.Count() > 0)
            {
                html.e("ul").attCls("sp-parameters");
                foreach (var p in parameters)
                    html.e("li").text(p.Name.TrimStart('@')).c();
                html.c(); // ul
            }
            else
                html.text("This stored procedure does not receive parameters.");

            html.c(); // section
        }
        private void WriteStoredProcedureDocument(StoredProcedure sp, HtmlBuilder html, DatabaseContext context)
        {
            html.h1(String.Format("Stored Procedure: {0}", sp.Name));

            html.e("table");
            html.tr().td().attCls("label").text("Database:").c().td();
            String relDoc = String.Format("{0}.{1}.{1}", context.BookName, context.DbName);
            html.internalLink(context.DbName, "db-entity-name", relDoc, sp.Name);
            html.c().c();
            html.c(); //table

            html.h2("Parameters");
            if (sp.Parameters != null && sp.Parameters.Count > 0)
            {
                html.table(0, 0).att("width", "100%").attCls("members");
                html.dbSpParamHeader();

                foreach (var p in sp.Parameters)
                {
                    html.tr()
                        .rowHeader(false)
                        .td()
                            .attCls(p.IsOutputParameter ? "sp-parameter output" : "sp-parameter input")
                            .att("title", p.IsOutputParameter ? "output" : "input")
                            .text(p.Name.TrimStart('@'))
                        .c()
                        .td()
                            .dataType(p.DataType)
                        .c()
                    .c();
                }

                html.c(); // table
            }
            else
                html.text("This stored procedure does not receive parameters.");
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlTextWriterEx"/> class.
 /// </summary>
 /// <param name="w">The w.</param>
 public HtmlTextWriterEx(TextWriter w)
     : base(w)
 {
     _htmlBuilder = CreateHtmlBuilder(this);
 }
示例#8
0
 /// <summary>
 /// Creates the HTML builder table tag.
 /// </summary>
 /// <param name="b">The b.</param>
 /// <param name="args">The args.</param>
 /// <returns></returns>
 public virtual HtmlBuilderTableTag CreateHtmlBuilderTableTag(HtmlBuilder b, Nparams args)
 {
     return new HtmlBuilderTableTag(b, args.Get<HtmlBuilderTableTag.TableAttrib>());
 }
示例#9
0
        private void RenderExtendedSummary(CodeElement element, HtmlBuilder html, ReferenceContext referenceContext)
        {
            if (element == null || (element.Description == null && element.DescriptionTree == null))
                return;

            html.div().attCls("summary");
            html.text(element.Description);
            RenderExtendedSummary(element.DescriptionTree, html, referenceContext);
            html.c();//div
        }
示例#10
0
 private void RenderDescriptionNode(DescriptionSegment el, HtmlBuilder html, ReferenceContext referenceContext)
 {
     switch (el.Type)
     {
         case DescriptionSegmentType.Text:
             html.text(el.Text);
             break;
         case DescriptionSegmentType.SeeAlso:
         case DescriptionSegmentType.See:
             html.typeName(el.Text, el.Ref, referenceContext);
             break;
         case DescriptionSegmentType.Paragraph:
             html.p();
             html.text(el.Text);
             RenderExtendedSummary(el.Children, html, referenceContext);
             html.c();
             break;
         case DescriptionSegmentType.Bold:
             html.e("b").text(el.Text);
             RenderExtendedSummary(el.Children, html, referenceContext);
             html.c();
             break;
         case DescriptionSegmentType.Header:
             html.h4(el.Text);
             break;
         case DescriptionSegmentType.Italic:
             html.e("i").text(el.Text);
             RenderExtendedSummary(el.Children, html, referenceContext);
             html.c();
             break;
         case DescriptionSegmentType.Strong:
             html.e("strong").text(el.Text);
             RenderExtendedSummary(el.Children, html, referenceContext);
             html.c();
             break;
         case DescriptionSegmentType.Example:
             html.div().attCls("example");
             html.text(el.Text);
             RenderExtendedSummary(el.Children, html, referenceContext);
             html.c();
             break;
         case DescriptionSegmentType.Code:
             html.e("pre");
             html.text(el.Text);
             RenderExtendedSummary(el.Children, html, referenceContext);
             html.c();
             break;
         case DescriptionSegmentType.Html:
             html.text(el.Text, false);
             break;
     }
 }
示例#11
0
        public void Write(DoxDocument dox, DoxFormattingContext outputContext)
        {
            var output = outputContext.Output;
            using (var hw = new HtmlTextWriter(output))
            {
                var html = new HtmlBuilder(hw);
                html.div().attCls("dox").att("dox:format", "class");

                if (dox.Type != null)
                {
                    html.e("h1");
                    switch (dox.Type.TypeKind)
                    {
                        case TypeKind.CLASS:
                            html.text("class ");
                            break;
                        case TypeKind.ENUM:
                            html.text("enum ");
                            break;
                        case TypeKind.INTERFACE:
                            html.text("interface ");
                            break;
                        case TypeKind.STRUCT:
                            html.text("struct ");
                            break;
                        case TypeKind.DELEGATE:
                            html.text("delegate ");
                            break;
                    }

                    html.text(dox.Type.Name);
                    html.c();//h1;
                    var referenceContext = new ReferenceContext
                    {
                        BookName = outputContext.BookName,
                        Namespace = dox.Type.Namespace
                    };

                    html.e("table");
                    html.tr().td().attCls("label").text("Namespace:").c().td().text(dox.Type.Namespace).c().c();
                    html.tr().td().attCls("label").text("Base:").c().td();
                    if (dox.Type.BaseTypes != null)
                    {
                        bool first = true;
                        foreach (var bt in dox.Type.BaseTypes)
                        {
                            if (first)
                                first = false;
                            else html.text(", ");
                            html.typeName(bt, referenceContext);
                        }
                    }
                    html.c().c();
                    html.c(); //table

                    RenderExtendedSummary(dox.Type, html, referenceContext);

                    #region Fields

                    html.anchor("fields");
                    html.h2("Fields");
                    if (dox.Type.Fields == null || dox.Type.Fields.Count == 0)
                        html.text("This class has no fields.");
                    else
                    {
                        html.table(0, 0).att("width", "100%").attCls("members");
                        html.tableHeader();
                        foreach (var m in dox.Type.Fields.OrderBy(a => a.Name))
                        {
                            html.tr();//.attCls("expandable");
                            //html.td().attCls("micon").e("a").attCls("exi").att("href", "#expand").nbsp().c().c();
                            html.td().attCls("micon").nbsp().c();

                            html.td().member(m, referenceContext);
                            if (m.InitLiteral != null)
                                html.text(" = ").text(m.InitLiteral);
                            //html.div().attCls("details");
                            RenderExtendedSummary(m, html, referenceContext);
                            //html.c(); // details;
                            html.c(); //td
                            html.td().att("width", "10%").typeName(m.DeclaringType, m.DeclaringType + "-" + m.Name, referenceContext).c();
                            html.c(); //tr
                        }
                        html.c(); //table
                    }

                    #endregion Fields

                    #region Properties

                    html.e("a").attCls("properties").c();
                    html.h2("Properties");
                    if (dox.Type.Properties == null || dox.Type.Properties.Count == 0)
                        html.text("This class has no properties.");
                    else
                    {
                        html.table(0, 0).att("width", "100%").attCls("members");
                        html.tableHeader();
                        foreach (var m in dox.Type.Properties.OrderBy(a => a.Name))
                        {
                            html.tr();

                            if (m.Parameters != null) //indexers
                            {
                                html.attCls("expandable");
                                html.td().attCls("micon").e("a").attCls("exi").att("href", "#expand").nbsp().c().c();
                            }
                            else
                                html.td().attCls("micon").nbsp().c();

                            html.td().member(m, referenceContext);
                            if (m.Parameters != null)
                            {
                                html.text("[");
                                RenderParameters(html, m.Parameters, referenceContext);
                                html.text("]");
                            }
                            html.text(" { ");
                            if (m.CanRead) html.text("get; ");
                            if (m.CanWrite) html.text("set; ");
                            html.text("}");
                            RenderExtendedSummary(m, html, referenceContext);

                            if (m.Parameters != null)
                            {
                                html.div().attCls("details");
                                RenderMethodParametersAndReturnsSummary(html, m, referenceContext);
                                html.c(); // details
                            }

                            html.c(); //td
                            html.td().att("width", "10%").typeName(m.DeclaringType, m.DeclaringType + "-" + m.Name, referenceContext).c();
                            html.c(); //tr
                        }
                        html.c();
                    }

                    #endregion Properties

                    #region Methods

                    html.anchor("methods");
                    html.h2("Methods");
                    if (dox.Type.Methods == null || dox.Type.Methods.Count == 0)
                        html.text("This class has no methods.");
                    else
                    {
                        html.table(0, 0).att("width", "100%").attCls("members");
                        html.tableHeader();
                        foreach (var m in dox.Type.Methods.OrderByDescending(a => a.MemberFlag & MemberFlag.CONSTRUCTOR).ThenBy(a => a.Name))
                        {
                            html.tr();
                            if (m.Parameters != null || (m.TypeName != null && m.TypeName != "System.Void" && m.TypeName != "void"))
                            {
                                html.attCls("expandable");
                                html.td().attCls("micon").e("a").attCls("exi").att("href", "#expand").nbsp().c().c();
                            }
                            else
                                html.td().attCls("micon").nbsp().c();

                            html.td().member(m, referenceContext);
                            html.text("(");
                            RenderParameters(html, m.Parameters, referenceContext);
                            html.text(")");
                            RenderExtendedSummary(m, html, referenceContext);
                            html.div().attCls("details");
                            RenderMethodParametersAndReturnsSummary(html, m, referenceContext);
                            html.c(); // details
                            html.c(); //td
                            html.td().att("width", "10%").typeName(m.DeclaringType, m.DeclaringType + "-" + m.Name, referenceContext).c();
                            html.c(); //tr
                        }
                        html.c();
                    }

                    #endregion Methods

                    #region Events

                    html.anchor("events");
                    html.h2("Events");
                    if (dox.Type.Events == null || dox.Type.Events.Count == 0)
                        html.text("This class has no events.");
                    else
                    {
                        html.table(0, 0).att("width", "100%").attCls("members");
                        html.tableHeader();
                        foreach (var m in dox.Type.Events.OrderBy(a => a.Name))
                        {
                            html.tr();//.attCls("expandable");
                            //html.td().attCls("micon").e("a").attCls("exi").att("href", "#expand").nbsp().c().c();
                            html.td().attCls("micon").nbsp().c();

                            html.td().member(m, "event ", referenceContext);

                            //html.div().attCls("details");
                            RenderExtendedSummary(m, html, referenceContext);
                            //html.c(); // details;
                            html.c(); //td
                            html.td().att("width", "10%").typeName(m.DeclaringType, m.DeclaringType + "-" + m.Name, referenceContext).c();
                            html.c(); //tr
                        }
                        html.c(); //table
                    }

                    #endregion Events
                }
                else
                    html.h1(dox.Title);

                //html.div().attCls("footer").text(dox.Title).c();
                html.c(); // dox div
            }
        }
示例#12
0
 public virtual HtmlBuilderDivTag CreateHtmlBuilderDivTag(HtmlBuilder b, Nparams args)
 {
     return(new HtmlBuilderDivTag(b, args));
 }
示例#13
0
 public virtual HtmlBuilderTableTag CreateHtmlBuilderTableTag(HtmlBuilder b, Nparams args)
 {
     return(new HtmlBuilderTableTag(b, args.Get <HtmlBuilderTableTag.TableAttrib>()));
 }
示例#14
0
 public virtual HtmlBuilderFormTag CreateHtmlBuilderFormTag(HtmlBuilder b, IFormContext formContext, Nparams args)
 {
     return(new HtmlBuilderFormTag(b, formContext, args));
 }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlTextWriterEx"/> class.
 /// </summary>
 /// <param name="w">The w.</param>
 /// <param name="tabText">The tab text.</param>
 public HtmlTextWriterEx(TextWriter w, string tabText)
     : base(w, tabText)
 {
     _htmlBuilder = CreateHtmlBuilder(this);
 }
示例#16
0
        private void WriteDatabaseDocument(Database db, HtmlBuilder html, DatabaseContext context)
        {
            html.h1(String.Format("Database: {0}", db.Name));

            #region Tables

            html.e("a").attCls("tables").c();
            html.h2("Tables");
            if (db.Tables == null || db.Tables.Count == 0)
                html.text("This database has no tables.");
            else
            {
                html.table(0, 0).att("width", "100%").attCls("members");
                html.dbTableHeader();

                foreach (var t in db.Tables)
                {
                    html.tr().attCls("expandable");
                    html.td().attCls("micon").e("a").attCls("exi").att("href", "#expand").nbsp().c().c();
                    String relDoc = String.Format("{0}.{1}.Tables.{2}.{3}", context.BookName, context.DbName, t.SchemaName, t.Name);
                    html.td().internalLink(t.Name, "db-entity-name " + t.Name, relDoc); // Anchor and link in one element (e.g. <a class="db-entity-name Parties" ...>)
                    html.div().attCls("details");
                    RenderColumnsSection(t.Columns, html);
                    html.c(); // details
                    html.c(); // td
                    html.td().text(t.SchemaName).c();
                    html.c(); // tr
                }

                html.c(); // table
            }

            #endregion

            #region Views

            html.e("a").attCls("views").c();
            html.h2("Views");
            if (db.Views == null || db.Views.Count == 0)
                html.text("This database has no views.");
            else
            {
                html.table(0, 0).att("width", "100%").attCls("members");
                html.dbTableHeader();

                foreach (var v in db.Views)
                {
                    html.tr().attCls("expandable");
                    html.td().attCls("micon").e("a").attCls("exi").att("href", "#expand").nbsp().c().c();
                    String relDoc = String.Format("{0}.{1}.Views.{2}.{3}", context.BookName, context.DbName, v.SchemaName, v.Name);
                    html.td().internalLink(v.Name, "db-entity-name " + v.Name, relDoc);
                    html.div().attCls("details");
                    RenderColumnsSection(v.Columns, html);
                    html.c(); // details
                    html.c(); // td

                    html.td().text(v.SchemaName).c();

                    html.c(); // tr
                }

                html.c(); // table
            }

            #endregion

            #region Stored procedures

            html.e("a").attCls("stored-procedures").c();
            html.h2("Stored procedures");
            if (db.StoredProcedures == null || db.StoredProcedures.Count == 0)
                html.text("This database has no stored procedures.");
            else
            {
                html.table(0, 0).att("width", "100%").attCls("members");
                html.dbSpHeader();

                foreach (var sp in db.StoredProcedures)
                {
                    html.tr().attCls("expandable");
                    html.td().attCls("micon").e("a").attCls("exi").att("href", "#expand").nbsp().c().c();

                    String relDoc = String.Format("{0}.{1}.Procedures.{2}", context.BookName, context.DbName, sp.Name);
                    html.td().internalLink(sp.Name, "db-entity-name " + sp.Name, relDoc);

                    html.div().attCls("details");
                    RenderParametersSection(sp.Parameters, html);
                    html.c(); // details

                    html.c(); // td
                    html.c(); // tr
                }

                html.c(); // table
            }

            #endregion
        }
示例#17
0
 /// <summary>
 /// Creates the HTML builder form tag.
 /// </summary>
 /// <param name="b">The b.</param>
 /// <param name="formContext">The form context.</param>
 /// <param name="args">The args.</param>
 /// <returns></returns>
 public virtual HtmlBuilderFormTag CreateHtmlBuilderFormTag(HtmlBuilder b, IFormContext formContext, Nparams args)
 {
     return new HtmlBuilderFormTag(b, formContext, args);
 }
示例#18
0
 private void RenderExtendedSummary(List<DescriptionSegment> list, HtmlBuilder html, ReferenceContext referenceContext)
 {
     if (list == null)
         return;
     foreach (var el in list)
         RenderDescriptionNode(el, html, referenceContext);
 }
示例#19
0
 /// <summary>
 /// Creates the HTML builder div tag.
 /// </summary>
 /// <param name="b">The b.</param>
 /// <param name="args">The args.</param>
 /// <returns></returns>
 public virtual HtmlBuilderDivTag CreateHtmlBuilderDivTag(HtmlBuilder b, Nparams args)
 {
     return new HtmlBuilderDivTag(b, args);
 }
示例#20
0
        private void RenderMethodParametersAndReturnsSummary(HtmlBuilder html, Method m, ReferenceContext referenceContext)
        {
            if (m.Parameters != null && m.Parameters.Count > 0)
            {
                html.div().attCls("section");
                html.h4("Parameters:");
                html.e("ul").attCls("method-params");
                foreach (var p in m.Parameters)
                {
                    html.e("li").paramName(p.Name).text(": ").typeName(p.TypeName, referenceContext);
                    RenderExtendedSummary(p, html, referenceContext);
                    html.c(); //li
                }
                html.c(); //ul
                html.c(); //div
            }

            if (m.TypeName != null && m.TypeName != "Void" && m.TypeName != "System.Void")
            {
                html.div().attCls("section");
                html.h4("Returns:");
                html.e("ul").attCls("method-params")
                    .e("li").typeName(m.TypeName, referenceContext);
                RenderSummary(m.ReturnDescription, html, referenceContext);
                html.c();//c
                html.c(); //ul
                html.c(); //div
            }
        }
示例#21
0
 private void RenderParameters(HtmlBuilder html, List<Parameter> parameters, ReferenceContext referenceContext)
 {
     if (parameters != null)
     {
         bool first = true;
         foreach (var p in parameters)
         {
             if (first)
                 first = false;
             else
                 html.text(", ");
             if ((p.ParameterFlags & ParameterFlags.Const) != ParameterFlags.None)
                 html.text("const ");
             if ((p.ParameterFlags & ParameterFlags.Out) != ParameterFlags.None)
                 html.text("out ");
             if ((p.ParameterFlags & ParameterFlags.Ref) != ParameterFlags.None)
                 html.text("ref ");
             if ((p.ParameterFlags & ParameterFlags.This) != ParameterFlags.None)
                 html.text("this ");
             html.typeName(p.TypeName, referenceContext).text(" ").paramName(p.Name);
         }
     }
 }
示例#22
0
        private void RenderSummary(string summary, HtmlBuilder html, ReferenceContext referenceContext)
        {
            if (string.IsNullOrEmpty(summary))
                return;

            html.div().attCls("summary");
            html.text(summary);
            html.c();//div
        }
示例#23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlBuilderFormTag"/> class.
 /// </summary>
 /// <param name="b">The b.</param>
 /// <param name="formContext">The form context.</param>
 /// <param name="args">The args.</param>
 public HtmlBuilderFormTag(HtmlBuilder b, IFormContext formContext, Nparams args)
 {
 }
示例#24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HtmlTextWriterEx"/> class.
 /// </summary>
 public HtmlTextWriterEx()
     : base(new StringWriter())
 {
     _htmlBuilder = CreateHtmlBuilder(this);
 }