HtmlTextStream has now pt::Stream as a based class and uses pt::WTextStream as a buffer
This commit is contained in:
@@ -633,7 +633,7 @@ void Item::execute(EzcEnv & env)
|
||||
else
|
||||
ezc_generator.Generate(item_run_content);
|
||||
|
||||
ItemContent::print_content(env.out, item_run_content.Str(), item_content.content_raw_type, config->html_filter);
|
||||
ItemContent::print_content(env.out, item_run_content.get_buffer(), item_content.content_raw_type, config->html_filter);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -389,6 +389,48 @@ bool ItemContent::CanContentBeHtmlFiltered()
|
||||
|
||||
|
||||
|
||||
void ItemContent::print_content(HtmlTextStream & out, const pt::WTextStream & content, ItemContent::ContentType content_type, bool is_html_filter_on)
|
||||
{
|
||||
using TemplatesFunctions::R;
|
||||
|
||||
if( is_html_filter_on && !ItemContent::CanContentBeHtmlFiltered(content_type) )
|
||||
out << R("<nofilter>");
|
||||
|
||||
if( content_type == ItemContent::ct_text )
|
||||
{
|
||||
out << content;
|
||||
}
|
||||
else
|
||||
if( content_type == ItemContent::ct_formatted_text )
|
||||
{
|
||||
std::wstring tmp_string;
|
||||
content.to_str(tmp_string);
|
||||
TemplatesFunctions::HtmlEscapeFormTxt(out, tmp_string);
|
||||
}
|
||||
else
|
||||
if( content_type == ItemContent::ct_bbcode )
|
||||
{
|
||||
static std::wstring out_temp;
|
||||
out_temp.clear();
|
||||
out_temp.reserve(content.size()*2);
|
||||
|
||||
BBCODEParser bbcode_parser; // IMPROVE ME move me to a better place
|
||||
std::wstring tmp_string;
|
||||
content.to_str(tmp_string);
|
||||
bbcode_parser.Filter(tmp_string.c_str(), out_temp);
|
||||
out << R(out_temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ct_html, ct_other
|
||||
out.get_buffer().operator<<(content); // tricky way of putting content without escaping
|
||||
}
|
||||
|
||||
if( is_html_filter_on && !ItemContent::CanContentBeHtmlFiltered(content_type) )
|
||||
out << R("</nofilter>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ItemContent::print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type, bool is_html_filter_on)
|
||||
{
|
||||
|
||||
@@ -254,6 +254,7 @@ public:
|
||||
bool do_migration(int & current_table_version);
|
||||
|
||||
static bool CanContentBeHtmlFiltered(ItemContent::ContentType ct);
|
||||
static void print_content(HtmlTextStream & out, const pt::WTextStream & content, ItemContent::ContentType content_type, bool is_html_filter_on);
|
||||
static void print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type, bool is_html_filter_on);
|
||||
|
||||
bool CanContentBeHtmlFiltered();
|
||||
|
||||
Reference in New Issue
Block a user