public TemplateModelTransformer(DocumentBuildContext context, TemplateCollection templateCollection, ApplyTemplateSettings settings, IDictionary <string, object> globals) { _context = context ?? throw new ArgumentNullException(nameof(context)); _templateCollection = templateCollection; _settings = settings; _globalVariables = globals; }
/// <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(ResourceCollection resourceProvider, DocumentBuildContext context, int maxParallelism = 0) { if (maxParallelism <= 0) { maxParallelism = Environment.ProcessorCount; } _resourceProvider = resourceProvider; _templateCollection = new TemplateCollection(resourceProvider, context, maxParallelism); Tokens = LoadTokenJson(resourceProvider) ?? new Dictionary <string, string>(); }
/// <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(ResourceCollection resourceProvider, int maxParallelism = 0) { if (maxParallelism <= 0) { maxParallelism = Environment.ProcessorCount; } _resourceProvider = resourceProvider; _templateCollection = new TemplateCollection(resourceProvider, maxParallelism); DefaultGlobalVariables = LoadGlobalJson(resourceProvider) ?? new Dictionary <string, object>(); }
public TemplateModelTransformer(DocumentBuildContext context, TemplateCollection templateCollection, ApplyTemplateSettings settings, IDictionary <string, object> globals) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _context = context; _templateCollection = templateCollection; _settings = settings; _globalVariables = globals; _systemMetadataGenerator = new SystemMetadataGenerator(context); }
/// <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 IEnumerable <TemplateResourceInfo> ExtractDependentFilePaths(TemplateCollection templates) { return(templates.Values.SelectMany(s => s).SelectMany(s => s.Resources)); }
/// <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(ResourceCollection resourceProvider, int maxParallelism) { _resourceProvider = resourceProvider; _global = LoadGlobalJson(resourceProvider); Templates = new TemplateCollection(resourceProvider, maxParallelism); }