simplify code

This commit is contained in:
Daniel Sipka 2015-04-27 14:29:12 +02:00
parent 4d6744dc63
commit fe86e2ce50
2 changed files with 3 additions and 3 deletions

View File

@ -56,5 +56,5 @@ std::string render_context::render(const template_type& templt) {
}
std::string render_context::render_partial(const std::string& partial_name) {
return (partials.count(partial_name)) ? render(partials.at(partial_name)) :"";
return partials.count(partial_name) ? render(partials.at(partial_name)) : "";
}

View File

@ -26,7 +26,7 @@ void template_type::tokenize(const std::string& tmp) {
for (unsigned long cur_pos = 0; cur_pos < tmp.size();) {
auto open_pos = tmp.find(open, cur_pos);
auto close_pos = tmp.find(
close, (open_pos == npos) ? open_pos : (open_pos + 1));
close, open_pos == npos ? open_pos : open_pos + 1);
if (close_pos != npos && open_pos != npos) {
if (*(beg + open_pos + open.size()) == '{' &&
@ -66,7 +66,7 @@ void template_type::strip_whitespace() {
if ((*it).eol()) {
if (has_tag && !non_space)
for (auto cur = line_begin; it != cur - 1;
cur = (*cur).ws_only() ? tokens.erase(cur) : ++cur)
cur = (*cur).ws_only() ? tokens.erase(cur) : cur + 1)
it = (*cur).eol() ? cur - 1 : it;
non_space = has_tag = false;