Processes the if and if-else conditions in the template.

@param {string} template The template to process.
@param {Object<string, *>} variables The variables that should be available
to the predicate expressions in the conditions.
@return {string} Processed template.
function evaluateConditions(template, variables) {
  let source;
  do {
    source = template;
    template = processSimpleConditions(template, variables);
    template = processIfElseConditions(template, variables);
  } while (source !== template);

  return template;
}