示例#1
0
        private string GetSummary(TypeScriptInterface @interface, bool extension, string articleUrl)
        {
            var itemSummary = @interface.Comment?.ShortText;

            if (string.IsNullOrEmpty(itemSummary))
            {
                var properties = @interface.GetSignificantProperties();
                var methods    = @interface.GetSignificantMethods();

                if (!properties.Any() && !methods.Any())
                {
                    properties = @interface.Properties.Where(p => !p.IsPrivate).Take(5);
                    methods    = @interface.Methods.Where(m => !m.IsPrivate).Take(5);
                }

                if (properties.Any() || methods.Any())
                {
                    var path = (!extension)
                        ? @interface.GetPath().MakeUriFromString()
                        : string.IsNullOrEmpty(articleUrl)
                            ? @interface.Module.Module.GetPath().MakeUriFromString()
                            : @interface.Module.Module.GetPath().MakeUriFromString().CombineWithUri(articleUrl);

                    itemSummary = BuildHTMLList(path, properties, methods);
                }

                if (string.IsNullOrEmpty(itemSummary))
                {
                    //prevent autoexcerpt
                    itemSummary = " ";
                }
            }

            return(itemSummary);
        }
        private void BuildIndex(MarkdownBuilder mb, TypeScriptInterface @interface)
        {
            var path = @interface.GetPath().MakeUriFromString();

            mb.Header(2, "Index");
            if (@interface.Properties.Any())
            {
                mb.HeaderWithLink(3, "Properties", CombineWithRootUrl(path.CombineWithUri("#properties-1")));

                foreach (var property in @interface.Properties)
                {
                    mb.ListLink(property.Name, CombineWithRootUrl(path.CombineWithUri("#" + property.Name.MakeUriFromString())));
                }

                mb.AppendLine();
            }

            if (@interface.Methods.Any())
            {
                mb.HeaderWithLink(3, "Methods", CombineWithRootUrl(path.CombineWithUri("#methods-1")));
                foreach (var method in @interface.Methods)
                {
                    mb.ListLink(method.Name, CombineWithRootUrl(path.CombineWithUri("#" + method.Name.MakeUriFromString())));
                }
                mb.AppendLine();
            }

            mb.AppendLine();
            mb.AppendLine();
        }