Generate a file and renderd it.

@param string $content
@param array  $data

@return string
766795
public function generateAndRender($content, $data)
    {
        $filename = $this->generateViewFile($content);
        try {
            $rendered = $this->render($filename, $data);
        } catch (\Exception $e) {
            $this->remove($filename);
            throw $e;
        }

        $this->remove($filename);

        return $rendered;
    }
1070130
public function renderOutput($content, array $options)
    {
        $options = $this->transformOptions($options);
        $pdfGenerator = $this->createPdfGenerator();

        return $pdfGenerator->renderOutputFromHtml($content, $options);
    }
949119
public function renderFile(File $file, array $data = [])
    {
        $this->data($data);
        unset($data);

        $this->file = $file;
        $tmpDirectory = $this->engine->getProject()->currentWorkingDirectory.DIRECTORY_SEPARATOR.'.tmp';

        if ($layoutName = $file->getData('layout')) {
            $this->layoutName = (strpos('_templates', $layoutName) === false) ? '_templates'.DIRECTORY_SEPARATOR.$layoutName : $layoutName;
            $this->layoutData = $file->getData();
            $this->engine->getProject()->get('file_layout_cache')->merge([$this->file->getUid() => [$this->layoutName]]);
        }

        try {
            $tmpPathName = $tmpDirectory.DIRECTORY_SEPARATOR.time().'-'.sha1($file->getUid()).'.phtml';

            if (! file_exists($tmpDirectory)) {
                mkdir($tmpDirectory);
            }

            file_put_contents($tmpPathName, $file->getContent());

            $this->data($file->getData());
            $this->data([
                'permalink'     => $file->getCompiledPermalink(),
                'raw_permalink' => $file->getPermalink(),
            ]);

            extract($this->data);

            $level = ob_get_level();
            ob_start();
            include $tmpPathName;
            $content = ob_get_clean();

            if (isset($this->layoutName)) {
                $layout = $this->engine->make($this->layoutName);
                $layout->setFile($this->file);
                $layout->sections = array_merge($this->sections, ['content' => $content]);
                $content = $layout->render($this->layoutData);
            }

            return $content;
        } catch (Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }

            throw $e;
        } catch (Exception $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }

            throw $e;
        }
    }
593383
public function generateViewFile($content)
    {
        $name = $this->getRandomName();

        $path = sys_get_temp_dir();

        $filename = $path.'/'.$name.'.twig';

        if (!file_exists(dirname($filename))) {
            mkdir(dirname($filename), 0755, true);
        }

        file_put_contents($filename, $content);

        return $filename;
    }
1314044
public function exportFiles($content)
    {
        $uploadFiles = [];
        if ($content) {
            $dom = new DOMDocument;
            libxml_use_internal_errors(true);
            $dom->loadHTML($content);
            $tags = ['a' => 'href', 'img' => 'src'];
            foreach ($tags as $tag => $attribute) {
                foreach ($dom->getElementsByTagName($tag) as $node) {
                    $uploadFiles[] = $node->getAttribute($attribute);
                }
            }
            foreach ($uploadFiles as $k => $uploadFile) {
                if (strpos($uploadFile, '/uploads/') === 0 || strpos($uploadFile, URL::to('/')) === 0) {
                    $uploadFiles[$k] = str_replace(URL::to('/'), '', parse_url($uploadFile, PHP_URL_PATH));
                } else {
                    unset($uploadFiles[$k]);
                }
            }
        }
        return $uploadFiles;
    }
85098
public function render($file, $data = [])
    {
        $filepath = $this->findTemplateFile($file);
        extract($data);
        ob_start();
        include $filepath;
        $content = ob_get_contents();
        @ob_end_clean();
        return $content;
    }
922107
public function render($filename, array $data = [])
    {
        $filename = $this->checkParseFile($filename, false);

        return $this->template->render($filename, $data);
    }
105368
public function generateSearchText($content)
    {
        $content = $this->_defaultData($content);
        $searchText = $this->_generateSearchText($content->text, $content->colour);
        return parent::generateSearchText($searchText);
    }
423236
public function createFile($content, $node)
	{
		if(!file_exists(dirname($this->config['dir']['site'] . '/' . $node->getUrl())))
    	mkdir(dirname($this->config['dir']['site'] . '/' . $node->getUrl()), 0777, true);

    file_put_contents($this->config['dir']['site'] . '/' . $node->getUrl(), $content);
	}
580125
private function generateFile($content, $chunkPath, array $options)
    {
        $data = new ContentData($content, $options);

        $this->outputGenerator->reset();
        $this->outputGenerator->startDocument($data);

        $contents = array();
        foreach ($data->contents as $contentTypes) {
            foreach ($contentTypes as $contentType) {
                $contents[] = $contentType;
            }
        }

        $this->contentListElementGenerator->generateElement($this->outputGenerator, $contents);

        unset($contents);

        $filePath = $this->fileSystemHelper->getDir() . $chunkPath;
        $this->fileSystemHelper->save($filePath, $this->outputGenerator->endDocument($data));

        unset($data);

        $this->logger->info(sprintf('Generating file: %s', $filePath));
    }
1316060
public function generateSearchText($content)
    {
        $content = $this->_defaultData($content);
        $searchText = $this->_generateSearchText($content->selected, $content->price);
        return parent::generateSearchText($searchText);
    }
1253674
public function render($file, $data = [])
    {
        if ($this->value) {
            $view = $this->value->withData($data);
            $data = ['view' => $view];
        }
        return $this->renderer->render($file, $data);
    }
1299037
public function makeHtml($template, $data=null)
	{
		$content = $this->render($template, $data);
		return File::write($this->getHtmlFile($template), $content); 
	}
278107
private function createEventFromResponseContent(array $content): Event
    {
        $type = $content['eventType'];
        $version = (int) $content['eventNumber'];
        $data = $content['data'];
        $metadata = (!empty($content['metadata'])) ? $content['metadata'] : null;
        $eventId = (!empty($content['eventId']) ? UUID::fromNative($content['eventId']) : null);

        return new Event($type, $version, $data, $metadata, $eventId);
    }
419360
public function render(Content $content, $parameters)
    {
        return $this->markdownParser->transformMarkdown($this->getFileContent($content));
    }
1042764
protected function getFileContent(Content $content)
    {
        $text = @file_get_contents($this->contentPath . $content->getPath());

        // @codeCoverageIgnoreStart
        if(null === $this->getContentPath())
        {
            throw new ConfigurationException('ContentPath is not set. Call setContentPath before reading a file content.');
        }
        // @codeCoverageIgnoreEnd

        if(false === $text)
        {
            throw new RenderException('Unable to read: ' . $content->getPath() . '. Full path: ' . ($this->getContentPath() . $content->getPath()));
        }

        return $text;
    }
668581
public function renderBlade($content, $data = [])
    {
        $content = $this->compileBlade($content);
        $obLevel = ob_get_level();
        ob_start();
        extract($data, EXTR_SKIP);

        try {
            eval('?'.'>'.$content);
        } catch (\Exception $e) {
            while (ob_get_level() > $obLevel) {
                ob_end_clean();
            }
            throw $e;
        } catch (\Throwable $e) {
            while (ob_get_level() > $obLevel) {
                ob_end_clean();
            }
            throw new \Exception($e);
        }

        $contents = ob_get_clean();

        return $contents;
    }