Example #1
0
        /// <summary>
        /// Parse the provided text into a compiled Lava template object. The resulting template can be used to render output with a variety of render contexts.
        /// </summary>
        /// <param name="inputTemplate"></param>
        /// <returns>A compiled template object.</returns>
        public static LavaParseResult ParseTemplate(string inputTemplate)
        {
            if (_engine == null)
            {
                return(null);
            }

            return(_engine.ParseTemplate(inputTemplate));
        }
        private WebsiteLavaTemplateCache Load(ILavaEngine engine, string content)
        {
            if (engine == null)
            {
                throw new Exception("WebsiteLavaTemplateCache template load failed. The cache must be initialized for a specific engine.");
            }

            var result = engine.ParseTemplate(content);

            var cacheEntry = new WebsiteLavaTemplateCache {
                Template = result.Template
            };

            return(cacheEntry);
        }
Example #3
0
        ILavaTemplate ILavaTemplateCacheService.GetOrAddTemplate(ILavaEngine engine, string templateContent, string cacheKey)
        {
            _cacheMisses++;

            return(engine.ParseTemplate(templateContent).Template);
        }