Clean up unused syntax

This commit is contained in:
2026-01-22 20:27:47 +01:00
parent 351485efb1
commit 912f9dcac6
10 changed files with 144 additions and 241 deletions

View File

@@ -16,25 +16,20 @@ class Output
/** @var array */
protected $files;
/** @var \DokuWiki_Plugin|null */
protected $plugin;
/** @var Path|false|null */
protected $openPathMapper = null;
public function __construct(\Doku_Renderer $renderer, $basedir, $webdir, $files)
public function __construct(\Doku_Renderer $renderer, $basedir, $webdir, $files, $plugin = null)
{
$this->renderer = $renderer;
$this->basedir = $basedir;
$this->webdir = $webdir;
$this->files = $files;
}
public function renderAsList($params)
{
$this->openContainer($params);
$this->renderListItems($this->files, $params);
$this->closeContainer();
$this->plugin = $plugin;
}
/**
@@ -49,8 +44,6 @@ class Output
public function renderAsGallery($params)
{
if (!($this->renderer instanceof \Doku_Renderer_xhtml)) {
$params['style'] = 'list';
$this->renderAsList($params);
return;
}
@@ -365,57 +358,6 @@ class Output
}
/**
* Recursively renders a tree of files as list items.
*
* @param array $items the files to render
* @param array $params the parameters of the filelist call
* @param int $level the level to render
* @return void
*/
protected function renderListItems($items, $params, $level = 1)
{
if ($params['style'] == 'olist') {
$this->renderer->listo_open();
} else {
$this->renderer->listu_open();
}
foreach ($items as $file) {
if ($file['children'] === false && $file['treesize'] === 0) continue; // empty directory
$this->renderer->listitem_open($level);
$this->renderer->listcontent_open();
if ($file['children'] !== false && $file['treesize'] > 0) {
// render the directory and its subtree
$this->renderer->cdata($file['name']);
$this->renderListItems($file['children'], $params, $level + 1);
} elseif ($file['children'] === false) {
// render the file link
$this->renderItemLink($file, $params['randlinks']);
// render filesize
if ($params['showsize']) {
$this->renderer->cdata($params['listsep'] . filesize_h($file['size']));
}
// render lastmodified
if ($params['showdate']) {
$this->renderer->cdata($params['listsep'] . dformat($file['mtime']));
}
}
$this->renderer->listcontent_close();
$this->renderer->listitem_close();
}
if ($params['style'] == 'olist') {
$this->renderer->listo_close();
} else {
$this->renderer->listu_close();
}
}
protected function renderItemLink($item, $cachebuster = false)
{
if (!empty($item['isdir'])) {
@@ -627,7 +569,16 @@ class Output
protected function getLang($key)
{
$syntax = plugin_load('syntax', 'luxtools');
return $syntax->getLang($key);
if ($this->plugin && method_exists($this->plugin, 'getLang')) {
return $this->plugin->getLang($key);
}
// Fallback: try loading any luxtools syntax component
$syntax = plugin_load('syntax', 'luxtools_directory');
if ($syntax) {
return $syntax->getLang($key);
}
return $key; // Return key if we can't load language strings
}
}