|
|
|
@ -16,7 +16,6 @@ use Symfony\Component\Filesystem\Filesystem;
|
|
|
|
|
*/
|
|
|
|
|
class PhpDocumentorConfigStage implements StageInterface
|
|
|
|
|
{
|
|
|
|
|
const TOPNAV_SPIP = '//boussole.spip.net/?page=spipnav.js&lang=fr';
|
|
|
|
|
|
|
|
|
|
public function __invoke(Context $context): Context
|
|
|
|
|
{
|
|
|
|
@ -84,24 +83,13 @@ class PhpDocumentorConfigStage implements StageInterface
|
|
|
|
|
|
|
|
|
|
private function generateConfig(Context $context) {
|
|
|
|
|
$template = new Template($context->directory->templates, $context->directory->config);
|
|
|
|
|
$topnav = match (true) {
|
|
|
|
|
!$context->empty('topnav_spip') => $this::TOPNAV_SPIP,
|
|
|
|
|
!$context->empty('topnav') => $context->get('topnav'),
|
|
|
|
|
default => null,
|
|
|
|
|
};
|
|
|
|
|
// FIXME: externaliser en config ...
|
|
|
|
|
$header = new stdClass();
|
|
|
|
|
$header->title = 'SPIP Code';
|
|
|
|
|
$header->subtitle = 'Documentation du code de SPIP et ses plugins';
|
|
|
|
|
$header->url = 'https://code.spip.net/';
|
|
|
|
|
$content = $template->render('phpdoc.xml.twig', [
|
|
|
|
|
'title' => $context->title,
|
|
|
|
|
'presentation' => $context->presentation,
|
|
|
|
|
'package' => $context->package,
|
|
|
|
|
'directory' => $context->directory,
|
|
|
|
|
'git' => $context->has('git') ? $context->git : null,
|
|
|
|
|
'topnav' => $topnav,
|
|
|
|
|
'header' => $header
|
|
|
|
|
'header' => $context->header,
|
|
|
|
|
]);
|
|
|
|
|
$file = 'phpdoc_' . ($context->package->prefix ?: $context->default_prefix) . '.xml';
|
|
|
|
|
$template->write($file, $content);
|
|
|
|
|