/// <summary> /// TemplateName can be either file or folder /// 1. If TemplateName is file, it is considered as the default template /// 2. If TemplateName is a folder, files inside the folder is considered as the template, each file is named after {DocumentType}.{extension} /// </summary> /// <param name="templateName"></param> /// <param name="resourceProvider"></param> public TemplateProcessor(ResourceFileReader resourceProvider, DocumentBuildContext context, int maxParallelism = 0) { if (maxParallelism <= 0) { maxParallelism = Environment.ProcessorCount; } _context = context; _resourceProvider = resourceProvider; _maxParallelism = maxParallelism; _templateCollection = new TemplateCollection(resourceProvider, context, maxParallelism); Tokens = TemplateProcessorUtility.LoadTokens(resourceProvider) ?? new Dictionary <string, string>(); }
private MarkdigMarkdownService CreateMarkdigMarkdownService(DocumentBuildParameters parameters) { var resourceProvider = parameters.TemplateManager?.CreateTemplateResource(); return(new MarkdigMarkdownService( new MarkdownServiceParameters { BasePath = parameters.Files.DefaultBaseDir, TemplateDir = parameters.TemplateDir, Extensions = parameters.MarkdownEngineParameters, Tokens = TemplateProcessorUtility.LoadTokens(resourceProvider)?.ToImmutableDictionary(), }, new CompositionContainer(CompositionContainer.DefaultContainer))); }