From a053b31c36f6ba295faf42984ea58f5750185a6f Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 1 Feb 2024 16:43:58 +0200 Subject: [PATCH] define macros for base URL --- src/server.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/server.php b/src/server.php index 51510d8..5795828 100644 --- a/src/server.php +++ b/src/server.php @@ -164,6 +164,16 @@ $server->setHandler( // Read document $reader = new \Yggverse\Gemini\Dokuwiki\Reader(); + // Define base URL + $reader->setMacros( + '~URL:base~', + sprintf( + 'gemini://%s%s/', + $config->gemini->server->host, + $config->gemini->server->port == 1965 ? null : ':' . $config->gemini->server->port + ) + ); + $response->setContent( $reader->toGemini( file_get_contents(