public MarkdownProcessor( IReadOnlyDictionary <string, IReadOnlyList <Snippet> > snippets, AppendSnippetGroupToMarkdown appendSnippetGroup) { Guard.AgainstNull(snippets, nameof(snippets)); Guard.AgainstNull(appendSnippetGroup, nameof(appendSnippetGroup)); this.snippets = snippets; this.appendSnippetGroup = appendSnippetGroup; }
public MarkdownProcessor( IEnumerable <Snippet> snippets, AppendSnippetGroupToMarkdown appendSnippetGroup) { Guard.AgainstNull(snippets, nameof(snippets)); Guard.AgainstNull(appendSnippetGroup, nameof(appendSnippetGroup)); this.snippets = snippets.ToDictionary(); this.appendSnippetGroup = appendSnippetGroup; }
public MarkdownProcessor( ReadSnippets snippets, AppendSnippetGroupToMarkdown appendSnippetGroup) { Guard.AgainstNull(snippets, nameof(snippets)); Guard.AgainstNull(appendSnippetGroup, nameof(appendSnippetGroup)); Guard.AgainstNull(snippetSourceFiles, nameof(snippetSourceFiles)); this.snippets = snippets.ToDictionary(); this.appendSnippetGroup = appendSnippetGroup; InitSourceFiles(snippets.Files); }
public DirectoryMarkdownProcessor( string targetDirectory, bool scanForMdFiles = true, bool scanForSnippets = true, bool scanForIncludes = true, Action <string>?log = null, AppendSnippetGroupToMarkdown?appendSnippetGroup = null, bool writeHeader = true, string?header = null, DirectoryFilter?directoryFilter = null, bool readOnly = false, LinkFormat linkFormat = LinkFormat.GitHub, int tocLevel = 2, IEnumerable <string>?tocExcludes = null, bool treatMissingSnippetAsWarning = false, bool treatMissingIncludeAsWarning = false, int maxWidth = int.MaxValue, string?urlPrefix = null, bool validateContent = false) { this.writeHeader = writeHeader; this.validateContent = validateContent; this.header = header; this.urlPrefix = urlPrefix; this.directoryFilter = directoryFilter; this.readOnly = readOnly; this.tocLevel = tocLevel; this.tocExcludes = tocExcludes; this.maxWidth = maxWidth; this.treatMissingSnippetAsWarning = treatMissingSnippetAsWarning; this.treatMissingIncludeAsWarning = treatMissingIncludeAsWarning; this.appendSnippetGroup = appendSnippetGroup ?? new SnippetMarkdownHandling(targetDirectory, linkFormat, urlPrefix).AppendGroup; this.log = log ?? (s => { Trace.WriteLine(s); }); Guard.DirectoryExists(targetDirectory, nameof(targetDirectory)); this.targetDirectory = Path.GetFullPath(targetDirectory); if (scanForMdFiles) { AddMdFilesFrom(targetDirectory); } if (scanForSnippets) { AddSnippetsFrom(targetDirectory); } if (scanForIncludes) { AddIncludeFilesFrom(targetDirectory); } }
public MarkdownProcessor( IEnumerable <Snippet> snippets, AppendSnippetGroupToMarkdown appendSnippetGroup, IReadOnlyList <string> snippetSourceFiles) { Guard.AgainstNull(snippets, nameof(snippets)); Guard.AgainstNull(appendSnippetGroup, nameof(appendSnippetGroup)); Guard.AgainstNull(snippetSourceFiles, nameof(snippetSourceFiles)); this.snippets = snippets.ToDictionary(); this.appendSnippetGroup = appendSnippetGroup; InitSourceFiles(snippetSourceFiles); }
public MarkdownProcessor( IReadOnlyDictionary <string, IReadOnlyList <Snippet> > snippets, IReadOnlyList <Include> includes, AppendSnippetGroupToMarkdown appendSnippetGroup, IReadOnlyList <string> snippetSourceFiles, int tocLevel, bool writeHeader, string rootDirectory, bool validateContent, string?header = null, IEnumerable <string>?tocExcludes = null) { Guard.AgainstNull(snippets, nameof(snippets)); Guard.AgainstNull(appendSnippetGroup, nameof(appendSnippetGroup)); Guard.AgainstNull(snippetSourceFiles, nameof(snippetSourceFiles)); Guard.AgainstNull(includes, nameof(includes)); Guard.AgainstEmpty(header, nameof(header)); Guard.AgainstNegativeAndZero(tocLevel, nameof(tocLevel)); Guard.AgainstNullAndEmpty(rootDirectory, nameof(rootDirectory)); rootDirectory = Path.GetFullPath(rootDirectory); this.snippets = snippets; this.appendSnippetGroup = appendSnippetGroup; this.writeHeader = writeHeader; this.validateContent = validateContent; this.header = header; this.tocLevel = tocLevel; if (tocExcludes == null) { this.tocExcludes = new List <string>(); } else { this.tocExcludes = tocExcludes.ToList(); } this.snippetSourceFiles = snippetSourceFiles .Select(x => x.Replace('\\', '/')) .ToList(); includeProcessor = new IncludeProcessor(includes, rootDirectory); }
public DirectoryMarkdownProcessor( string targetDirectory, bool scanForMdFiles = true, bool scanForSnippets = true, Action <string> log = null, AppendSnippetGroupToMarkdown appendSnippetGroup = null, bool writeHeader = true) { this.writeHeader = writeHeader; if (appendSnippetGroup == null) { this.appendSnippetGroup = new SnippetMarkdownHandling(targetDirectory).AppendGroup; } else { this.appendSnippetGroup = appendSnippetGroup; } if (log == null) { this.log = s => { Trace.WriteLine(s); }; } else { this.log = log; } Guard.DirectoryExists(targetDirectory, nameof(targetDirectory)); this.targetDirectory = Path.GetFullPath(targetDirectory); if (scanForMdFiles) { IncludeMdFilesFrom(targetDirectory); } if (scanForSnippets) { IncludeSnippetsFrom(targetDirectory); } }