コード例 #1
0
        /// <summary>
        /// Renders a text template.
        /// </summary>
        /// <param name="templateDefinition">The template definition</param>
        /// <param name="globalContext">A dictionary which can be used to import global objects to the template</param>
        /// <param name="model">An optional model object that is used in the template.</param>
        /// <returns>Returns the rendered text template.</returns>
        protected virtual async Task <string> RenderSingleTemplateAsync(
            TemplateDefinition templateDefinition,
            Dictionary <string, object> globalContext,
            object?model = null)
        {
            var rawTemplateContent = await TemplateContentProvider
                                     .GetContentAsync(
                templateDefinition
                );

            return(await RenderTemplateContentWithScribanAsync(
                       templateDefinition,
                       rawTemplateContent,
                       globalContext,
                       model
                       ));
        }