JumboTCMS_src/JumboTCMS.TEngine/TemplateManager.cs

(开头部分) 47KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using System.Reflection;
using System.IO;
using JumboTCMS.TEngine.Parser.AST;

namespace JumboTCMS.TEngine
{
    public delegate object TemplateFunction(object[] args);

    public class TemplateManager
    {
        bool silentErrors;

        Dictionary<string, TemplateFunction> functions;

        Dictionary<string, ITagHandler> customTags;

        VariableScope variables;		// current variable scope
        Expression currentExpression;	// current expression being evaluated

        TextWriter writer;				// all output is sent here

        Template mainTemplate;			// main template to execute
        Template currentTemplate;		// current template being executed

        ITemplateHandler handler;		// handler will be set as "this" object

        /// <summary>
        /// create template manager using a template
        /// </summary>
        public TemplateManager(Template template)
        {
            this.mainTemplate = template;
            this.currentTemplate = template;
            this.silentErrors = false;

            Init();
        }

        public static TemplateManager FromString(string template)
        {
            Template itemplate = Template.FromString("", template);
            return new TemplateManager(itemplate);
        }

        public static TemplateManager FromFile(string filename)
        {
            Template template = Template.FromFile("", filename);
            return new TemplateManager(template);
        }

        /// <summary>
        /// handler is used as "this" object, and will receive
        /// before after process message
        /// </summary>
        public ITemplateHandler Handler
后面还有 1367 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。