Example #1
0
        //private static readonly ITemplateParser _templateParser = new ViciTemplateParser();


        internal static Template CreateTemplate(string templateFile, string destinationPath, bool onlyBody)
        {
            if (WebAppContext.Offline)
                return new Template(templateFile,destinationPath, onlyBody);

            string key = "TPL: " + destinationPath + ";" + templateFile;

            Template template = (Template) WebAppContext.WebCache[key];

            if (template != null)
                return template;

            lock (_templateCacheLock)
            {
                template = (Template) WebAppContext.WebCache[key];

                if (template != null)
                    return template;

                template = new Template(templateFile, destinationPath, onlyBody);

                WebAppContext.WebCache.Insert(key, template, new CacheDependency(templateFile), Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(30));
            }

            return template;
        }
Example #2
0
        public TemplateParserContext(View view, Template template) : base(ParserContextBehavior.Falsy|ParserContextBehavior.ReturnNullWhenNullReference)
        {
            FormatProvider = WebAppConfig.FormatProvider;

            _template = template;
            _view = view;
        }
Example #3
0
 internal static Template CreateTemplate(Template callingTemplate, string templateName, bool onlyBody)
 {
     return CreateTemplate(templateName, callingTemplate._destinationPath, onlyBody);
 }
Example #4
0
 private TemplateParserContext(TemplateParserContext parentContext) : base(parentContext)
 {
     _template = parentContext.Template;
     _view = parentContext.View;
 }
Example #5
0
 public TemplateParserContext(TemplateParserContext parentContext, Template template) : base(parentContext)
 {
     _template = template;
     _view = parentContext.View;
 }