コード例 #1
0
        public static void WriteAttributeTable(this MamlWriter writer, Context context, AttributeEntries attributeEntries)
        {
            if (attributeEntries.Attributes.Count == 0 && attributeEntries.AnyAttribute == null)
                return;

            writer.StartTable();
            writer.StartTableHeader();
            writer.StartTableRow();

            writer.StartTableRowEntry();
            writer.WriteString("Name");
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteString("Type");
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteString("Required");
            writer.EndTableRowEntry();

            writer.StartTableRowEntry();
            writer.WriteString("Description");
            writer.EndTableRowEntry();

            writer.EndTableRow();
            writer.EndTableHeader();

            var sortedAttributes = from a in attributeEntries.Attributes
                                   orderby a.QualifiedName.Name
                                   select a;

            foreach (var attribute in sortedAttributes)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.WriteAttributeTopicLink(context.TopicManager, attribute, false);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteType(context, attribute.AttributeSchemaType);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteRequiredText(attribute.Use);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteSummaryForObject(context, attribute);
                writer.EndTableRowEntry();

                writer.EndTableRow();
            }

            if (attributeEntries.AnyAttribute != null)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.WriteHtmlArtItemWithText(ArtItem.AnyAttribute, "Any");
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteSummaryForObject(context, attributeEntries.AnyAttribute);
                writer.EndTableRowEntry();

                writer.EndTableRow();
            }

            var sortedExtensionAttributes = from a in attributeEntries.ExtensionAttributes
                                            orderby a.QualifiedName.Name
                                            select a;
            foreach (var attribute in sortedExtensionAttributes)
            {
                writer.StartTableRow();

                writer.StartTableRowEntry();
                writer.WriteHtmlIndent(1);
                writer.WriteAttributeTopicLink(context.TopicManager, attribute, true);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteType(context, attribute.AttributeSchemaType);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteRequiredText(attribute.Use);
                writer.EndTableRowEntry();

                writer.StartTableRowEntry();
                writer.WriteSummaryForObject(context, attribute);
                writer.EndTableRowEntry();

                writer.EndTableRow();
            }

            writer.EndTable();
        }
コード例 #2
0
 public static void WriteAttributesSection(this MamlWriter writer, Context context, AttributeEntries attributeEntries)
 {
     writer.StartSection("Attributes", "attributes");
     writer.WriteAttributeTable(context, attributeEntries);
     writer.EndSection();
 }