Example #1
0
 private static string Generate(ContentModel model)
 {
     var engine = new VeilEngine();
     var template = engine.Compile<ContentModel>("handlebars", new StringReader(Resources.Template));
     using (var writer = new StringWriter())
     {
         template(writer, model);
         return RemoveEmptyLines(writer.ToString());
     }
 }
        public static ContentModel Generate(IList<Namespace> model)
        {
            var data = GetMethods(model);

            var result = new ContentModel();
            result.Categories = new List<CategoryModel>();

            foreach (var categoryName in data.Keys.OrderBy(x => x))
            {
                var category = new CategoryModel();
                category.Name = categoryName;
                category.Categories = new List<SubCategoryModel>();

                foreach (var subCategoryName in data[categoryName].Keys)
                {
                    var subCategory = new SubCategoryModel();
                    subCategory.Name = subCategoryName;
                    subCategory.Methods = new List<MethodModel>();

                    foreach (var method in data[categoryName][subCategoryName])
                    {
                        var aliasMethod = new MethodModel();
                        aliasMethod.Name = method.RepresentedMethod.GetMethodSignature();
                        aliasMethod.Description = CommentRenderer.Render(method.Summary);

                        subCategory.Methods.Add(aliasMethod);
                    }

                    category.Categories.Add(subCategory);
                }

                result.Categories.Add(category);
            }

            return result;
        }