Browse Source

Intégrer la boussole spip sur l’index

master
Matthieu Marcillaud 9 months ago
parent
commit
e19778ecfa
  1. 1029
      old/GeneratorOld.php
  2. 4
      phpdoc/template/css/custom.css.twig
  3. 8
      src/Stage/IndexStage.php
  4. 8
      src/Stage/PhpDocumentorConfigStage.php
  5. 1
      templates/phpdoc.xml.twig

1029
old/GeneratorOld.php

File diff suppressed because it is too large Load Diff

4
phpdoc/template/css/custom.css.twig vendored

@ -30,6 +30,10 @@ a[href^="https://"]:after {
content: "⬈";
}
html.avec_boussole_topnav body .header {
padding-top: 45px;
}
.phpdocumentor-title {}
.phpdocumentor-sidebar__intro {
padding: .5em 1em;

8
src/Stage/IndexStage.php

@ -82,7 +82,6 @@ class IndexStage implements StageInterface {
}
private function createIndex(Context $context, array $groups) {
$organizations = [
'spip' => 'SPIP',
'spip-dist' => 'Plugins Dist',
@ -97,12 +96,19 @@ class IndexStage implements StageInterface {
$organizations[$other] = $other;
}
$topnav = match (true) {
!$context->empty('topnav_spip') => PhpDocumentorConfigStage::TOPNAV_SPIP,
!$context->empty('topnav') => $context->get('topnav'),
default => null,
};
$template = new Template($context->directory->templates, $context->directory->output_base);
$template->generate('index.html.twig', [
'title' => 'SPIP Code',
'subtitle' => 'Documentation du code de SPIP et ses plugins',
'groups' => $groups,
'organizations' => $organizations,
'topnav' => $topnav,
]);
}

8
src/Stage/PhpDocumentorConfigStage.php

@ -15,6 +15,8 @@ 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
{
$context->add('stages', $this::class);
@ -78,12 +80,18 @@ 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,
};
$content = $template->render('phpdoc.xml.twig', [
'title' => $context->title,
'presentation' => $context->presentation,
'package' => $context->package,
'directory' => $context->directory,
'git' => $context->git,
'topnav' => $topnav,
]);
$file = 'phpdoc_' . $context->package->prefix . '.xml';
$template->write($file, $content);

1
templates/phpdoc.xml.twig

@ -53,6 +53,7 @@
<setting name="package.url_documentation" value="{{ package.url_documentation }}"/>
<setting name="package.url_development" value="{{ package.url_development }}" />
<setting name="package.url_repository" value="{{ git.repositoryurl }}"/>
<setting name="js.topnav" value="{{ topnav }}"/>
<setting name="guides.enabled" value="{{ package.with_rst_documentation ? 'true' : 'false' }}"/>
<template name="default" />

Loading…
Cancel
Save