/// <summary> /// Returns the Export Template Placeholders for a Template Type /// </summary> /// <param name="templateType">Template Type</param> /// <param name="renderingEngine">Rendering engine</param> /// <returns>Export Template Placeholder</returns> public List <ExportTemplatePlaceholder> GetExportTemplatePlaceholdersForType(TemplateType templateType, ExportTemplateRenderingEngine renderingEngine) { if (!_renderers.ContainsKey(renderingEngine)) { throw new KeyNotFoundException(string.Format("Unknown rendering engine {0} for Condition {1}", renderingEngine.ToString(), _templateType.ToString())); } return(_renderers[renderingEngine].GetExportTemplatePlaceholdersForType(templateType)); }
/// <summary> /// Returns the placeholders for a template /// </summary> /// <param name="templateType">Template Type</param> /// <param name="renderingEngine">Rendering engine</param> /// <returns>List of template placeholders</returns> public List <ExportTemplatePlaceholder> GetPlaceholdersForTemplate(TemplateType templateType, ExportTemplateRenderingEngine renderingEngine) { if (!HasPlaceholdersForTemplateType(templateType)) { return(new List <ExportTemplatePlaceholder>()); } if (templateType == TemplateType.TaleAction) { if (!_renderers.ContainsKey(renderingEngine)) { throw new KeyNotFoundException(string.Format("Unknown rendering engine {0} for ActionNode", renderingEngine.ToString())); } return(_renderers[renderingEngine].GetPlaceholdersForTemplate(templateType)); } return(GetPlaceholdersForAction(templateType, renderingEngine)); }
/// <summary> /// Returns the placeholders for an action /// </summary> /// <param name="templateType">Template type</param> /// <param name="renderingEngine">Rendering engine</param> /// <returns>Placeholders</returns> private List <ExportTemplatePlaceholder> GetPlaceholdersForAction(TemplateType templateType, ExportTemplateRenderingEngine renderingEngine) { List <ExportTemplatePlaceholder> placeholders = new List <ExportTemplatePlaceholder>(); // Read template type for base placeholders from template rendering engine to allow mixed mode ExportTemplate template = _defaultTemplateProvider.GetDefaultTemplateByType(_project.Id, TemplateType.TaleAction).Result; if (!_renderers.ContainsKey(template.RenderingEngine)) { throw new KeyNotFoundException(string.Format("Unknown rendering engine {0} for ActionNode", renderingEngine.ToString())); } placeholders.AddRange(_renderers[template.RenderingEngine].GetPlaceholdersForTemplate(templateType)); foreach (ActionRendererDispatcher curRenderer in _actionRenderes.Values) { if (curRenderer.HasPlaceholdersForTemplateType(templateType)) { placeholders.AddRange(curRenderer.GetExportTemplatePlaceholdersForType(templateType, renderingEngine)); } } return(placeholders); }
/// <summary> /// Fills the placeholders of a code /// </summary> /// <param name="templateType">Template Type</param> /// <param name="code">Code to fill</param> /// <param name="data">Export Data</param> /// <param name="renderingEngine">Rendering Engine</param> /// <returns>Filled Code</returns> public async Task <ExportPlaceholderFillResult> FillPlaceholders(TemplateType templateType, string code, ExportObjectData data, ExportTemplateRenderingEngine renderingEngine) { if (!_renderingEngine.ContainsKey(renderingEngine)) { throw new KeyNotFoundException(string.Format("Unknown rendering engine {0}", renderingEngine.ToString())); } return(await _renderingEngine[renderingEngine].FillPlaceholders(templateType, code, data)); }