Exemplo n.º 1
0
 public static void WriteSummary(this MamlWriter writer, DocumentationInfo documentationInfo)
 {
     if (documentationInfo != null && documentationInfo.SummaryNode != null)
     {
         writer.WriteRawContent(documentationInfo.SummaryNode);
     }
 }
Exemplo n.º 2
0
    private void ShowDocumentation(DocumentationInfo info)
    {
        GUILayout.Space(paragraphSpace);

        EditorGUILayout.LabelField(info.functionName, itemHeaderStyle);
        if (info.parameter != null)
        {
            for (int i = 0; i < info.parameter.Length; i++)
            {
                EditorGUILayout.LabelField(Indent + "<i>Parameter:</i> " + info.parameter[i], paragraphStyle);
            }
        }
        if (info.returnType != string.Empty)
        {
            EditorGUILayout.LabelField(Indent + "<i>Return type:</i> " + info.returnType, paragraphStyle);
        }

        EditorGUILayout.LabelField(Indent + "<i>Description:</i> " + info.description, paragraphStyle);

        if (info.codeExample != string.Empty)
        {
            EditorGUILayout.TextArea(info.codeExample, GUI.skin.textArea);
        }

        GUILayout.Space(paragraphSpace);
    }
Exemplo n.º 3
0
        private static void WriteExamplesSection(this MamlWriter writer, DocumentationInfo documentationInfo)
        {
            if (documentationInfo == null || documentationInfo.ExamplesNode == null)
            {
                return;
            }

            writer.WriteSection("Examples", "examples", documentationInfo.ExamplesNode);
        }
Exemplo n.º 4
0
        private static void WriteRemarksSection(this MamlWriter writer, DocumentationInfo documentationInfo)
        {
            if (documentationInfo == null || documentationInfo.RemarksNode == null)
            {
                return;
            }

            writer.WriteSection("Remarks", "remarks", documentationInfo.RemarksNode);
        }
Exemplo n.º 5
0
 private void WriteDocumentation(DocumentationInfo documentation)
 {
     this.writer.WriteLine("/**");
     if (documentation.Summary != null)
     {
         var info = Whitespace.Replace(documentation.Summary, " ").Trim();
         this.writer.WriteLine("* " + info);
     }
     this.writer.WriteLine("*/");
 }
    void ShowDocumentation(DocumentationInfo info)
    {
        GUILayout.Space(paragraphSpace);

        EditorGUILayout.LabelField(info.functionName, itemHeaderStyle);
        var rect = GUILayoutUtility.GetLastRect();

        EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
        if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition) && (info.showMore.faded == 0.0f || info.showMore.faded == 1.0f))
        {
            info.showMore.target = !info.showMore.target;
        }

        if (EditorGUILayout.BeginFadeGroup(info.showMore.faded))
        {
            if (info.parameter != null)
            {
                for (int i = 0; i < info.parameter.Length; i++)
                {
                    EditorGUILayout.LabelField(Indent + "<i>Parameter:</i> " + info.parameter[i], paragraphStyle);
                }
            }
            if (info.returnType != string.Empty)
            {
                EditorGUILayout.LabelField(Indent + "<i>Return type:</i> " + info.returnType, paragraphStyle);
            }

            EditorGUILayout.LabelField(Indent + "<i>Description:</i> " + info.description, paragraphStyle);

            if (info.codeExample != string.Empty)
            {
                EditorGUILayout.TextArea(info.codeExample, GUI.skin.textArea);
            }

            GUILayout.Space(paragraphSpace);
        }
        EditorGUILayout.EndFadeGroup();
    }
Exemplo n.º 7
0
        public static void WriteIntroductionForObject(this MamlWriter writer,
                                                      Context context, XmlSchemaObject obj)
        {
            DocumentationInfo documentationInfo =
                context.DocumentationManager.GetObjectDocumentationInfo(obj);

            writer.StartIntroduction();
            writer.WriteSummary(documentationInfo);
            if (context.Configuration.IncludeAutoOutline)
            {
                XmlSchemaAttribute      attribute;
                XmlSchemaElement        element;
                XmlSchemaGroup          group;
                XmlSchemaAttributeGroup attributeGroup;
                XmlSchemaSimpleType     simpleType;
                XmlSchemaComplexType    complexType;

                if (Casting.TryCast(obj, out element))
                {
                    bool isSimpleType = element.ElementSchemaType is XmlSchemaSimpleType;
                    if (!isSimpleType)
                    {
                        writer.StartParagraph();
                        writer.WriteToken("autoOutline");
                        writer.EndParagraph();

                        context.MoveToTopLink = true;
                    }
                }
                else if (Casting.TryCast(obj, out attribute))
                {
                }
                else if (Casting.TryCast(obj, out group))
                {
                    XmlSchemaGroupBase compositor = group.Particle;
                    if (compositor != null)
                    {
                        XmlSchemaObjectCollection items = compositor.Items;
                        if (items != null && items.Count > 3)
                        {
                            writer.StartParagraph();
                            writer.WriteToken("autoOutline");
                            writer.EndParagraph();

                            context.MoveToTopLink = true;
                        }
                    }
                }
                else if (Casting.TryCast(obj, out attributeGroup))
                {
                }
                else if (Casting.TryCast(obj, out simpleType))
                {
                }
                else if (Casting.TryCast(obj, out complexType))
                {
                    if (complexType.ContentType != XmlSchemaContentType.Empty &&
                        complexType.ContentType != XmlSchemaContentType.TextOnly)
                    {
                        writer.StartParagraph();
                        writer.WriteToken("autoOutline");
                        writer.EndParagraph();

                        context.MoveToTopLink = true;
                    }
                }
            }
            writer.WriteObsoleteInfo(context, obj);
            writer.WriteNamespaceAndSchemaInfo(context, obj);
            writer.EndIntroduction();
        }
        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);
        }