Beispiel #1
0
        protected virtual MarkdownSection GenerateSummarySection([NotNull] ModuleInformation module)
        {
            string modulePrefixText;

            if (!module.HasPrefix)
            {
                modulePrefixText = "These commands have no prefix.";
            }
            else
            {
                var moduleAliasChains = module.GetAliasChains().ToList();

                var compiledAliases = moduleAliasChains
                                      .Skip(1)
                                      .Select(a => new MarkdownInlineCode(a).Compile())
                                      .Humanize("or");

                var moduleExtraAliases = moduleAliasChains.Skip(1).Any()
                    ? $"You can also use {compiledAliases} instead of `{module.GetNameChain(true)}`."
                    : string.Empty;

                modulePrefixText = $"These commands are prefixed with `{module.GetNameChain(true)}`. {moduleExtraAliases}";
            }

            var summarySection = new MarkdownSection("Summary", 2).AppendContent
                                 (
                new MarkdownParagraph()
                .AppendLine(modulePrefixText)
                .AppendLine(module.Summary)
                                 );

            return(summarySection);
        }
Beispiel #2
0
        protected virtual MarkdownPage GenerateModuleDocumentation([NotNull] ModuleInformation module)
        {
            var page = new MarkdownPage
                       (
                module.GetNameChain().Replace(" ", "_"),
                $"{module.GetNameChain().Humanize()} commands".Transform(To.TitleCase)
                       );

            page.Footer = "<sub><sup>Generated by DIGOS.Ambassador.Doc</sup></sub>";

            page.AppendSection(GenerateSummarySection(module));

            if (module.Submodules.Any())
            {
                page.AppendSection(GenerateSubmodulesSection(module));
            }

            if (module.Commands.Any())
            {
                page.AppendSection(GenerateCommandsSection(module));
            }

            return(page);
        }