diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 4cbddfa9..3c5b1600 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -9,11 +9,5 @@
shell_exec($command)
-
- getChangeLogMd
- getInstallationMd
- getReadmeMd
- getUsageMd
-
diff --git a/src/Classes/IndexController.php b/src/Classes/IndexController.php
index 3a9016af..0cd9732b 100644
--- a/src/Classes/IndexController.php
+++ b/src/Classes/IndexController.php
@@ -308,6 +308,12 @@ public function invokeLazyModuleInfo()
$moduleLoader = ModuleLoader::create(Config::getDependenyMode());
$module = $moduleLoader->loadByArchiveNameAndVersion($archiveName, $version);
+ if (!$module) {
+ return ['content' => ''];
+ }
+
+ $description = $module->getDescriptionMd() !== '' ? $module->getDescriptionMd() : $module->getDescription();
+
if ($data == 'installationMd') {
return ['content' => $module->getInstallationMd()];
} elseif ($data == 'usageMd') {
@@ -316,6 +322,8 @@ public function invokeLazyModuleInfo()
return ['content' => $module->getChangeLogMd()];
} elseif ($data == 'readmeMd') {
return ['content' => $module->getReadmeMd()];
+ } elseif ($data == 'descriptionMd') {
+ return ['content' => $description];
}
}
diff --git a/src/Classes/LazyLoader.php b/src/Classes/LazyLoader.php
index 04b449cb..388607de 100644
--- a/src/Classes/LazyLoader.php
+++ b/src/Classes/LazyLoader.php
@@ -46,6 +46,12 @@ public static function loadModuleReadme($module, $target, $default = '')
return self::createScript($target, $url, $default);
}
+ public static function loadModuleDescription($module, $target, $default = '')
+ {
+ $url = self::createUrl($module, 'descriptionMd');
+ return self::createScript($target, $url, $default);
+ }
+
public static function loadModuleInstallation($module, $target, $default = '')
{
$url = self::createUrl($module, 'installationMd');
diff --git a/src/Classes/Module.php b/src/Classes/Module.php
index 90793205..034fee3e 100644
--- a/src/Classes/Module.php
+++ b/src/Classes/Module.php
@@ -415,6 +415,19 @@ public function getReadmeMd(): string
return FileHelper::readMarkdown($path);
}
+ /**
+ * Liefert die description.md als HTML.
+ */
+ public function getDescriptionMd(): string
+ {
+ $docFilePath = $this->getDocFilePath('description.md');
+ if (!$docFilePath) {
+ return '';
+ }
+ $path = $this->getUrlOrLocalRootPath() . $docFilePath;
+ return FileHelper::readMarkdown($path);
+ }
+
/**
* Liefert den absoluten Pfad zur modulehash.json
*
diff --git a/src/Templates/ModuleInfo.tmpl.php b/src/Templates/ModuleInfo.tmpl.php
index 733fdc34..37c9f40e 100644
--- a/src/Templates/ModuleInfo.tmpl.php
+++ b/src/Templates/ModuleInfo.tmpl.php
@@ -1,5 +1,9 @@
Beschreibung
-
-
- getDescription()) { ?>
- = $module->getDescription() ?>
-
- Keine Beschreibung vorhanden.
-
-
+
+
+ Beschreibung wird geladen. Bitte warten...
+
@@ -379,7 +379,7 @@
README.md Wird geladen. Bitte warten...
-
+
@@ -403,6 +403,7 @@
+ = LazyLoader::loadModuleDescription($module, '#description .markdown-body', 'Es ist keine Beschreibung vorhanden.'); ?>
= LazyLoader::loadModuleReadme($module, '#readme .markdown-body', 'Es ist keine README.md vorhanden.'); ?>
= LazyLoader::loadModuleInstallation($module, '#v-pills-install .markdown-body', 'Es ist keine manuelle Installationanleitung vorhanden.'); ?>
= LazyLoader::loadModuleUsage($module, '#v-pills-usage .markdown-body', 'Es ist keine Bedienungsanleitung vorhanden.'); ?>