Пример #1
0
        static LiquidViewTemplate()
        {
            FluidValue.TypeMappings.Add(typeof(Shape), o => new ObjectValue(o));
            FluidValue.TypeMappings.Add(typeof(ZoneHolding), o => new ObjectValue(o));

            TemplateContext.GlobalMemberAccessStrategy.Register <Shape>("*", new ShapeAccessor());
            TemplateContext.GlobalMemberAccessStrategy.Register <ZoneHolding>("*", new ShapeAccessor());

            Factory.RegisterTag <RenderBodyTag>("render_body");
            Factory.RegisterTag <RenderSectionTag>("render_section");
            Factory.RegisterTag <RenderTitleSegmentsTag>("page_title");
            Factory.RegisterTag <DisplayTag>("display");
            Factory.RegisterTag <AntiForgeryTokenTag>("antiforgerytoken");

            Factory.RegisterTag <HelperTag>("helper");
            Factory.RegisterTag <NamedHelperTag>("shape");
            Factory.RegisterTag <NamedHelperTag>("link");
            Factory.RegisterTag <NamedHelperTag>("meta");
            Factory.RegisterTag <NamedHelperTag>("resources");
            Factory.RegisterTag <NamedHelperTag>("script");
            Factory.RegisterTag <NamedHelperTag>("style");

            Factory.RegisterBlock <HelperBlock>("block");
            Factory.RegisterBlock <NamedHelperBlock>("a");
            Factory.RegisterBlock <NamedHelperBlock>("zone");

            NamedHelperTag.RegisterDefaultArgument("shape", "type");
            NamedHelperBlock.RegisterDefaultArgument("zone", "name");

            TemplateContext.GlobalFilters.WithLiquidViewFilters();
        }
Пример #2
0
        static LiquidViewTemplate()
        {
            FluidValue.SetTypeMapping <Shape>(o => new ObjectValue(o));
            FluidValue.SetTypeMapping <ZoneHolding>(o => new ObjectValue(o));

            TemplateContext.GlobalMemberAccessStrategy.Register <Shape>("*", new ShapeAccessor());
            TemplateContext.GlobalMemberAccessStrategy.Register <ZoneHolding>("*", new ShapeAccessor());

            Factory.RegisterTag <RenderBodyTag>("render_body");
            Factory.RegisterTag <RenderSectionTag>("render_section");
            Factory.RegisterTag <RenderTitleSegmentsTag>("page_title");
            Factory.RegisterTag <AntiForgeryTokenTag>("antiforgerytoken");
            Factory.RegisterTag <LayoutTag>("layout");

            Factory.RegisterTag <ClearAlternatesTag>("shape_clear_alternates");
            Factory.RegisterTag <AddAlternatesTag>("shape_add_alternates");
            Factory.RegisterTag <ClearWrappers>("shape_clear_wrappers");
            Factory.RegisterTag <AddWrappersTag>("shape_add_wrappers");
            Factory.RegisterTag <ClearClassesTag>("shape_clear_classes");
            Factory.RegisterTag <AddClassesTag>("shape_add_classes");
            Factory.RegisterTag <ClearAttributesTag>("shape_clear_attributes");
            Factory.RegisterTag <AddAttributesTag>("shape_add_attributes");
            Factory.RegisterTag <ShapeTypeTag>("shape_type");
            Factory.RegisterTag <ShapeDisplayTypeTag>("shape_display_type");
            Factory.RegisterTag <ShapePositionTag>("shape_position");
            Factory.RegisterTag <ShapeCacheTag>("shape_cache");
            Factory.RegisterTag <ShapeTabTag>("shape_tab");
            Factory.RegisterTag <ShapeRemoveItemTag>("shape_remove_item");
            Factory.RegisterTag <ShapeAddPropertyTag>("shape_add_properties");
            Factory.RegisterTag <ShapeRemovePropertyTag>("shape_remove_property");
            Factory.RegisterTag <ShapePagerTag>("shape_pager");

            Factory.RegisterTag <HelperTag>("helper");
            Factory.RegisterTag <NamedHelperTag>("shape");
            Factory.RegisterTag <NamedHelperTag>("contentitem");
            Factory.RegisterTag <NamedHelperTag>("link");
            Factory.RegisterTag <NamedHelperTag>("meta");
            Factory.RegisterTag <NamedHelperTag>("resources");
            Factory.RegisterTag <NamedHelperTag>("script");
            Factory.RegisterTag <NamedHelperTag>("style");

            Factory.RegisterBlock <HelperBlock>("block");
            Factory.RegisterBlock <NamedHelperBlock>("a");
            Factory.RegisterBlock <NamedHelperBlock>("zone");
            Factory.RegisterBlock <NamedHelperBlock>("scriptblock");

            // Dynamic caching
            Factory.RegisterBlock <CacheBlock>("cache");
            Factory.RegisterTag <CacheDependencyTag>("cache_dependency");
            Factory.RegisterTag <CacheExpiresOnTag>("cache_expires_on");
            Factory.RegisterTag <CacheExpiresAfterTag>("cache_expires_after");
            Factory.RegisterTag <CacheExpiresSlidingTag>("cache_expires_sliding");

            NamedHelperTag.RegisterDefaultArgument("shape", "type");
            NamedHelperBlock.RegisterDefaultArgument("zone", "name");

            TemplateContext.GlobalFilters.WithLiquidViewFilters();
        }