From 6301f63bd348109b8693a922f02e16d49205a8fd Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 9 Jan 2024 16:16:56 +0100 Subject: enable indentation for gemini templates --- src/View.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/View.php b/src/View.php index 1c29a67..10ce9db 100644 --- a/src/View.php +++ b/src/View.php @@ -40,6 +40,18 @@ class View */ public static function render(string $name, array $context = []): string { - return self::$twig->render($name, $context); + if (isset($_ENV['GEMINI'])) { + $string = self::$twig->render($name, $context); + $lines = explode(PHP_EOL, $string); + $output = ''; + + foreach ($lines as $line) { + $output .= ltrim($line, ' \t') . "\r\n"; + } + + return $output; + } else { + return self::$twig->render($name, $context); + } } } -- cgit v1.2.3