docs: function automat(template, replacements/*...*/) {
      var hasReplacements = arguments.length > 1;
  
      // if `template` is a function, convert it to text
      if (typeof template === 'function') {
          template = template.call(this); // non-template function: call it with context and use return value
      }
  
      if (hasReplacements) {
          var args = arguments;
          template = template.replace(automat.replacersRegex, function(match, key) {
              key -= -1; // convert to number and increment
              return args.length > key ? args[key] : '';
          });
  
          template = template.replace(automat.encodersRegex, function(match, key) {
              key -= -1; // convert to number and increment
              if (args.length > key) {
                  var htmlEncoderNode = document.createElement('DIV');
                  htmlEncoderNode.textContent = args[key];
                  return htmlEncoderNode.innerHTML;
              } else {
                  return '';
              }
          });
      }
  
      return template;
  }