Exemplo n.º 1
0
        /// <summary>
        /// Parses a <see cref="DocAssembly"/> to return a <see cref="DocFile"/>.
        /// </summary>
        /// <param name="assembly">The <see cref="DocAssembly"/> to parse.</param>
        /// <returns>The transformed <see cref="DocFile"/>.</returns>
        public DocFile Parse(DocAssembly assembly)
        {
            var result = new DocFile(assembly.FileName);

            result.AddThenBlankLine(writer.WriteHeading1($"{assembly.Name} API Reference"));
            result.AddThenBlankLine(ParserUtils.ProcessBreadcrumb(this));

            var list = new MarkdownList();

            foreach (var customDoc in assembly.CustomDocs)
            {
                if (customDoc is DocSerialization ser)
                {
                    list.AddItem(writer.WriteLink($"{ser.Name.NameOnly()} Reference", ser.FileName));
                    result.Files.Add(ProcessSerialization(ser, assembly));
                }
            }

            foreach (var ns in assembly.Namespaces.OrderBy(ns => ns.Name))
            {
                list.AddItem(writer.WriteLink(ns.Name, ns.FileName));
                result.Files.Add(ProcessNamespace(ns));
            }

            writer.AddRange(result.Markdown, list.CloseList());
            return(result);
        }