Generates the edit.html.twig template in the final bundle.
551061
protected function generateEditView(string $dir): void
    {
        $this->renderFile('crud/views/edit.html.twig.twig', $dir.'/edit.html.twig', [
            'route_prefix'      => $this->routePrefix,
            'route_name_prefix' => $this->routeNamePrefix,
            'entity'            => $this->entity,
            'bundle'            => $this->bundle->getName(),
            'actions'           => $this->actions,
        ]);
    }
1161495
function renderTemplate(impl, targetFile){
	var stappoImpl = fs.readFileSync(impl, "utf8");
	return gulp.src([targetFile])
		.pipe(replace('/*__stappo_impl__*/', stappoImpl));
}
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
    });
}
888461
function generate() {
    var parsed = ensureConfig();
    if (!parsed.name)
        mu.log.error('cannot generate template using name of undefined.\n').write().exit();
    // Generate the template.
    mu.render(parsed.name, parsed.output, parsed.options);
}
793628
def MakeExecutableTemplate(self, output_file=None):
    """"""
    super(DarwinClientBuilder,
          self).MakeExecutableTemplate(output_file=output_file)
    self.SetBuildVars()
    self.MakeBuildDirectory()
    self.BuildWithPyInstaller()
    self.CopyMissingModules()
    self.BuildInstallerPkg(output_file)
    self.MakeZip(output_file, self.template_file)
1194363
void generate( Application application, Collection<TemplateEntry> templates ) {

		try {
			synchronized( this.generationLock ) {
				TemplateUtils.generate( application, this.outputDIR, templates, this.logger );
			}

		} catch( IOException e ) {
			this.logger.warning( "An error occurred while generating files from templates for application " + application );
			Utils.logException( this.logger, e );

		} catch( Throwable e ) {
			this.logger.warning( "An unexpected error occurred while generating files from templates for application " + application );
			Utils.logException( this.logger, new UndeclaredThrowableException( e ));
		}
	}
1252043
function generateApplicationCode(swagger, codegenOptions) {
  debug('Generating application code.');

  // Build up the execution parameters for the templates.
  const templateFunc = codegenOptions.templateSet;
  const outputDirectory = codegenOptions.temporaryDirectory;
  const codegenSettings = defaults(
    templateFunc(codegenOptions.templateSettings),
    {
      output: (name, content) => {
        const fullName = path.join(outputDirectory, name);
        const parsed = path.parse(fullName);
        mkdirp.sync(parsed.dir);
        fs.writeFileSync(fullName, content);
      },
      swagger: JSON.parse(JSON.stringify(swagger)), // Clone to avoid issues
    });

  // Perform the actual code generation
  codegen(codegenSettings);
}
700937
private function copyTemplateConfig()
    {
        $dirPath = $this->bundle->getPath();
        $pagepartFile = $dirPath.'/Resources/config/pageparts/'.$this->template.'.yml';
        $namespace = $this->generateFormPageParts ? $this->bundle->getNamespace() : 'Kunstmaan\FormBundle';
        $this->filesystem->copy($this->skeletonDir.'/Resources/config/pageparts/formpage.yml', $pagepartFile, false);
        GeneratorUtils::replace('~~~ENTITY~~~', $this->entity, $pagepartFile);
        GeneratorUtils::replace('~~~FORM_BUNDLE~~~', $namespace, $pagepartFile);

        $pagetemplateFile = $dirPath.'/Resources/config/pagetemplates/'.$this->template.'.yml';
        $this->filesystem->copy($this->skeletonDir.'/Resources/config/pagetemplates/formpage.yml', $pagetemplateFile, false);
        GeneratorUtils::replace('~~~BUNDLE~~~', $this->bundle->getName(), $pagetemplateFile);
        GeneratorUtils::replace('~~~ENTITY~~~', $this->entity, $pagetemplateFile);
    }
87452
def generate_template(template_name, **context):
    """"""
    context.update(href=href, format_datetime=format_datetime)
    return template_loader.load(template_name).generate(**context)
473927
def render_template(opts={})
      template_file_path = File.expand_path(TEMPLATE_PATH, __FILE__)
      template_file = File.read(template_file_path)
      erb_template = ERB.new(template_file)
      last_bootstrap_line = LAST_BOOTSTRAP_LINE
      generated_template = erb_template.result(binding)
      @log.debug "genereated template is #{generated_template}"
      return generated_template
    end
686926
function createTemplateEngine(output, currentFile) {
    var book = output.getBook();
    var state = output.getState();
    var i18n = state.getI18n();
    var config = book.getConfig();
    var summary = book.getSummary();
    var outputFolder = output.getRoot();

    // Search paths for templates
    var searchPaths = listSearchPaths(output);
    var tplSearchPaths = searchPaths.map(templateFolder);

    // Create loader
    var loader = new Templating.ThemesLoader(tplSearchPaths);

    // Get languages
    var language = config.getValue('language');

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


    /**
     * Check if a file exists
     * @param {String} fileName
     * @return {Boolean}
     */
    function fileExists(fileName) {
        if (!fileName) {
            return false;
        }

        var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
        return fs.existsSync(filePath);
    }

    /**
     * Return an article by its path
     * @param {String} filePath
     * @return {Object|undefined}
     */
    function getArticleByPath(filePath) {
        var article = summary.getByPath(filePath);
        if (!article) return undefined;

        return JSONUtils.encodeSummaryArticle(article);
    }

    /**
     * Return a page by its path
     * @param {String} filePath
     * @return {Object|undefined}
     */
    function getPageByPath(filePath) {
        var page = output.getPage(filePath);
        if (!page) return undefined;

        return JSONUtils.encodePage(page, summary);
    }

    return TemplateEngine.create({
        loader: loader,

        context: context,

        globals: {
            getArticleByPath: getArticleByPath,
            getPageByPath: getPageByPath,
            fileExists: fileExists
        },

        filters: defaultFilters.merge({
            /**
             * Translate a sentence
             */
            t: function t(s) {
                return i18n.t(language, s);
            },

            /**
             * Resolve an absolute file path into a
             * relative path.
             * it also resolve pages
             */
            resolveFile: function(filePath) {
                filePath = resolveFileToURL(output, filePath);
                return LocationUtils.relativeForFile(currentFile, filePath);
            },

            resolveAsset: function(filePath) {
                filePath = LocationUtils.toAbsolute(filePath, '', '');
                filePath = path.join('gitbook', filePath);
                filePath = LocationUtils.relativeForFile(currentFile, filePath);

                // Use assets from parent if language book
                if (book.isLanguageBook()) {
                    filePath = path.join('../', filePath);
                }

                return LocationUtils.normalize(filePath);
            },


            fileExists: deprecate.method(book, 'fileExists', fileExists, 'Filter "fileExists" is deprecated, use "fileExists(filename)" '),
            getArticleByPath: deprecate.method(book, 'getArticleByPath', fileExists, 'Filter "getArticleByPath" is deprecated, use "getArticleByPath(filename)" '),

            contentURL: function(filePath) {
                return fileToURL(output, filePath);
            }
        }),

        extensions: {
            'DoExtension': new DoExtension()
        }
    });
}
216977
function run()
    {
        $loader = new Twig_Loader_Filesystem($this->templateDir);

        $twig = new Twig_Environment($loader);

        $GLOBALS['PHPDocMD_classDefinitions'] = $this->classDefinitions;
        $GLOBALS['PHPDocMD_linkTemplate'] = $this->linkTemplate;

        $filter = new Twig_SimpleFilter('classLink', ['PHPDocMd\\Generator', 'classLink']);
        $twig->addFilter($filter);

        foreach ($this->classDefinitions as $className => $data) {
            $output = $twig->render('class.twig', $data);

            file_put_contents($this->outputDir . '/' . $data['fileName'], $output);
        }

        $index = $this->createIndex();

        $index = $twig->render('index.twig',
            [
                'index'            => $index,
                'classDefinitions' => $this->classDefinitions,
            ]
        );

        file_put_contents($this->outputDir . '/' . $this->apiIndexFile, $index);
    }
688500
function generateCustomOutput(outputConfig) {

			// Accesses context
			var context = prepareBaseTemplateContext();
			_.extend(context, outputConfig.context);

			// Prepares config attributes related to template filepath
			var templatePath = outputConfig.template;
			var extension = path.extname(templatePath);
			var syntax = outputConfig.syntax || '';

			// Renders template with given context
			var template = readTemplate(templatePath, syntax, extension);
			var output = renderTemplate(template, context);

			// Prepares config attributes related to destination filepath
			var dest = outputConfig.dest || o.dest;

			var filepath;
			var destParent;
			var destName;

			if (path.extname(dest) === '') {
				// If user specifies a directory, filename should be same as template
				destParent = dest;
				destName = path.basename(outputConfig.template);
				filepath = path.join(dest, destName);
			}
			else {
				// If user specifies a file, that is our filepath
				destParent = path.dirname(dest);
				filepath = dest;
			}

			// Ensure existence of parent directory and output to file as desired
			mkdirp.sync(destParent);
			fs.writeFileSync(filepath, output);
		}
351457
public function compile()
	{
		if (TL_MODE == 'BE') {
			$this->strTemplate = 'be_wildcard';
			$this->Template = new \BackendTemplate($this->strTemplate);
			$this->Template->title = $this->headline;
		}
		else {
			$this->Template = new \FrontendTemplate($this->strTemplate);
			$this->Template->setData($this->arrData);
		}
	}
9605
function generateDemoHtml(done) {
			if (!o.htmlDemo) {
				done();
				return;
			}

			var context = prepareHtmlTemplateContext();

			// Generate HTML
			var demoTemplate = readTemplate(o.htmlDemoTemplate, 'demo', '.html');
			var demo = renderTemplate(demoTemplate, context);

			mkdirp(getDemoPath(), function(err) {
				if (err) {
					logger.log(err);
					return;
				}
				// Save file
				fs.writeFileSync(getDemoFilePath(), demo);
				done();
			});

		}
716702
private function generateResourceTemplate()
    {
        $params = array(
            'pagepart' => strtolower(
                    preg_replace('/([a-z])([A-Z])/', '$1-$2', str_ireplace('PagePart', '', $this->entity))
                ) . '-pp',
        );

        $this->renderSingleFile(
            $this->skeletonDir . '/Resources/views/PageParts/' . $this->entity . '/',
            $this->getTemplateDir($this->bundle) . '/PageParts/' . $this->entity . '/',
            'view.html.twig',
            $params,
            true
        );

        $this->renderSingleFile(
            $this->skeletonDir . '/Resources/views/PageParts/' . $this->entity . '/',
            $this->getTemplateDir($this->bundle) . '/PageParts/' . $this->entity . '/',
            'admin-view.html.twig',
            $params,
            true
        );

        $this->assistant->writeLine('Generating ' . $this->entity . ' template:     <info>OK</info>');
    }
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("}");
	}