/// <summary> /// read all tags /// </summary> /// <param name="text">text content</param> /// <returns></returns> public ITag[] ReadAll(string text) { if (string.IsNullOrEmpty(text)) { return(new ITag[0]); } var findOnCache = this.Context.EnableTemplateCache && !string.IsNullOrEmpty(this.TemplateKey) && !Engine.EnableCompile; ITag[] tags; if (findOnCache && (tags = Runtime.Cache.Get <ITag[]>(this.TemplateKey)) != null) { return(tags); } var lexer = new TemplateLexer(text); var ts = lexer.Execute(); var parser = new TemplateParser(ts); tags = parser.Execute(); if (findOnCache) { Runtime.Cache.Set(this.TemplateKey, tags); } return(tags); }
/// <summary> /// /// </summary> /// <returns></returns> private ITag[] ParseTags() { var lexer = new TemplateLexer(this._content); var ts = lexer.Execute(); var parser = new TemplateParser(ts); return(parser.Execute()); }