public static void WriteChildrenTable(this MamlWriter writer, Context context, List<ChildEntry> childEntries) { if (childEntries == null || childEntries.Count == 0) return; SortAllAndChoiceChildren(childEntries); writer.StartTable(); writer.StartTableHeader(); writer.StartTableRow(); writer.StartTableRowEntry(); writer.WriteString("Name"); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Occurrences"); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Description"); writer.EndTableRowEntry(); writer.EndTableRow(); writer.EndTableHeader(); writer.WriteChildrenRows(context, childEntries, 0); writer.EndTable(); }
private static void WriteConstraintRow(this MamlWriter writer, Context context, ArtItem artItem, string constrainedType, XmlSchemaIdentityConstraint constraint) { writer.StartTableRow(); writer.StartTableRowEntry(); writer.WriteArtItemInline(artItem); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString(constrainedType); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteSummaryForObject(context, constraint); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString(constraint.Selector.XPath); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteConstraintFieldList(constraint.Fields); writer.EndTableRowEntry(); writer.EndTableRow(); }
public static void WriteObsoleteInfo(this MamlWriter writer, Context context, string targetNamespace) { var documentationInfo = context.DocumentationManager.GetNamespaceDocumentationInfo(targetNamespace); if (documentationInfo == null) return; writer.WriteObsoleteInfo(context, documentationInfo); }
public static void WriteObsoleteInfo(this MamlWriter writer, Context context, XmlSchemaObject obj) { var documentationInfo = context.DocumentationManager.GetObjectDocumentationInfo(obj); if (documentationInfo == null) return; writer.WriteObsoleteInfo(context, documentationInfo); }
public static void WriteConstraintsSection(this MamlWriter writer, Context context, XmlSchemaObjectCollection constraints) { if (!context.Configuration.DocumentConstraints) return; writer.StartSection("Constraints", "constraints"); writer.WriteConstraintTable(context, constraints); writer.EndSection(); }
private static string GetSummaryMarkup(Context context, XmlSchemaObject schemaObject) { using (var stringWriter = new StringWriter()) { using (var mamlWriter = new MamlWriter(stringWriter)) mamlWriter.WriteSummaryForObject(context, schemaObject); return stringWriter.ToString(); } }
public static List<ListItem> Build(Context context, IEnumerable<string> namespaceUris) { var listItems = new List<ListItem>(); foreach (var namspaceUri in namespaceUris) { var topic = context.TopicManager.GetNamespaceTopic(namspaceUri); var summaryMarkup = GetSummaryMarkup(context, namspaceUri); AddItem(listItems, ArtItem.Namespace, topic, summaryMarkup); } listItems.Sort((x, y) => x.Topic.LinkTitle.CompareTo(y.Topic.LinkTitle)); return listItems; }
private static void WriteObsoleteInfo(this MamlWriter writer, Context context, DocumentationInfo documentationInfo) { if (!documentationInfo.IsObsolete) return; if (documentationInfo.NonObsoleteAlternative == null) { writer.WriteObsoleteInfo(); return; } var topic = context.TopicManager.GetTopic(documentationInfo.NonObsoleteAlternative); if (topic == null) { writer.WriteObsoleteInfo(); return; } writer.WriteObsoleteInfo(topic); }
public static void WriteSimpleTypeStrucure(this MamlWriter writer, Context context, SimpleTypeStructureNode root) { if (root == null || root.Children.Count == 0) return; if (root.Children.Count == 1) { var node = root.Children[0]; var isSingleRow = GetIsSingleRow(node); if (isSingleRow) { writer.WriteSingle(context.TopicManager, node); return; } } writer.StartTable(); writer.StartTableHeader(); writer.StartTableRow(); writer.StartTableRowEntry(); writer.WriteString("Item"); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Facet Value"); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Description"); writer.EndTableRowEntry(); writer.EndTableRow(); writer.EndTableHeader(); writer.WriteNodes(context, root.Children, 0); writer.EndTable(); }
public static List<ListItem> Build(Context context, IEnumerable<XmlSchemaObject> schemaObjects) { var listItems = new List<ListItem>(); foreach (var schemaObject in schemaObjects) { XmlSchema schema; XmlSchemaAttribute attribute; XmlSchemaElement element; XmlSchemaGroup group; XmlSchemaAttributeGroup attributeGroup; XmlSchemaSimpleType simpleType; XmlSchemaComplexType complexType; var topic = context.TopicManager.GetTopic(schemaObject); var summaryMarkup = GetSummaryMarkup(context, schemaObject); if (Casting.TryCast(schemaObject, out schema)) AddItem(listItems, ArtItem.Schema, topic, summaryMarkup); else if (Casting.TryCast(schemaObject, out attribute)) AddItem(listItems, ArtItem.Attribute, topic, summaryMarkup); else if (Casting.TryCast(schemaObject, out element)) AddItem(listItems, ArtItem.Element, topic, summaryMarkup); else if (Casting.TryCast(schemaObject, out group)) AddItem(listItems, ArtItem.Group, topic, summaryMarkup); else if (Casting.TryCast(schemaObject, out attributeGroup)) AddItem(listItems, ArtItem.AttributeGroup, topic, summaryMarkup); else if (Casting.TryCast(schemaObject, out simpleType)) AddItem(listItems, ArtItem.SimpleType, topic, summaryMarkup); else if (Casting.TryCast(schemaObject, out complexType)) AddItem(listItems, ArtItem.ComplexType, topic, summaryMarkup); else throw ExceptionBuilder.UnexpectedSchemaObjectType(schemaObject); } listItems.Sort((x, y) => x.Topic.LinkTitle.CompareTo(y.Topic.LinkTitle)); return listItems; }
public static void WriteConstraintTable(this MamlWriter writer, Context context, XmlSchemaObjectCollection constraints) { if (constraints.Count == 0) return; writer.StartTable(); writer.StartTableHeader(); writer.StartTableRow(); writer.StartTableRowEntry(); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Type"); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Description"); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Selector"); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteString("Fields"); writer.EndTableRowEntry(); writer.EndTableRow(); writer.EndTableHeader(); var rowBuilder = new ConstraintRowWriter(writer, context); rowBuilder.Traverse(constraints); writer.EndTable(); }
private static void WriteType(this MamlWriter writer, Context context, XmlSchemaSimpleType type) { var typeNameWriter = new AttributeTypeNameWriter(writer, context); typeNameWriter.Traverse(type); }
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(); }
public AttributeTypeNameWriter(MamlWriter writer, Context context) { _writer = writer; _context = context; }
private static void WriteChildrenRows(this MamlWriter writer, Context context, IEnumerable<ChildEntry> childEntries, int level) { foreach (var childEntry in childEntries) { writer.StartTableRow(); writer.StartTableRowEntry(); writer.WriteHtmlIndent(level); writer.WriteName(childEntry, context.TopicManager); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteOccurrence(childEntry); writer.EndTableRowEntry(); writer.StartTableRowEntry(); writer.WriteDescription(childEntry, context); writer.EndTableRowEntry(); writer.EndTableRow(); writer.WriteChildrenRows(context, childEntry.Children, level + 1); } }
public SourceCodeManager(Context context) : base(context) { }
private static void WriteDescription(this MamlWriter writer, ChildEntry entry, Context context) { if (entry.Particle != null) writer.WriteSummaryForObject(context, entry.Particle); }
public static void WriteLinksForObject(this MamlWriter writer, XmlSchemaObject obj, Context context) { var root = obj.GetRoot(); if (root != null && root != obj) { var rootItemTopic = context.TopicManager.GetTopic(root); if (rootItemTopic != null) writer.WriteTopicLinkWithReferenceMarker(rootItemTopic); } var targetNamespace = obj.GetSchema().TargetNamespace; var targetNamespaceTopic = context.TopicManager.GetNamespaceTopic(targetNamespace); if (targetNamespaceTopic != null) writer.WriteTopicLinkWithReferenceMarker(targetNamespaceTopic); var info = context.DocumentationManager.GetObjectDocumentationInfo(obj); if (info != null && info.RelatedTopicsNode != null) writer.WriteRawContent(info.RelatedTopicsNode); }
public static void WriteList(this MamlWriter writer, Context context, IEnumerable<XmlSchemaObject> schemaObjects) { var listItems = ListItemBuilder.Build(context, schemaObjects); var isFirst = true; foreach (var item in listItems) { if (isFirst) { writer.WriteString(" "); isFirst = false; } writer.WriteHtmlArtItemWithTopicLink(item.ArtItem, item.Topic); } }
public ConstraintRowWriter(MamlWriter writer, Context context) { _writer = writer; _context = context; }
protected Manager(Context context) { Context = context; }
public DocumentationManager(Context context) : base(context) { }
public static void WriteNamespaceInfo(this MamlWriter writer, Context context, string namespaceUri) { writer.StartParagraph(); writer.StartBold(); writer.WriteString("Namespace:"); writer.EndBold(); writer.WriteNonBlockingSpace(); writer.WriteNamespaceLink(context, namespaceUri); writer.EndParagraph(); }
public static void WriteNamespaceAndSchemaInfo(this MamlWriter writer, Context context, XmlSchemaObject obj) { var targetNamespace = obj.GetSchema().TargetNamespace; writer.WriteNamespaceInfo(context, targetNamespace); writer.StartParagraph(); writer.StartBold(); writer.WriteString("Schema:"); writer.EndBold(); writer.WriteNonBlockingSpace(); writer.WriteSchemaLink(context, obj); writer.EndParagraph(); }
private static string GetSummaryMarkup(Context context, string namspaceUri) { using (var stringWriter = new StringWriter()) { using (var mamlWriter = new MamlWriter(stringWriter)) { var doc = context.DocumentationManager.GetNamespaceDocumentationInfo(namspaceUri); mamlWriter.WriteSummary(doc); } return stringWriter.ToString(); } }
public ContentGenerator(IMessageReporter messageReporter, Configuration configuration) { _context = new Context(messageReporter, configuration); MediaItems = new List<MediaItem>(); TopicFiles = new List<string>(); }
public static void WriteSchemaLink(this MamlWriter writer, Context context, XmlSchemaObject obj) { var topic = context.TopicManager.GetTopic(obj.GetSchema()); if (topic == null) writer.WriteString("Empty"); else writer.WriteTopicLink(topic); }
private static void WriteNodes(this MamlWriter writer, Context context, IEnumerable<SimpleTypeStructureNode> children, int level) { foreach (var childEntry in children) { if (childEntry.NodeType == SimpleTypeStructureNodeType.NamedType) continue; writer.StartTableRow(); var isSingleRow = GetIsSingleRow(childEntry); if (isSingleRow) writer.WriteSingleItemAndFacet(level, context.TopicManager, childEntry); else writer.WriteConstructorItemAndFacet(level, context.TopicManager, childEntry); writer.StartTableRowEntry(); writer.WriteSummaryForObject(context, childEntry.Node); writer.EndTableRowEntry(); writer.EndTableRow(); if (!isSingleRow) writer.WriteNodes(context, childEntry.Children, level + 1); } }
public static void WriteNamespaceLink(this MamlWriter writer, Context context, string namespaceUri) { var topic = context.TopicManager.GetNamespaceTopic(namespaceUri); if (topic == null) writer.WriteString(namespaceUri ?? "Empty"); else writer.WriteTopicLink(topic); }
public static void WriteSummaryForObject(this MamlWriter writer, Context context, XmlSchemaObject obj) { var documentationInfo = context.DocumentationManager.GetObjectDocumentationInfo(obj); writer.WriteSummary(documentationInfo); }