Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }