Changeset 74904 in spip-zone
- Timestamp:
- Aug 23, 2013, 11:04:18 AM (8 years ago)
- Location:
- _galaxie_/code.spip.net/autodoc/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
_galaxie_/code.spip.net/autodoc/trunk/src/autodoc/Plugin/Core/TwigZora.php
r74902 r74904 131 131 * 132 132 * @param array $context 133 * Contexte du template 133 * Contexte du template (transmis automatiquement par twig) 134 134 * @return bool 135 135 * true si c'est un SPIP. … … 162 162 * ) 163 163 * 164 * @param Collection $collection|null164 * @param Collection|null $collection 165 165 * Liste d'éléments de phpDocumentor 166 166 * @param string $tri … … 241 241 ), 242 242 /** 243 * Liste les différents plugins contenus dans une collection 244 * 245 * @param array $context 246 * Contexte du template (transmis automatiquement par twig) 247 * @param Collection|null $collection 248 * @return Collection nom du répertoire => description du répertoire 249 **/ 250 'lister_plugins' => new \Twig_SimpleFilter('lister_plugins', 251 function ($context, $collection) { 252 if (!is_object($collection)) { 253 return new Collection(); 254 } 255 $selection = new Collection(); 256 foreach ($collection as $element) { 257 $path = $element->getPath(); 258 $path = explode('/', $path, 3); 259 $start = array_shift($path); 260 if (in_array($start , array('plugins-dist', 'plugins'))) { 261 $plugin = array_shift($path); 262 if (!$selection->get($plugin)) { 263 $fqsens = $context['project']->getIndexes()->get('elements'); 264 // identifiant unique de répertoire, pour retrouver sa description 265 $fqsen = './' . $start . '/' . $plugin . '/'; 266 $selection->set($plugin, $fqsens->get($fqsen)); 267 } 268 } 269 270 } 271 return $selection; 272 }, array('needs_context' => true) 273 ), 274 /** 275 * Retrouve le nom du répertoire contenant un plugin 276 * 277 * Si un path est inclu dans plugins-dist ou plugins, 278 * on considère que le répertoire suivant est un nom 279 * de répertoire de plugin. 280 * 281 * @example 282 * file|repertoire_de_plugin 283 * 284 * @param Object $element 285 * Élément de phpDocumentor 286 * @return string 287 * Nom du répertoire, sinon vide. 288 */ 289 'repertoire_de_plugin' => new \Twig_SimpleFilter('selectionner_fichiers_dans', 290 function ($element) { 291 if ($path = $element->getPath()) { 292 $path = explode('/', $path, 3); 293 $start = array_shift($chemin); 294 if (in_array($start , array('plugins-dist', 'plugins'))) { 295 return array_shift($path); 296 } 297 } 298 return ''; 299 } 300 ), 301 /** 243 302 * Sélectionne les fonctions d'une collection de fonctions 244 303 * dont les fichiers ont un chemin commençant par l'argument transmis … … 247 306 * elements|selectionner_fichiers_dans('plugins-dist') 248 307 * 249 * @param Collection $collection|null308 * @param Collection|null $collection 250 309 * Liste d'éléments de phpDocumentor 251 310 * @param string $debut … … 279 338 * elements|selectionner_fichiers_hors('plugins-dist') 280 339 * 281 * @param Collection $collection|null340 * @param Collection|null $collection 282 341 * Liste d'éléments de phpDocumentor 283 342 * @param string $debut -
_galaxie_/code.spip.net/autodoc/trunk/templates/zora/content/sommaire.twig
r74891 r74904 20 20 21 21 {% set elements = [ 22 {'type': 'balise', 'nom': 'Balises', 'elements': project.indexes.spip.balises },23 {'type': 'filtre', 'nom': 'Filtres', 'elements': project.indexes.spip.filtres },24 {'type': 'critere', 'nom': 'Critères', 'elements': project.indexes.spip.criteres },25 {'type': 'boucle', 'nom': 'Boucles', 'elements': project.indexes.spip.boucles },26 {'type': 'pipeline', 'nom': 'Pipelines', 'elements': project.indexes.spip.pipelines },22 {'type': 'balise', 'nom': 'Balises', 'elements': project.indexes.spip.balises|trier('name')}, 23 {'type': 'filtre', 'nom': 'Filtres', 'elements': project.indexes.spip.filtres|trier('name')}, 24 {'type': 'critere', 'nom': 'Critères', 'elements': project.indexes.spip.criteres|trier('name')}, 25 {'type': 'boucle', 'nom': 'Boucles', 'elements': project.indexes.spip.boucles|trier('name')}, 26 {'type': 'pipeline', 'nom': 'Pipelines', 'elements': project.indexes.spip.pipelines|trier('tags.pipeline.0.description', 'getFullyQualifiedStructuralElementName')}, 27 27 ] %} 28 28 … … 32 32 <h3>{{ e.nom }}</h3> 33 33 <ul class='colonnes'> 34 {% for function in e.elements |trier('name')%}34 {% for function in e.elements %} 35 35 {% if not function.tags['deprecated'].count %} 36 36 <li -
_galaxie_/code.spip.net/autodoc/trunk/templates/zora/inclure/liste/spiperies_with_tabs.twig
r74883 r74904 24 24 </div> 25 25 <div class="tab-pane" id="{{ type }}_plug"> 26 {% include 'inclure/liste/spiperies.twig' with {'elements' : elements_plug, 'forcer_liste' : true} %} 26 {% for plugin, directory in elements_plug|lister_plugins %} 27 <h3>{{ plugin }}</h3> 28 {% include 'inclure/liste/spiperies.twig' with { 29 'elements' : elements_plug|selectionner_fichiers_dans( directory.path ), 30 'forcer_liste' : true} 31 %} 32 {% endfor %} 27 33 </div> 28 34 </div>
Note: See TracChangeset
for help on using the changeset viewer.