コード例 #1
0
        string IFileSystem.ReadTemplateFile(Context context, string templateName)
        {
            // Trim delimiters from the template name.
            templateName = templateName ?? string.Empty;
            templateName = templateName.Trim(@"'""".ToCharArray());

            try
            {
                var lavaContext = new DotLiquidRenderContext(context);

                // This method is called directly by the DotLiquid framework.
                // Therefore, we need to load the Lava template from the file and convert it to Liquid-compatible syntax before returning it to the DotLiquid engine.
                var lavaText = _lavaFileSystem.ReadTemplateFile(lavaContext, templateName);

                var liquidText = _lavaConverter.ConvertToLiquid(lavaText);

                return(liquidText);
            }
            catch
            {
                throw new LavaException("File Load Failed. The template \"{0}\" could not loaded.", templateName);
            }
        }
コード例 #2
0
        string ILavaFileSystem.ReadTemplateFile(ILavaRenderContext context, string templateName)
        {
            var content = _fileSystem.ReadTemplateFile(context, templateName);

            return(content);
        }