Browse Source

On peut intégrer la barre nav et l’entête dans les docs

master
Matthieu Marcillaud 9 months ago
parent
commit
e5a1dde778
  1. 16
      phpdoc/template/components/header.html.twig
  2. 10
      phpdoc/template/components/header_origin.html.twig
  3. 84
      phpdoc/template/css/custom.css.twig
  4. BIN
      phpdoc/template/icons/autodoc.png
  5. 7
      src/Stage/PhpDocumentorConfigStage.php
  6. 3
      templates/phpdoc.xml.twig

16
phpdoc/template/components/header.html.twig vendored

@ -0,0 +1,16 @@
{% extends 'components/header_origin.html.twig' %}
{% block before_header %}
<header class="autodoc-header">
<div class='autodoc-container'>
<div class="autodoc-title">
<h1><a class="autodoc-url link-in" href="{{ project.settings.custom['header.url'] }}">{{ project.settings.custom['header.title'] }}</a></h1>
</div>
</div>
</header>
<div class="autodoc-navbar">
<div class="autodoc-container">
<strong class="autodoc-subtitle">{{ project.settings.custom['header.subtitle'] }}</strong>
</div>
</div>
{% endblock %}

10
phpdoc/template/components/header_origin.html.twig vendored

@ -0,0 +1,10 @@
{% block before_header %}{% endblock %}
<header class="phpdocumentor-header phpdocumentor-section">
{% include 'components/header-title.html.twig' %}
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
{{ include('components/search.html.twig') }}
{% include 'components/topnav.html.twig' %}
</header>

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

File diff suppressed because one or more lines are too long

BIN
phpdoc/template/icons/autodoc.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

7
src/Stage/PhpDocumentorConfigStage.php

@ -8,6 +8,7 @@ use Spip\Autodoc\Exception\ContextException;
use Spip\Autodoc\Git;
use Spip\Autodoc\Package;
use Spip\Autodoc\Template;
use stdClass;
use Symfony\Component\Filesystem\Filesystem;
/**
@ -85,6 +86,11 @@ class PhpDocumentorConfigStage implements StageInterface
!$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,
@ -92,6 +98,7 @@ class PhpDocumentorConfigStage implements StageInterface
'directory' => $context->directory,
'git' => $context->git,
'topnav' => $topnav,
'header' => $header
]);
$file = 'phpdoc_' . $context->package->prefix . '.xml';
$template->write($file, $content);

3
templates/phpdoc.xml.twig

@ -54,6 +54,9 @@
<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="header.url" value="{{ header.url }}"/>
<setting name="header.title" value="{{ header.title }}"/>
<setting name="header.subtitle" value="{{ header.subtitle }}"/>
<setting name="guides.enabled" value="{{ package.with_rst_documentation ? 'true' : 'false' }}"/>
<template name="default" />

Loading…
Cancel
Save