Create a Box based on the given template and return it.
550774
public function create(string $template) : Box
    {
        foreach ($this->paths as &$path) {
            // full path to template file without extension
            $file = \rtrim($path, '/') . '/' . \trim($template, '/');

            if (\file_exists($t = $file . '.php')) {
                return (new Box(
                        new Template($t),
                        new EvalRendererDecorator(
                            new NullRenderer())))
                            ->assign([
                                'markdown' => function($md) {
                                    return new Box(
                                        new Atom($md),
                                        new MarkdownRendererDecorator(
                                            new NullRenderer(), $this->parsedown));
                                }
                            ]);
            }

            if (\file_exists($t = $file . '.md.php')) {
                return (new Box(
                        new Template($t),
                        new MarkdownRendererDecorator(
                            new EvalRendererDecorator(
                                new NullRenderer()), $this->parsedown)))
                                ->assign([
                                    'markdown' => function($md) {
                                        return new Box(
                                            new Atom($md),
                                            new MarkdownRendererDecorator(
                                                new NullRenderer(), $this->parsedown));
                                    }
                                ]);
            }

            if (\file_exists($t = $file . '.md')) {
                return new Box(
                        new Template($t),
                        new MarkdownRendererDecorator(
                            new NullRenderer(), $this->parsedown));
            }

            if (\file_exists($t = $file . '.html')) {
                return new Box(
                        new Template($t),
                        new NullRenderer());
            }
        }

        throw new \RuntimeException(\sprintf('Template "%s" not found.', $template));
    }
47522
def template(self):
        """"""
        return Template(
            self._env, lib.EnvFactDeftemplate(self._env, self._fact))
532426
def _get_template(querystring_key, mapping):
    """"""
    default = None
    try:
        template_and_keys = mapping.items()
    except AttributeError:
        template_and_keys = mapping
    for template, key in template_and_keys:
        if key is None:
            key = PAGE_LABEL
            default = template
        if key == querystring_key:
            return template
    return default
406671
function template(source, target) {
  source = source || {};
  target = target || {};
  for(var z in source) {
    target[z] = $.partial(source[z]);
  }
  return target;
}
218125
def from_template(cls, template):
        
        regex = r'#{\s*%s\s*}' % cls.ALLOWED_KEY
        keys = re.findall(regex, template)
        if len(keys) == 0:
            raise cls.Bad("Bad keys template: %s. Should be: \"%s\"" % (
                template, "a = #{key1}, b = #{key2.key3} ..."))
        return keys
793446
def template(colors, input_file, output_file=None):
    """"""
    template_data = util.read_file_raw(input_file)

    try:
        template_data = "".join(template_data).format(**colors)
    except ValueError:
        logging.error("Syntax error in template file '%s'.", input_file)
        return

    util.save_file(template_data, output_file)
1650
function createDomElementFromTemplate(html) {
    //match container markers like <@element/>
    let containerTags = html.match(rContainerGlobal) || [];

    for (let containerTag of containerTags) {
        let [, containerName, attrs = ''] = rContainer.exec(containerTag);
        let template = `<script type="x" ${ATTR}="${containerName}">${attrs.trim()}</script>`;

        html = html.split(containerTag).join(template);
    }

    //match attribute markers like <span @element></span>
    let allTags = html.match(rTags) || [];

    for (let tag of allTags) {
        let result = rAttr.exec(tag);

        if (result) {
            let elName = result[1];
            html = html.split(tag).join(tag.replace(`@${elName}`, `${ATTR}="${elName}"`));
        }
    }

    return $.create(html.trim());
}
83248
public static <T> T boxAllAs(Object src, int srcPos, int len, Class<T> type) {
        return (T) boxAll(type, src, srcPos, len);
    }
1193751
function createTemplateEngine(output) {
    var plugins = output.getPlugins();
    var book = output.getBook();
    var rootFolder = book.getContentRoot();
    var logger = book.getLogger();

    var filters = Plugins.listFilters(plugins);
    var blocks = Plugins.listBlocks(plugins);

    // Extend with default
    blocks = defaultBlocks.merge(blocks);
    filters = defaultFilters.merge(filters);

    // Create loader
    var transformFn = Templating.replaceShortcuts.bind(null, blocks);
    var loader = new Templating.ConrefsLoader(rootFolder, transformFn, logger);

    // Create API context
    var context = Api.encodeGlobal(output);

    return new TemplateEngine({
        filters:    filters,
        blocks:     blocks,
        loader:     loader,
        context:    context
    });
}
405964
def template(cls, address=None, target=None, commandtuple=None,
                 userdata=None, cmd2=-1, flags=None):
        """"""
        msgraw = bytearray([0x02, cls._code])
        msgraw.extend(bytes(cls._receivedSize))
        msg = ExtendedReceive.from_raw_message(msgraw)

        if commandtuple:
            cmd1 = commandtuple.get('cmd1')
            cmd2out = commandtuple.get('cmd2')
        else:
            cmd1 = None
            cmd2out = None

        if cmd2 is not -1:
            cmd2out = cmd2

        msg._address = Address(address)
        msg._target = Address(target)
        msg._messageFlags = MessageFlags(flags)
        msg._cmd1 = cmd1
        msg._cmd2 = cmd2out
        msg._userdata = Userdata.create_pattern(userdata)
        return msg
1233906
function(form, decorator, slots, lookup) {
        return build(form, decorator, function(form, field) {
          if (form.type === 'template') {
            return form.template;
          }
          return $templateCache.get(field.template);
        }, slots, undefined, undefined, lookup);

      }
434164
def create(state, host, ctid, template=None):
    '''
    
    '''

    # Check we don't already have a container with this CTID
    current_containers = host.fact.openvz_containers
    if ctid in current_containers:
        raise OperationError(
            'An OpenVZ container with CTID {0} already exists'.format(ctid),
        )

    args = ['{0}'.format(ctid)]

    if template:
        args.append('--ostemplate {0}'.format(template))

    yield 'vzctl create {0}'.format(' '.join(args))
623118
public function create()
	{
		$out	= $this->template;																	//  local copy of set template
		$out	= $this->loadNestedTemplates( $out );												//  search for nested templates and load them
		
		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'pre' )
				$out	= $plugin->work( $out );

 		$out	= preg_replace( '/<%--.*--%>/sU', '', $out );										//  remove template engine style comments
 		if( self::$removeComments )																	//  HTML comments should be removed
			$out	= preg_replace( '/<!--.+-->/sU', '', $out );									//  find and remove all HTML comments 
 		if( self::$removeOptional )																	//  optional parts should be removed
			$out	= preg_replace( '/<%\?--.+--%>/sU', '', $out );									//  find and remove optional parts
		else																						//  otherwise
			$out	= preg_replace( '/<%\?--(.+)--%>/sU', '\\1', $out );							//  find, remove markup but keep content

		foreach( $this->elements as $label => $element )											//  iterate over all registered element containers
		{
			$tmp = '';																				//  
			if( is_object( $element ) )																//  element is an object
			{
				if( !( $element instanceof $this->className ) )										//  object is not an template of this template engine
					continue;																		//  skip this one
				$element = $element->create();														//  render template before concat
			}
			$tmp	.= $element;
			$out	= preg_replace( '/<%(\?)?' . preg_quote( $label, '/' ) . '%>/', $tmp, $out );	//  find placeholder and set in content
 		}
		$out = preg_replace( '/<%\?.*%>/U', '', $out );    											//  remove left over optional placeholders
#        $out = preg_replace( '/\n\s+\n/', "\n", $out );												//  remove double line breaks

		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'post' )
				$out	= $plugin->work( $out );

		$tags = array();																			//  create container for left over placeholders
		if( preg_match_all( '/<%.*%>/U', $out, $tags ) === 0 )										//  no more placeholders left over
		    return $out; 																			//  return final result

		$tags	= array_shift( $tags );																//  
		foreach( $tags as $key => $value )
			$tags[$key]	= preg_replace( '@(<%\??)|%>@', "", $value );
		if( $this->fileName )
			throw new Exception_Template( Exception_Template::FILE_LABELS_MISSING, $this->fileName, $tags );
		throw new Exception_Template( Exception_Template::LABELS_MISSING, NULL, $tags );
	}
387730
def template(basedir, text, vars, lookup_fatal=True, expand_lists=False):
    '''  '''

    try:
        text = text.decode('utf-8')
    except UnicodeEncodeError:
        pass # already unicode
    text = varReplace(basedir, unicode(text), vars, lookup_fatal=lookup_fatal, expand_lists=expand_lists)
    return text
600134
def create(cls):
        

        class NewPopupCreateView(PopupCreateView, cls.parent_class):
            model = cls.model
            form_class = cls.form_class
            popup_name = cls.get_class_verbose_name()
            template_name = cls.get_template_name_create()
            permission_required = cls.get_permission_required('create')

            def get_context_data(self, **kwargs):
                kwargs.update(cls.context_for_all)
                kwargs.update(cls.context_for_create)
                return super(NewPopupCreateView, self).get_context_data(**kwargs)

        return NewPopupCreateView
929172
function() {
    boxes = _.map(_.range(N), function(i) {
        var box = Box.create();
        var view = BoxView.create({context: box});
        view.appendTo('#grid');
        box.set('number', i);
        return box;
    });
}
251418
def template(path, source, type = :template)
      if source
        template = Template.new(source, @context, source_path: path)
      else
        template_path = case type
                        when :partial
                          find_partial(path)
                        when :layout
                          find_layout(path)
                        else
                          path
                        end

        if template_path && File.exist?(template_path)
          template = Template.open(template_path, @context)
        else
          template_not_found!(type, path)
        end
      end

      prevent_recursion!(template)

      template
    end