internal List<ManifestItem> Process(List<InternalManifestItem> manifest, DocumentBuildContext context, ApplyTemplateSettings settings, IDictionary<string, object> globals = null)
{
using (new LoggerPhaseScope("Apply Templates", true))
{
if (globals == null)
{
globals = Tokens.ToDictionary(pair => pair.Key, pair => (object)pair.Value);
}
var documentTypes = manifest.Select(s => s.DocumentType).Distinct();
var notSupportedDocumentTypes = documentTypes.Where(s => s != "Resource" && _templateCollection[s] == null);
if (notSupportedDocumentTypes.Any())
{
Logger.LogWarning($"There is no template processing document type(s): {TypeForwardedToStringExtension.ToDelimitedString(notSupportedDocumentTypes)}");
}
Logger.LogInfo($"Applying templates to {manifest.Count} model(s)...");
if (settings.Options.HasFlag(ApplyTemplateOptions.TransformDocument))
{
var templatesInUse = documentTypes.Select(s => _templateCollection[s]).Where(s => s != null).ToList();
ProcessDependencies(settings.OutputFolder, templatesInUse);
}
else
{
Logger.LogInfo("Dryrun, no template will be applied to the documents.");
}
var templateManifest = ProcessCore(manifest, context, settings, globals);
return templateManifest;
}
}