Browse Source

Lien vers la source sur les éléments documentés

master
Matthieu Marcillaud 6 months ago
parent
commit
f05bd743a2
  1. 17
      phpdoc/template/components/element-found-in.html.twig
  2. 4
      phpdoc/template/css/custom.css.twig
  3. 1
      src/Context.php
  4. 4
      src/Stage/PhpDocumentorStage.php
  5. 1
      templates/phpdoc.xml.twig

17
phpdoc/template/components/element-found-in.html.twig vendored

@ -0,0 +1,17 @@
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="{{ node.file.path }}">{{ node.file|route('file:short') }}</abbr>
:
<span class="phpdocumentor-element-found-in__line">{{ node.line }}</span>
{% if project.settings.custom['package.url_repository'] %}
{% set custom = project.settings.custom %}
{% set url = custom['package.url_repository']|replace({'.git': ''}) %}
{% set url = url ~ '/src/branch/%s/%s'|format(custom['package.branch'], node.file.path) %}
{% set url = url ~ '#L%s'|format( node.line ) %}
<a href="{{ url }}" class="phpdocumentor-element-found-in__repository">Source</a>
{% endif %}
{% if node.file.source %}
<a href="{{ target_path }}#source-view.{{ node.line }}" class="phpdocumentor-element-found-in__source" data-line="{{ node.line }}" data-modal="source-view"></a>
{% endif %}
</aside>

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

@ -153,7 +153,9 @@ html.avec_boussole_topnav body .autodoc-header {
border-top-right-radius: var(--spip-border-radius);
}
.phpdocumentor-element-found-in__repository {
padding-left: 1em;
}
.phpdocumentor-element.-constant,

1
src/Context.php

@ -39,6 +39,7 @@ class Context extends Container
'config_directory' => dirname(__DIR__) . '/phpdoc',
'options' => new Container([
'force' => false,
'sourcecode' => false,
])
]));
}

4
src/Stage/PhpDocumentorStage.php

@ -19,7 +19,9 @@ class PhpDocumentorStage implements StageInterface
if ($context->phpdocumentor->options->force) {
$cmd .= ' --force';
}
// --sourcecode
if ($context->phpdocumentor->options->sourcecode) {
$cmd .= ' --sourcecode';
}
/** @var SymfonyStyle */
$io = $context->get('io');

1
templates/phpdoc.xml.twig

@ -50,6 +50,7 @@
<setting name="package.description" value="{{ package.description|e('html_attr') }}"/>
<setting name="package.presentation" value="{{ package.presentation|e('html_attr') }}"/>
<setting name="package.version" value="{{ package.version }}"/>
<setting name="package.branch" value="{{ git.branch }}"/>
<setting name="package.revision" value="{{ git.commit }}"/>
<setting name="package.url_package" value="{{ package.url_package }}"/>
<setting name="package.url_documentation" value="{{ package.url_documentation }}"/>

Loading…
Cancel
Save