Browse Source

Séparer les plugins-dist des autres plugins core, dans l’index généré.

master
Matthieu Marcillaud 9 months ago
parent
commit
fa7676ebd5
  1. 2
      src/Git.php
  2. 24
      src/Stage/IndexStage.php
  3. 2
      templates/autodoc.css

2
src/Git.php

@ -54,7 +54,7 @@ class Git
*/
public function getRepositoryUrl(): ?string {
if (strpos($this->getUrl(), 'https://') === 0) {
return preg_replace('/[.]git$/', '', $this->getUrl());
return $this->getUrl();
}
return null;
}

24
src/Stage/IndexStage.php

@ -45,9 +45,15 @@ class IndexStage implements StageInterface {
/** @return array<string, stdClass> */
private function sort(array $list): array {
$groups = [];
$core = $this->find_plugins_dist_source($list);
// first sort by organization
// separe 'spip' and 'spip-core'
// separe plugins_dist into 'spip-dist'
foreach ($list as $project) {
$organization = basename(dirname($project->urls->repository ?: '')) ?: 'other';
if ($organization === 'spip' and $project->prefix !== 'spip') {
if (in_array($project->urls->repository, $core)) {
$organization = 'spip-dist';
} elseif ($organization === 'spip' and $project->prefix !== 'spip') {
$organization = 'spip-core';
}
$groups[$organization][] = $project;
@ -60,10 +66,26 @@ class IndexStage implements StageInterface {
return $groups;
}
private function find_plugins_dist_source(array $list): array {
$plugins = [];
foreach ($list as $project) {
if (
$project->prefix === 'spip'
and !empty($project->core_plugins)
) {
foreach ($project->core_plugins as $plugin) {
$plugins[] = $plugin->source;
}
}
}
return $plugins;
}
private function createIndex(Context $context, array $groups) {
$organizations = [
'spip' => 'SPIP',
'spip-dist' => 'Plugins Dist',
'spip-core' => 'Core',
'spip-contrib-extensions' => 'Plugins',
'spip-contrib-outils' => 'Outils',

2
templates/autodoc.css

@ -104,7 +104,7 @@ table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
margin: 1em 0 2em 0;
margin: 1em 0;
text-align: left;
}
table td,

Loading…
Cancel
Save