mirror of
https://github.com/YGGverse/bdoku.git
synced 2025-01-24 22:04:35 +00:00
append source and main page links to each article
This commit is contained in:
parent
4b9eb209c7
commit
2c898d7ab1
@ -15,7 +15,14 @@
|
||||
},
|
||||
"url":
|
||||
{
|
||||
"canonical":"http://.."
|
||||
"base":"gemini://..",
|
||||
"source":"http://.."
|
||||
}
|
||||
},
|
||||
"string":
|
||||
{
|
||||
"main":"Main page",
|
||||
"source":"Source",
|
||||
"actions":"Actions"
|
||||
}
|
||||
}
|
@ -125,13 +125,43 @@ $server->setHandler(
|
||||
{
|
||||
if ($path = $filesystem->getPagePathByUri($matches[1]))
|
||||
{
|
||||
$lines = [];
|
||||
|
||||
// Append actions header
|
||||
$lines[] = sprintf(
|
||||
'## %s',
|
||||
$config->string->actions
|
||||
);
|
||||
|
||||
// Append source and homepage link
|
||||
$lines[] = sprintf(
|
||||
'=> %s %s',
|
||||
$config->dokuwiki->url->base,
|
||||
$config->string->main
|
||||
);
|
||||
|
||||
// Append source link
|
||||
$lines[] = sprintf(
|
||||
'=> %s/%s %s',
|
||||
$config->dokuwiki->url->source,
|
||||
$matches[1],
|
||||
$config->string->source
|
||||
);
|
||||
|
||||
// Merge data lines
|
||||
$data = implode(
|
||||
PHP_EOL,
|
||||
$lines
|
||||
);
|
||||
|
||||
// Read document
|
||||
$reader = new \Yggverse\Gemini\Dokuwiki\Reader();
|
||||
|
||||
$response->setContent(
|
||||
$reader->toGemini(
|
||||
file_get_contents(
|
||||
$path
|
||||
)
|
||||
) . $data
|
||||
)
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user