simplify code
This commit is contained in:
parent
4d6744dc63
commit
fe86e2ce50
@ -56,5 +56,5 @@ std::string render_context::render(const template_type& templt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string render_context::render_partial(const std::string& partial_name) {
|
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)) : "";
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ void template_type::tokenize(const std::string& tmp) {
|
|||||||
for (unsigned long cur_pos = 0; cur_pos < tmp.size();) {
|
for (unsigned long cur_pos = 0; cur_pos < tmp.size();) {
|
||||||
auto open_pos = tmp.find(open, cur_pos);
|
auto open_pos = tmp.find(open, cur_pos);
|
||||||
auto close_pos = tmp.find(
|
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 (close_pos != npos && open_pos != npos) {
|
||||||
if (*(beg + open_pos + open.size()) == '{' &&
|
if (*(beg + open_pos + open.size()) == '{' &&
|
||||||
@ -66,7 +66,7 @@ void template_type::strip_whitespace() {
|
|||||||
if ((*it).eol()) {
|
if ((*it).eol()) {
|
||||||
if (has_tag && !non_space)
|
if (has_tag && !non_space)
|
||||||
for (auto cur = line_begin; it != cur - 1;
|
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;
|
it = (*cur).eol() ? cur - 1 : it;
|
||||||
|
|
||||||
non_space = has_tag = false;
|
non_space = has_tag = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user