Example #1
0
        /// <summary>
        /// 加载模板文件,
        /// </summary>
        /// <param name="file">模板文件相对路径,/data/tmp.html</param>
        /// <returns></returns>
        public string template(string file)
        {
            HtmlTemplater ht = new HtmlTemplater();

            ht.setFile(file);
            return(ht.toString());
        }
Example #2
0
        public string template(JToken t)
        {
            StringBuilder sb = new StringBuilder();

            HtmlTemplater ht = new HtmlTemplater();

            if (t.Type == JTokenType.Array)
            {
                foreach (var jt in t)
                {
                    ht.setFile(jt.ToString());
                    sb.Append(ht.ToString());
                }
            }
            else if (t.Type == JTokenType.String)
            {
                ht.setFile(t.ToString());
                sb.Append(ht.toString());
            }
            return(sb.ToString());
        }