Allow opening folder lisings on client
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled

This commit is contained in:
2026-01-06 10:13:12 +01:00
parent 30bb9e3bbd
commit dbc9de37e0
4 changed files with 84 additions and 2 deletions

View File

@@ -16,6 +16,9 @@ class Output
/** @var array */
protected $files;
/** @var Path|false|null */
protected $openPathMapper = null;
public function __construct(\Doku_Renderer $renderer, $basedir, $webdir, $files)
{
@@ -307,6 +310,8 @@ class Output
return;
}
$path = $this->mapOpenPath($path);
global $conf;
/** @var \Doku_Renderer_xhtml $renderer */
$renderer = $this->renderer;
@@ -336,6 +341,31 @@ class Output
$renderer->doc .= $renderer->_formatLink($link);
}
/**
* Map a filesystem path to an alias path (if configured).
*
* @param string $path
* @return string
*/
protected function mapOpenPath($path)
{
if ($this->openPathMapper === false) return $path;
if ($this->openPathMapper === null) {
$syntax = plugin_load('syntax', 'luxtools');
$pathConfig = $syntax ? (string)$syntax->getConf('paths') : '';
if (trim($pathConfig) === '') {
$this->openPathMapper = false;
return $path;
}
$this->openPathMapper = new Path($pathConfig);
}
return $this->openPathMapper->mapToAliasPath($path);
}
/**
* Render a file link on the XHTML renderer
*/