summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-01-09 16:16:56 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-01-09 16:16:56 +0100
commit6301f63bd348109b8693a922f02e16d49205a8fd (patch)
treeeda5b3bf547340c62540f64ad84c7f079803f497 /src
parente4351601a7ced91bf5a2c516a38db714d43e6ecf (diff)
enable indentation for gemini templates
Diffstat (limited to 'src')
-rw-r--r--src/View.php14
1 files changed, 13 insertions, 1 deletions
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);
+ }
}
}