Beispiel #1
0
        protected virtual void ProcessInclude(string path)
        {
            TemplateParser subParser = new TemplateParser();

            try
            {
                subParser.ParseFile(path);

                foreach (TemplateExpression expr in subParser.Expressions)
                {
                    if (expr is DirectiveExpression)
                    {
                        continue;
                    }

                    Expressions.Add(expr);
                }
            }
            catch (Exception ex)
            {
                if (ex is HttpParseException)                 // если произошла ошибка разбора, кидаем, как есть.
                {
                    throw;
                }

                throw Error.CouldNotParseNestedTemplate(ex, _virtualPath, _lineNumber + 1);
            }
        }
        protected virtual CompiledTemplate CompileTemplate(TemplateInfo info)
        {
            TemplateParser parser   = new TemplateParser();
            ParsedTemplate template = parser.ParseFile(info.VirtualPath);

            JavaScriptTemplateCompiler compiler =
                new JavaScriptTemplateCompiler(info.Debug);

            if (!String.IsNullOrEmpty(info.BufferVariableName))
            {
                compiler.CodeBufferVariableName = info.BufferVariableName;
            }

            return(compiler.Build(template));
        }
		protected virtual void ProcessInclude(string path)
		{
			TemplateParser subParser = new TemplateParser();
			try
			{
				subParser.ParseFile(path);

				foreach (TemplateExpression expr in subParser.Expressions)
				{
					if (expr is DirectiveExpression)
						continue;

					Expressions.Add(expr);
				}
			}
			catch(Exception ex)
			{
				if (ex is HttpParseException) // если произошла ошибка разбора, кидаем, как есть.
					throw;

				throw Error.CouldNotParseNestedTemplate(ex, _virtualPath, _lineNumber + 1);
			}
		}
		protected virtual CompiledTemplate CompileTemplate(TemplateInfo info)
		{
			TemplateParser parser = new TemplateParser();
			ParsedTemplate template = parser.ParseFile(info.VirtualPath);

			JavaScriptTemplateCompiler compiler =
				new JavaScriptTemplateCompiler(info.Debug);

			if (!String.IsNullOrEmpty(info.BufferVariableName))
				compiler.CodeBufferVariableName = info.BufferVariableName;

			return compiler.Build(template);
		}