protected virtual MarkdownSection GenerateCommandsSection([NotNull] ModuleInformation module) { var moduleCommandsSection = new MarkdownSection("Commands", 2); var commandGroups = module.Commands.GroupBy(c => c.Name).ToList(); foreach (var commandGroup in commandGroups) { if (commandGroup != commandGroups.First()) { moduleCommandsSection.AppendContent(new MarkdownHorizontalRule()); } var commandOverloads = new MarkdownSection("Overloads", 4); foreach (var command in commandGroup) { commandOverloads.AppendContentRange(GenerateCommandOverloadContent(command)); } // Filter out commands without names (we use the module's name chain instead) var commandGroupName = commandGroup.Key.IsNullOrWhitespace() ? commandGroup.First().Module.GetNameChain(true) : commandGroup.Key; var commandSection = new MarkdownSection(commandGroupName, 3).AppendContent(commandOverloads); commandSection.Header.Title.Emphasis = Italic; moduleCommandsSection.AppendContent(commandSection); } return(moduleCommandsSection); }
protected virtual MarkdownSection GenerateCommandsSection([NotNull] ModuleInfo module) { var moduleCommandsSection = new MarkdownSection("Commands", 2); var commandGroups = module.Commands.GroupBy(c => c.Name).ToList(); foreach (var commandGroup in commandGroups) { if (commandGroup != commandGroups.First()) { moduleCommandsSection.AppendContent(new MarkdownHorizontalRule()); } var commandOverloads = new MarkdownSection("Overloads", 4); foreach (var command in commandGroup) { commandOverloads.AppendContentRange(GenerateCommandOverloadContent(command)); } var commandSection = new MarkdownSection(commandGroup.Key, 3).AppendContent(commandOverloads); commandSection.Header.Title.Emphasis = Italic; moduleCommandsSection.AppendContent(commandSection); } return(moduleCommandsSection); }
protected virtual MarkdownSection GenerateSubmodulesSection([NotNull] ModuleInformation module) { var submoduleSection = new MarkdownSection("Submodules", 2); var submoduleList = new MarkdownList { Type = ListType.Bullet }; submoduleSection.AppendContent(submoduleList); foreach (var submodule in module.Submodules) { submoduleList.AppendItem ( new MarkdownLink ( $"{submodule.GetNameChain().Replace(" ", "_")}.md", submodule.Name.Humanize() ) ); } return(submoduleSection); }