|
| 1 | +## {{ trait|trim('\\') }} <Badge v-if="'{{ trait.deprecated }}'" text="deprecated" type="error"/> |
| 2 | + |
| 3 | +{{ trait.summary|replace({'#### ': '- ', '### ': '- ', '## ': '- ', '# ': '- ',}) }} |
| 4 | + |
| 5 | +{{ trait.description|replace({'#### ': '- ', '### ': '- ', '## ': '- ', '# ': '- ',}) }} |
| 6 | + |
| 7 | +{#- Used traits -#} |
| 8 | +{% set usedTraits = [] %} |
| 9 | + |
| 10 | +{% macro getRecursiveTraits(targetTrait) %} |
| 11 | + {%- import _self as self -%} |
| 12 | + |
| 13 | + {%- if targetTrait -%} |
| 14 | + {{- targetTrait.usedTraits|join(',') -}}, |
| 15 | + |
| 16 | + {%- for trait in targetTrait.usedTraits -%} |
| 17 | + {{- self.getRecursiveTraits(trait) -}} |
| 18 | + {%- endfor -%} |
| 19 | + {%- endif -%} |
| 20 | +{% endmacro %} |
| 21 | + |
| 22 | +{% import _self as self %} |
| 23 | +{% set usedTraitsText = self.getRecursiveTraits(trait) %} |
| 24 | + |
| 25 | +{#- Convert to array, sort and remove duplicates -#} |
| 26 | +{% for name in usedTraitsText|trim(', ')|split(',')|sort %} |
| 27 | + {%- set usedTraits = usedTraits|merge({ (name): (name|split('\\')|last) }) -%} |
| 28 | +{% endfor %} |
| 29 | + |
| 30 | +| Name | {{ trait.name }} | |
| 31 | +| ----:|:---------------- | |
| 32 | +{% for tName, tShort in usedTraits if tShort is not empty %}{# FIXME #} |
| 33 | +{% if loop.first -%} |
| 34 | +**Uses** | |
| 35 | +{%- endif -%} |
| 36 | + [{{ tName|trim('\\')|split('\\')|slice(0, -1)|join('\\') }}\\<span style="font-weight: bold;">{{ tShort }}</span>](/api/traits.html#{{ tShort|lower|replace('\\', '-') }}) {{- '<br />' -}} |
| 37 | +{% endfor %} |
| 38 | + |
| 39 | + |
| 40 | +{% for author in trait.tags.author %} |
| 41 | +{% if loop.first %}- **Authors:**{% endif %} |
| 42 | + |
| 43 | + - {{ author.description }} |
| 44 | +{%- endfor %} |
| 45 | + |
| 46 | + |
| 47 | +{% if trait.tags.see is not empty or trait.tags.link is not empty %} |
| 48 | +***See Also:*** |
| 49 | + |
| 50 | +{% for see in trait.tags.see %} |
| 51 | +* `{{ see.reference }}` {% if see.description %}-{% endif %} {{ see.description }} |
| 52 | +{% endfor %} |
| 53 | + |
| 54 | +{% for link in trait.tags.link %} |
| 55 | +* [{{ link.description|default(link.link) }}]({{ link.link }}) |
| 56 | +{% endfor %} |
| 57 | + |
| 58 | +{% endif %}{# class.tags.see || class.tags.link #} |
| 59 | + |
| 60 | +#### <span style="display: none;">{{ trait }}</span> Methods: |
| 61 | +{# Lista de métodos públicos y protegidos #} |
| 62 | +{% for method in trait.methods|sort_asc %} |
| 63 | +{% if method.visibility != 'private' %} |
| 64 | +{% include 'method.md.twig' %} |
| 65 | +{% endif %} |
| 66 | +{% else %} |
| 67 | +> This trait has not methods. |
| 68 | +{% endfor %} |
| 69 | + |
| 70 | +#### <span style="display: none;">{{ trait }}</span> Inherited methods: |
| 71 | +{# Lista de métodos públicos y protegidos #} |
| 72 | +{% for method in trait.inheritedMethods -%} |
| 73 | +{%- if method.visibility != 'private' %} |
| 74 | +- [{{ method.parent.namespace|trim('\\') -}}\\<span style="font-weight: bold;">{{ method.parent.name }}</span>](/api/traits.html# |
| 75 | + {{- method.parent|trim('\\')|lower|replace('\\', '-') -}} |
| 76 | + ):: |
| 77 | + {{- include('method-anchor-link.md.twig', { text: method.name ~ '()' }) }} |
| 78 | + <Badge v-if="'{{ method.deprecated }}'" text="deprecated" type="error"/> <Badge v-if="'{{ method.abstract }}'" text="abstract"/> <Badge v-if="'{{ method.final }}'" text="final" /> |
| 79 | +{% endif %} |
| 80 | +{% else %} |
| 81 | +> This trait has not inherited methods. |
| 82 | +{% endfor %} |
0 commit comments