(ezc): generate only requested frames
This commit is contained in:
@@ -637,7 +637,7 @@ void Item::execute(EzcEnv & env)
|
|||||||
|
|
||||||
Ezc::Pattern * p = pattern_cacher->GetPattern(*this);
|
Ezc::Pattern * p = pattern_cacher->GetPattern(*this);
|
||||||
|
|
||||||
TemplatesFunctions::InitGenerator(ezc_generator, request->models);
|
TemplatesFunctions::InitGenerator(ezc_generator, *request);
|
||||||
ezc_generator.SetPattern(*p);
|
ezc_generator.SetPattern(*p);
|
||||||
|
|
||||||
if( config->allow_ezc_frames_in_executable_items )
|
if( config->allow_ezc_frames_in_executable_items )
|
||||||
|
@@ -354,7 +354,7 @@ void thread_sort_tab_run(Info & i)
|
|||||||
Ezc::Pattern * p = pattern_cacher.GetPattern(*thread_info.item_sort_tab[item_sort_index]);
|
Ezc::Pattern * p = pattern_cacher.GetPattern(*thread_info.item_sort_tab[item_sort_index]);
|
||||||
|
|
||||||
item_run_content.clear();
|
item_run_content.clear();
|
||||||
InitGenerator(ezc_generator, cur->request->models);
|
InitGenerator(ezc_generator, *cur->request);
|
||||||
ezc_generator.SetPattern(*p);
|
ezc_generator.SetPattern(*p);
|
||||||
ezc_generator.Generate(item_run_content);
|
ezc_generator.Generate(item_run_content);
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ void insert_page_run(Info & i)
|
|||||||
|
|
||||||
info.run_content.clear();
|
info.run_content.clear();
|
||||||
|
|
||||||
InitGenerator(info.ezc_gen, cur->request->models);
|
InitGenerator(info.ezc_gen, *cur->request);
|
||||||
info.ezc_gen.SetPattern(*pat);
|
info.ezc_gen.SetPattern(*pat);
|
||||||
info.ezc_gen.Generate(info.run_content);
|
info.ezc_gen.Generate(info.run_content);
|
||||||
ItemContent::print_content(i.out, info.run_content.get_buffer(), info.item.item_content.content_raw_type, config->html_filter);
|
ItemContent::print_content(i.out, info.run_content.get_buffer(), info.item.item_content.content_raw_type, config->html_filter);
|
||||||
|
@@ -40,8 +40,6 @@
|
|||||||
|
|
||||||
namespace Winix
|
namespace Winix
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
namespace TemplatesFunctions
|
namespace TemplatesFunctions
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -92,7 +90,7 @@ int was_enter = 0; // how many enteres there were before
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models)
|
void InitGenerator(EzcGen & gen, Request & request)
|
||||||
{
|
{
|
||||||
gen.TrimWhite(gen_trim_white);
|
gen.TrimWhite(gen_trim_white);
|
||||||
gen.SkipNewLine(gen_skip_new_line);
|
gen.SkipNewLine(gen_skip_new_line);
|
||||||
@@ -108,8 +106,17 @@ void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models)
|
|||||||
gen.SetFunctions(ezc_functions);
|
gen.SetFunctions(ezc_functions);
|
||||||
gen.SetVariables(ezc_vars);
|
gen.SetVariables(ezc_vars);
|
||||||
|
|
||||||
gen.SetModels(ezc_models);
|
gen.SetModels(request.models);
|
||||||
gen.SetLogger(log);
|
gen.SetLogger(log);
|
||||||
|
|
||||||
|
if( request.send_all_frames )
|
||||||
|
{
|
||||||
|
gen.OnlyFrames(nullptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gen.OnlyFrames(request.send_frames);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -43,9 +43,8 @@
|
|||||||
|
|
||||||
namespace Winix
|
namespace Winix
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
class User;
|
class User;
|
||||||
|
class Request;
|
||||||
|
|
||||||
// Ezc::FunInfo<> will be renamed to Ezc::Env<> in the future
|
// Ezc::FunInfo<> will be renamed to Ezc::Env<> in the future
|
||||||
typedef Ezc::FunInfo<HtmlTextStream> EzcEnv;
|
typedef Ezc::FunInfo<HtmlTextStream> EzcEnv;
|
||||||
@@ -66,7 +65,7 @@ HtmlTextStream::RawText<RawType> R(const RawType & par)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitGenerator(EzcGen & gen, Ezc::Models & ezc_models);
|
void InitGenerator(EzcGen & gen, Request & request);
|
||||||
|
|
||||||
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in);
|
void HtmlEscapeFormTxt(HtmlTextStream & out, const std::wstring & in);
|
||||||
|
|
||||||
|
@@ -168,7 +168,7 @@ Ezc::Pattern * pattern = 0;
|
|||||||
|
|
||||||
if( pattern )
|
if( pattern )
|
||||||
{
|
{
|
||||||
InitGenerator(content_gen, cur->request->models);
|
InitGenerator(content_gen, *cur->request);
|
||||||
content_gen.SetPattern(*pattern);
|
content_gen.SetPattern(*pattern);
|
||||||
content_gen.Generate(env.out, cur->request->out_streams);
|
content_gen.Generate(env.out, cur->request->out_streams);
|
||||||
}
|
}
|
||||||
@@ -1004,9 +1004,19 @@ using namespace TemplatesFunctions;
|
|||||||
|
|
||||||
if( index )
|
if( index )
|
||||||
{
|
{
|
||||||
InitGenerator(generator, cur->request->models);
|
InitGenerator(generator, *cur->request);
|
||||||
generator.SetPattern(*index);
|
generator.SetPattern(*index);
|
||||||
|
generator.UseMainStream(cur->request->send_main_stream);
|
||||||
generator.Generate(cur->request->out_main_stream, cur->request->out_streams);
|
generator.Generate(cur->request->out_main_stream, cur->request->out_streams);
|
||||||
|
|
||||||
|
// for debug purposes:
|
||||||
|
// log << log4 << "Templates: main stream size: " << cur->request->out_main_stream.size() << logend;
|
||||||
|
// log << log4 << "Templates: produced frames: " << logend;
|
||||||
|
|
||||||
|
// for(auto i=cur->request->out_streams.streams_map.begin() ; i != cur->request->out_streams.streams_map.end() ; ++i)
|
||||||
|
// {
|
||||||
|
// log << log4 << " frame name: " << i->first << ", size: " << i->second->size() << logend;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1016,20 +1026,6 @@ using namespace TemplatesFunctions;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Templates::Generate(Ezc::Pattern & pattern)
|
|
||||||
{
|
|
||||||
using namespace TemplatesFunctions;
|
|
||||||
|
|
||||||
ezc_vars.clear();
|
|
||||||
InitGenerator(generator, cur->request->models);
|
|
||||||
generator.SetPattern(pattern);
|
|
||||||
generator.Generate(cur->request->out_main_stream, cur->request->out_streams);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Templates::SetConfig(Config * pconfig)
|
void Templates::SetConfig(Config * pconfig)
|
||||||
{
|
{
|
||||||
TemplatesFunctions::config = pconfig;
|
TemplatesFunctions::config = pconfig;
|
||||||
|
@@ -584,7 +584,6 @@ public:
|
|||||||
void SetEzcParameters(bool trim_white, bool skip_new_line, bool use_special_chars);
|
void SetEzcParameters(bool trim_white, bool skip_new_line, bool use_special_chars);
|
||||||
|
|
||||||
void Generate();
|
void Generate();
|
||||||
void Generate(Ezc::Pattern & pattern);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user