Helper method for creating embedded template drafts.
            See public function for params.
326769
def _create_embedded_template_draft(self, client_id, signer_roles, test_mode=False, files=None, file_urls=None, title=None, subject=None, message=None, cc_roles=None, merge_fields=None, use_preexisting_fields=False):
        ''' 
        '''

        url = self.TEMPLATE_CREATE_EMBEDDED_DRAFT_URL

        payload = {
            'test_mode': self._boolean(test_mode),
            'client_id': client_id,
            'title': title,
            'subject': subject,
            'message': message,
            'use_preexisting_fields': self._boolean(use_preexisting_fields)
        }

        # Prep files
        files_payload = HSFormat.format_file_params(files)
        file_urls_payload = HSFormat.format_file_url_params(file_urls)

        # Prep Signer Roles
        signer_roles_payload = HSFormat.format_dict_list(signer_roles, 'signer_roles')
        # Prep CCs
        ccs_payload = HSFormat.format_param_list(cc_roles, 'cc_roles')
        # Prep Merge Fields
        merge_fields_payload = {
            'merge_fields': json.dumps(merge_fields)
        }

        # Assemble data for sending
        data = {}
        data.update(payload)
        data.update(file_urls_payload)
        data.update(signer_roles_payload)
        data.update(ccs_payload)
        if (merge_fields is not None):
            data.update(merge_fields_payload)
        data = HSFormat.strip_none_values(data)

        request = self._get_request()

        response = request.post(url, data=data, files=files_payload)

        return response
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 );
	}
805252
function(context, parent, args, container) {
		var name = args[0],
			template = args[1],
			node = document.createElement(name);
		template.toDOM(node, context, container);
		parent.appendChild(node);
	}
856234
def template_args(subparsers):
    """"""
    template_parser = subparsers.add_parser('template')
    template_parser.add_argument('template',
                                 help='Template source',
                                 nargs='?')
    template_parser.add_argument('destination',
                                 help='Path to write rendered template',
                                 nargs='?')
    template_parser.add_argument('vault_paths',
                                 help='Full path(s) to secret',
                                 nargs='*')
    template_parser.add_argument('--builtin-list',
                                 dest='builtin_list',
                                 help='Display a list of builtin templates',
                                 action='store_true',
                                 default=False)
    template_parser.add_argument('--builtin-info',
                                 dest='builtin_info',
                                 help='Display information on a '
                                 'particular builtin template')
    vars_args(template_parser)
    mapping_args(template_parser)
    base_args(template_parser)
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
    });
}
661359
def create_template_from_upload(create_template_data, opts = {})
      data, _status_code, _headers = create_template_from_upload_with_http_info(create_template_data, opts)
      data
    end
681417
public T addParams(Iterable<? extends TemplateParam> newParams) {

    Set<String> seenParamKeys = new HashSet<>();
    if (this.params == null) {
      this.params = ImmutableList.copyOf(newParams);
    } else {
      for (TemplateParam oldParam : this.params) {
        seenParamKeys.add(oldParam.name());
      }
      this.params =
          ImmutableList.<TemplateParam>builder().addAll(this.params).addAll(newParams).build();
    }

    // Check new params.
    for (TemplateParam param : newParams) {
      if (param.name().equals("ij")) {
        errorReporter.report(param.nameLocation(), INVALID_PARAM_NAMED_IJ);
      }
      if (!seenParamKeys.add(param.name())) {
        errorReporter.report(param.nameLocation(), PARAM_ALREADY_DECLARED, param.name());
      }
    }
    return (T) this;
  }
808224
public function createDraftValueSelection(FetchDraftStmtBuilder $fetchDraftStmtBuilder, DraftManager $dm,
			N2nContext $n2nContext): DraftValueSelection {
				
		$joinTableName = $this->getJoinTableName($fetchDraftStmtBuilder);
		
		$targetDraftDefinition = $this->getEiPropRelation()->getTargetEiMask()->getEiEngine()->getDraftDefinition();
		$targetFetchDraftStmtBuilder = $targetDraftDefinition->createFetchDraftStmtBuilder($dm, $n2nContext, 't');
		$targetStmtBuilder = $targetFetchDraftStmtBuilder->getSelectStatementBuilder();
		
		$phName = $targetFetchDraftStmtBuilder->createPlaceholderName();
		$targetStmtBuilder->addJoin(JoinType::INNER, new QueryTable($joinTableName), 'jt')
				->match(new QueryColumn(DraftMetaInfo::COLUMN_ID, 't'), '=', 
						new QueryColumn(self::JT_TARGET_DRAFT_ID_COLUMN, 'jt'));
				
		$targetStmtBuilder->getWhereComparator()->match(new QueryColumn(self::JT_DRAFT_ID_COLUMN, 'jt'), 
				'=', new QueryPlaceMarker($phName));
		$targetStmtBuilder->addOrderBy(new QueryColumn(self::JT_ORDER_INDEX, 'jt'), 'ASC');
		
		$targetDraftFetcher = $dm->createDraftFetcher($targetFetchDraftStmtBuilder, 
				$this->getEiPropRelation()->getTargetEiType(), $targetDraftDefinition);
		
		return new EmbeddedToManyDraftValueSelection($fetchDraftStmtBuilder, $targetDraftFetcher, $phName);
	}
701177
function makeSignature(params) {
	var r = ['('], desc;
	if ( params ) {
		for (var i = 0, p; (p = params[i]); i++) {
			// ignore @param tags for 'virtual' params that are used to document members of config-like params
			// (e.g. like "@param param1.key ...")
			if (p.name && p.name.indexOf('.') == -1) {
				if (i > 0) {
					r.push(', ');
				}

				r.push('<span');

				var types = listTypes(p.type, true);
				if ( (desc = asPlainSummary(p.description)) || types ) {
					r.push(' title="');
					if (types) {
						r.push('(');
						r.push(types);
						r.push(') ');
					}
					r.push(desc);
					r.push('"');
				}

				r.push('>');
				r.push(p.name);
				r.push('</span>');
				if ( p.optional ) {
					r.push('<i class="help" title="Optional parameter">?</i>');
				}
			}
		}
	}
	r.push(')');
	return r.join('');
}
303575
protected void generateJsOptionsForTemplateContent(final Map<String, Object> variables,
		final StringBuilder sb)
	{
		sb.append("{\n");
		int count = 1;
		Object localComponentId = null;
		if (withComponentId)
		{
			localComponentId = variables.get(COMPONENT_ID);
			variables.remove(COMPONENT_ID);
		}
		for (final Map.Entry<String, Object> entry : variables.entrySet())
		{
			final String key = entry.getKey();
			sb.append(key).append(": ${").append(key).append("}");
			if (count < variables.size())
			{
				sb.append(",\n");
			}
			else
			{
				sb.append("\n");
			}
			count++;
		}
		if (withComponentId)
		{
			variables.put(COMPONENT_ID, localComponentId);
		}
		sb.append("}");
	}
461961
public function createUnclaimedDraftEmbeddedWithTemplate(EmbeddedSignatureRequest $request)
    {
        $url = static::UNCLAIMED_DRAFT_CREATE_EMBEDDED_WITH_TEMPLATE_PATH;

        $response = $this->rest->post($url, $request->toParams());

        $this->checkResponse($response);

        $draft = new UnclaimedDraft();

        return $draft->fromResponse($response);
    }
656008
function template(url, params) {
	var templated = url;
	var keys = _.keys(params);
	var loweredKeys = _.map(keys, function (key) {
		return key.toLowerCase();
	});
	var keyLookup = _.zipObject(loweredKeys, keys);

	_.each(templateParams(url), function replaceParam(param) {
		var normalisedParam = param.toLowerCase().substr(1);

		if (!keyLookup[normalisedParam]) {
			throw new Error('Missing ' + normalisedParam);
		}

		templated = templated.replace(param,
			params[keyLookup[normalisedParam]]);
		delete params[keyLookup[normalisedParam]];
	});

	return templated;
}
179179
private String buildTemplates() {
		String[] templateString = new String[model.getTemplates().size()];
		for (int i = 0; i < (model.getTemplates().size()); i++) {
			String templateLoaded = loadTemplateFile(
					model.getTemplates().get(i));
			if (templateLoaded != null) {
				templateString[i] = templateLoaded;
			}
		}
		return implode(templateString, File.pathSeparator);
	}
1108491
function _createElements() {
        global $OUTPUT;

        // Get the calendar type used - see MDL-18375.
        $calendartype = \core_calendar\type_factory::get_calendar_instance();

        for ($i = 0; $i <= 23; $i++) {
            $hours[$i] = sprintf("%02d", $i);
        }
        for ($i = 0; $i < 60; $i += $this->_options['step']) {
            $minutes[$i] = sprintf("%02d", $i);
        }

        $this->_elements = array();
        $dateformat = $calendartype->get_date_order($this->_options['startyear'], $this->_options['stopyear']);
        if (right_to_left()) {   // Display time to the right of date, in RTL mode.
            $this->_elements[] = $this->createFormElement('select', 'minute', get_string('minute', 'form'),
                $minutes, $this->getAttributes(), true);
            $this->_elements[] = $this->createFormElement('select', 'hour', get_string('hour', 'form'),
                $hours, $this->getAttributes(), true);
            // Reverse date element (Should be: Day, Month, Year), in RTL mode.
            $dateformat = array_reverse($dateformat);
        }
        foreach ($dateformat as $key => $date) {
            // E_STRICT creating elements without forms is nasty because it internally uses $this
            $this->_elements[] = $this->createFormElement('select', $key, get_string($key, 'form'), $date, $this->getAttributes(), true);
        }
        if (!right_to_left()) {   // Display time to the left of date, in LTR mode.
            $this->_elements[] = $this->createFormElement('select', 'hour', get_string('hour', 'form'), $hours,
                $this->getAttributes(), true);
            $this->_elements[] = $this->createFormElement('select', 'minute', get_string('minute', 'form'), $minutes,
                $this->getAttributes(), true);
        }
        // The YUI2 calendar only supports the gregorian calendar type so only display the calendar image if this is being used.
        if ($calendartype->get_name() === 'gregorian') {
            $image = $OUTPUT->pix_icon('i/calendar', get_string('calendar', 'calendar'), 'moodle');
            $this->_elements[] = $this->createFormElement('link', 'calendar',
                    null, '#', $image,
                    array('class' => 'visibleifjs'));
        }
        // If optional we add a checkbox which the user can use to turn if on
        if ($this->_options['optional']) {
            $this->_elements[] = $this->createFormElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
        }
        foreach ($this->_elements as $element){
            if (method_exists($element, 'setHiddenLabel')){
                $element->setHiddenLabel(true);
            }
        }

    }
1227274
function createMarkdownSlide( content, options ) {

		options = getSlidifyOptions( options );

		var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );

		if( notesMatch.length === 2 ) {
			content = notesMatch[0] + '<aside class="notes" data-markdown>' + notesMatch[1].trim() + '</aside>';
		}

		return '<script type="text/template">' + content + '</script>';

	}
933740
function writeParameters(entry, out) {
    // If headers are in an object, convert them to an array for better
    // display.
    entry = reformatHeaders(entry);

    // Use any parameter writer available for this event type.
    const paramsWriter = getParameterWriterForEventType(entry.type);
    const consumedParams = {};
    if (paramsWriter) {
      paramsWriter(entry, out, consumedParams);
    }

    // Write any un-consumed parameters.
    for (const k in entry.params) {
      if (consumedParams[k]) {
        continue;
      }
      defaultWriteParameter(k, entry.params[k], out);
    }
  }
213624
function create()
    {
        $content = $this->loadContentTypes();
        $templates = $this->loadTemplates();
        restoreRequest();
        $form = array (
            'name' => 'createPage',
            'caption' => strAdd,
            'width' => '600px',
            'fields' => array (
                array ('type' => 'hidden','name'=>'owner','value'=>arg('owner', 'int')),
                array ('type' => 'hidden','name'=>'action', 'value'=>'insert'),
                array ('type' => 'edit','name' => 'name','label' => admPagesName,'width' => '150px',
                    'maxlength' => '32', 'pattern'=>'/^[a-z0-9_]+$/i', 'errormsg'=>admPagesNameInvalid),
                array ('type' => 'edit','name' => 'title','label' => admPagesTitle,'width' => '100%',
                    'pattern'=>'/.+/', 'errormsg'=>admPagesTitleInvalid),
                array ('type' => 'edit','name' => 'caption','label' => admPagesCaption,'width' => '100%',
                    'maxlength' => '64', 'pattern'=>'/.+/', 'errormsg'=>admPagesCaptionInvalid),
                array ('type' => 'edit','name' => 'hint','label' => admPagesHint,'width' => '100%'),
                array ('type' => 'edit','name' => 'description','label' => admPagesDescription,
                    'width' => '100%'),
                array ('type' => 'edit','name' => 'keywords','label' => admPagesKeywords,'width' => '100%'),
                array ('type' => 'select','name' => 'template','label' => admPagesTemplate,
                    'items' => $templates[0], 'values' => $templates[1], 'default'=>pageTemplateDefault),
                array ('type' => 'select','name' => 'type','label' => admPagesContentType,
                    'items' => $content[0], 'values' => $content[1], 'default'=>contentTypeDefault),
                array ('type' => 'checkbox','name' => 'active','label' => admPagesActive, 'default'=>true),
                array ('type' => 'checkbox','name' => 'visible','label' => admPagesVisible,
                    'default'=>true),
                array ('type' => 'select','name' => 'access','label' => admAccessLevel,'access' => ADMIN,
                    'values'=>array(ADMIN,EDITOR,USER,GUEST),
                    'items' => array (ACCESSLEVEL2,ACCESSLEVEL3,ACCESSLEVEL4,ACCESSLEVEL5),
                    'default' => GUEST),
                array ('type' => 'edit','name' => 'position','label' => admPosition,'access' => ADMIN,
                    'width' => '4em','maxlength' => '5'),
                array ('type' => 'memo','name' => 'options','label' => admPagesOptions,'height' => '5')
            ),
            'buttons' => array('ok', 'cancel'),
        );

        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $result = $page->renderForm($form, Eresus_CMS::getLegacyKernel()->request['arg']);
        return $result;
    }