Example #1
0
        public void TestCompileFunction()
        {
            var            temp = @"
$lang(home) 
$navigator()
${archive.data(视频)}
     <div>
              $categories('prod\,uct',{
                    <div class=""col-md-3 col-lg-2 col-sm-4"">
                        {name}
                    </div>
        }) </div>
";
            IDataContainer dc   = new NormalDataContainer();
            TemplatePage   tp   = new TemplatePage(dc);

            tp.TemplateHandleObject = new TemplateMock();
            tp.OnPreInit           += TemplateMock.CompliedTemplate;
            tp.OnBeforeCompile     += (TemplatePage page, ref String content) =>
            {
                var pageArchive = new PageArchive(new ArchiveDto());
                page.AddVariable("archive", pageArchive);
            };
            tp.SetTemplateContent(temp);
            var content = tp.Compile();

            Console.WriteLine(content);
        }
Example #2
0
        public void TestCompileFunction()
        {
            var temp = @"
     <div>
              $categories('prod\,uct',{
                    <div class=""col-md-3 col-lg-2 col-sm-4"">
                        {name}
                    </div>
               }) </div>
";

            TemplatePage tp = new TemplatePage(null);

            tp.TemplateHandleObject = new TemplateMock();
            tp.OnPreInit           += TemplateMock.CompliedTemplate;
            tp.TemplateContent      = temp;
            var content = tp.Compile();

            Console.WriteLine(content);
        }