HtmlTextStream has now pt::Stream as a based class and uses pt::WTextStream as a buffer
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user