Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 94767a5

Browse files
committed
Render docs with Doctum and a Markdown theme
1 parent 0ca5b19 commit 94767a5

18 files changed

+729
-1
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/.github export-ignore
33
/.gitattributes export-ignore
44
/.gitignore export-ignore
5+
/scripts export-ignore
6+
/doc export-ignore

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ $this->app->singleton('fcm.sender', function($app) use($sender) {
472472

473473
## API Documentation
474474

475-
You can find more documentation about the API in the [API reference](./doc/Readme.md).
475+
You can find more documentation about the API in the [API reference](./doc/index.md).
476476

477477

478478
## Licence

scripts/doctum-themes/.delete-me

Whitespace-only changes.

scripts/doctum-themes/class.twig

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
{% extends "layout/layout.twig" %}
2+
{% from "macros.twig" import render_classes, breadcrumbs, namespace_link, class_link, property_link, method_link, hint_link, source_link, method_source_link, deprecated, deprecations, todo, todos, class_category_name %}
3+
{% block title %}{{ class|raw }} | {{ parent() }}{% endblock %}
4+
{% block body_class 'class' %}
5+
{% block page_id 'class:' ~ (class.name|replace({'\\': '_'})) %}
6+
7+
{% block below_menu %}
8+
{%- if class.namespace %}
9+
> {{- class_category_name(class.getCategoryId()) }}
10+
11+
> {{- breadcrumbs(class.namespace) -}}
12+
13+
({{- class.shortname|raw -}})
14+
15+
{%- endif %}
16+
{% endblock %}
17+
18+
{% block page_content %}
19+
20+
## {{ class.name|split('\\')|last|raw }}{{ deprecated(class) }}
21+
22+
{{ block('class_signature') }}
23+
24+
{{ deprecations(class) }}
25+
26+
{%- if class.shortdesc or class.longdesc %}
27+
{%- if class.shortdesc -%}
28+
{{ class.shortdesc|desc(class) }}
29+
{%- endif %}
30+
{%- if class.longdesc -%}
31+
{{ class.longdesc|desc(class) }}
32+
{%- endif %}
33+
{%- if project.config('insert_todos') == true %}
34+
{{ todos(class) }}
35+
{%- endif %}
36+
{%- endif %}
37+
38+
{% if traits %}
39+
{# #}### {% trans 'Traits' %}
40+
41+
{# #}{{- render_classes(traits) }}
42+
{# #}{%- endif -%}
43+
44+
{{ "\n" }}
45+
{# #}{%- if constants -%}
46+
{# #}### {% trans 'Constants' %}
47+
48+
{# #}{{- block('constants') -}}
49+
{%- endif -%}
50+
51+
{%- if properties %}
52+
{# #}### {% trans 'Properties' %}
53+
54+
{# #}{{- block('properties') }}
55+
{%- endif -%}
56+
57+
{%- if methods %}
58+
{# #}### {% trans 'Methods' %}
59+
60+
{# #}{{- block('methods') }}
61+
62+
{# #}### {% trans 'Details' %}
63+
64+
{# #}{{- block('methods_details') }}
65+
{%- endif -%}
66+
67+
{% endblock %}
68+
69+
{% block class_signature -%}
70+
{% if not class.interface and class.abstract %}abstract {% endif %}
71+
{{- class_category_name(class.getCategoryId()) }} **{{ class.shortname|raw }}**
72+
{%- if class.parent %}
73+
extends {{ class_link(class.parent)|replace({'.html': '.md'})|raw }}
74+
{%- endif %}
75+
{%- if class.interfaces|length > 0 %}
76+
implements
77+
{% for interface in class.interfaces %}
78+
{{- class_link(interface)|replace({'.html': '.md'})|raw }}
79+
{%- if not loop.last %}, {% endif %}
80+
{%- endfor %}
81+
{%- endif %}
82+
{{- source_link(project, class) }}
83+
{% endblock %}
84+
85+
{% block method_signature -%}
86+
{{ "\n" }}
87+
###{{ " " }}
88+
{# #}{%- if method.final -%}final{%- endif -%}
89+
{# #}{%- if method.abstract -%}abstract{%- endif -%}
90+
{# #}{%- if method.static -%}static{%- endif -%}
91+
{# #}{%- if method.protected -%}protected{%- endif -%}
92+
{# #}{%- if method.private -%}private{%- endif -%}
93+
{# #}{{- " " -}}{{- hint_link(method.hint) -}}
94+
{{- " " -}}**{{- method.name|raw -}}**{{ block('method_parameters_signature') }}
95+
96+
{%- endblock %}
97+
98+
{% block method_parameters_signature -%}
99+
{%- from "macros.twig" import method_parameters_signature -%}
100+
{{- method_parameters_signature(method) -}}
101+
{{- deprecated(method) -}}
102+
{%- endblock %}
103+
104+
{% block parameters %}
105+
106+
| | | |
107+
|---|---|---|
108+
{% for parameter in method.parameters %}
109+
|{%- if parameter.hint %}{{ hint_link(parameter.hint) }}{% endif -%}
110+
|{%- if parameter.variadic %}...{% endif %}${{ parameter.name|raw -}}
111+
|{{- parameter.shortdesc|desc(class) -}}
112+
{% endfor %}
113+
{% endblock %}
114+
115+
{% block return %}
116+
117+
| | |
118+
|---|---|
119+
|{{ hint_link(method.hint) }}|{{ method.hintDesc|desc(class) }}
120+
{% endblock %}
121+
122+
{% block exceptions %}
123+
124+
| | |
125+
|---|---|
126+
{% for exception in method.exceptions %}
127+
|{{ class_link(exception[0]) }}|{{ exception[1]|desc(class) }}|
128+
{% endfor %}
129+
{% endblock %}
130+
131+
{% block see %}
132+
| | |
133+
|---|---|
134+
{% for see in method.see %}
135+
|{% if see[4] -%}
136+
[{{see[4]}}]({{see[4]}})
137+
{%- elseif see[3] -%}
138+
{{- method_link(see[3], false, false) -}}
139+
{%- elseif see[2] -%}
140+
{{- class_link(see[2]) -}}
141+
{%- else -%}
142+
{{- see[0]|raw -}}
143+
{%- endif -%}
144+
|{{ see[1]|raw }}
145+
{% endfor %}
146+
{% endblock %}
147+
148+
{% block constants %}
149+
150+
| | |
151+
|---|---|
152+
{% for constant in constants %}
153+
{# #}|{{ constant.name|raw }}|{{ constant.shortdesc|desc(class) }}{{ constant.longdesc|desc(class) }}|
154+
{% endfor %}
155+
156+
{% endblock %}
157+
158+
{% block properties %}
159+
160+
| | | | |
161+
|---|---|---|---|
162+
{# #}{% for property in properties %}
163+
|<a name="property_{{ property.name|raw }}"></a>
164+
{%- if property.static -%}static{%- endif -%}
165+
{%- if property.protected -%}protected{%- endif -%}
166+
{%- if property.private -%}private{%- endif -%}
167+
{{ " " }}{{- hint_link(property.hint) -}}
168+
|${{- property.name|raw -}}
169+
|{{- property.shortdesc|desc(class) -}}
170+
|{%- if property.class is not same as(class) -%}
171+
<small>{{ 'from&nbsp;%s'|trans|format(property_link(property, false, true))|replace({'.html': '.md'})|raw }}</small>
172+
{%- endif -%}|
173+
{# #}{%- endfor %}
174+
{% endblock %}
175+
176+
{% block methods %}
177+
178+
| | | | |
179+
|---|---|---|---|
180+
{% for method in methods %}
181+
|{% if method.static %}static&nbsp;{% endif %}{{ hint_link(method.hint) -}}
182+
|<a name="#method_{{ method.name|raw }}"></a>{{ method.name|raw }}{{ block('method_parameters_signature') -}}
183+
|{% if not method.shortdesc %}
184+
{%- trans 'No description' -%}
185+
{% else %}
186+
{{- method.shortdesc|desc(class)|replace({"\n": ". "}) }}
187+
{%- endif %}
188+
|{%- if method.class is not same as(class) -%}
189+
{{ 'from&nbsp;%s'|trans|format(method_link(method, false, true))|replace({'.html': '.md'})|raw }}
190+
{%- endif -%}|
191+
{% endfor %}
192+
{% endblock %}
193+
194+
{% block methods_details %}
195+
{% for method in methods %}
196+
{{- block('method') -}}
197+
{%- endfor %}
198+
{% endblock %}
199+
200+
{% block method %}
201+
<a name id="method_{{ method.name|raw }}"></a>
202+
{{- block('method_signature') -}}
203+
{% if method.class is not same as(class) %}{{ 'in %s'|trans|format(method_link(method, false, true))|replace({'.html': '.md'})|raw }}{% endif %}
204+
{{ "\n" }}
205+
{{ method_source_link(method) -}}
206+
{{- deprecations(method) -}}
207+
{{ "\n" }}
208+
{% if method.shortdesc or method.longdesc %}
209+
{%- if not method.shortdesc and not method.longdesc -%}
210+
{%- trans 'No description' -%}
211+
{%- else -%}
212+
{%- if method.shortdesc -%}
213+
{{- method.shortdesc|desc(class) -}}
214+
{%- endif %}
215+
{% if method.longdesc -%}
216+
{{- method.longdesc|desc(class) -}}
217+
{%- endif -%}
218+
{%- endif -%}
219+
{%- if project.config('insert_todos') == true -%}
220+
{{- todos(method) -}}
221+
{%- endif -%}
222+
{%- endif -%}
223+
224+
{%- if method.parameters -%}
225+
{{ "\n" }}
226+
{# #}#### {% trans 'Parameters' %}
227+
228+
{# #}{{- block('parameters') -}}
229+
{%- endif %}
230+
231+
{%- if method.hintDesc or method.hint -%}
232+
{{ "\n" }}
233+
{# #}#### {% trans 'Return Value' %}
234+
235+
{# #}{{- block('return') -}}
236+
{%- endif %}
237+
238+
{%- if method.exceptions -%}
239+
{{ "\n" }}
240+
{# #}#### {% trans 'Exceptions' %}
241+
242+
{# #}{{- block('exceptions') -}}
243+
{%- endif %}
244+
245+
{%- if method.tags('see') -%}
246+
{{ "\n" }}
247+
{# #}#### {% trans 'See also' %}
248+
249+
{# #}{{- block('see') -}}
250+
{%- endif %}
251+
252+
{% endblock %}

scripts/doctum-themes/classes.twig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% extends "layout/layout.twig" %}
2+
{% from "macros.twig" import render_classes %}
3+
{% block title %}{% trans 'All Classes' %} | {{ parent() }}{% endblock %}
4+
{% block body_class 'classes' %}
5+
6+
{% block page_content %}
7+
8+
## {% trans 'Classes' %}
9+
10+
{{ render_classes(classes) }}
11+
{% endblock %}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{% extends "layout/layout.twig" %}
2+
{% from "macros.twig" import class_link, namespace_link, method_link, property_link %}
3+
{% block title %}{% trans 'Index' %} | {{ parent() }}{% endblock %}
4+
{% block body_class 'doc-index' %}
5+
6+
{% block page_content %}
7+
## {% trans 'Index' %}
8+
9+
10+
{% for letter in 'A'..'Z' %}
11+
{# #}{% if items[letter] is defined and items[letter]|length > 1 %}
12+
- [{{ letter|raw }}](#letter{{ letter|raw }})
13+
{# #}{% else %}
14+
- ~~[{{ letter|raw }}](#letter{{ letter|raw }})~~
15+
{# #}{% endif %}
16+
{% endfor %}
17+
18+
{% for letter, elements in items -%}
19+
{{ letter|raw }}<a name="letter{{ letter|raw }}"></a>
20+
<a name="index{{ letter|raw }}"></a>
21+
{%- for element in elements %}
22+
{%- set type = element[0] %}
23+
{%- set value = element[1] %}
24+
25+
{{ "\n" }}
26+
{%- if 'class' == type -%}
27+
- {{ class_link(value)|replace({'.html': '.md'})|raw }}{% if has_namespaces %} &mdash; <em>{{'Class in namespace %s'|trans|format(
28+
namespace_link(value.namespace)|replace({'.html': '.md'})
29+
)|raw}}{% endif %}
30+
{# #}({{ value.shortdesc|desc(value) }})
31+
{%- elseif 'method' == type -%}
32+
- {{ method_link(value)|replace({'.html': '.md'})|raw }}() &mdash; <em>{{ 'Method in class %s'|trans|format(
33+
class_link(value.class)|replace({'.html': '.md'})
34+
)|raw }}
35+
{# #}({{ value.shortdesc|desc(value.class) }})
36+
{%- elseif 'property' == type -%}
37+
- ${{ property_link(value)|replace({'.html': '.md'})|raw }} &mdash; <em>{{ 'Property in class %s'|trans|format(
38+
class_link(value.class)|replace({'.html': '.md'})
39+
)|raw}}
40+
{# #}({{ value.shortdesc|desc(value.class) }})
41+
{%- endif %}
42+
{%- endfor %}
43+
44+
{%- endfor %}
45+
46+
47+
{% endblock %}

scripts/doctum-themes/index.twig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% if has_namespaces %}
2+
{% set extension = 'namespaces.twig' %}
3+
{% else %}
4+
{% set extension = 'classes.twig' %}
5+
{% endif %}
6+
7+
{% extends extension %}
8+
9+
{% block body_class 'index' %}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "layout/layout.twig" %}
2+
{% from "macros.twig" import render_classes %}
3+
{% block title %}{% trans 'Interfaces' %} | {{ parent() }}{% endblock %}
4+
{% block body_class 'interfaces' %}
5+
6+
{% block page_content %}
7+
## {% trans 'Interfaces' %}
8+
9+
{{ render_classes(interfaces) }}
10+
{% endblock %}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# {% block title project.config('title') -%}
2+
3+
{%- block head -%}{%- endblock -%}
4+
5+
{% block html %}
6+
{% block content '' %}
7+
{% endblock %}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{% extends "layout/base.twig" %}
2+
3+
{% block content %}
4+
{{ block('control_panel') }}
5+
{{ block('leftnav') }}
6+
{{ block('menu') }}
7+
{% block below_menu '' %}
8+
{% block page_content '' %}
9+
{{- block('footer') -}}
10+
{% endblock %}
11+
12+
{% block menu %}
13+
## [{{ project.config('title') }}]({{ path('index.md') }})
14+
15+
{# #}- [{% trans 'Classes' %}]({{ path('classes.md') }})
16+
{# #}{% if has_namespaces -%}
17+
{# #}{# #}- [{% trans 'Namespaces' %}]({{ path('namespaces.md') }})
18+
{# #}{% endif -%}
19+
{# #}- [{% trans 'Interfaces' %}]({{ path('interfaces.md') }})
20+
{# #}- [{% trans 'Traits' %}]({{ path('traits.md') }})
21+
{# #}- [{% trans 'Index' %}]({{ path('doc-index.md') }})
22+
{# #}- [{% trans 'Search' %}]({{ path('search.md') }})
23+
{% endblock %}
24+
25+
{% block leftnav %}{% endblock %}
26+
27+
{% block control_panel %}
28+
{% if project.versions|length > 1 %}
29+
{% for version in project.versions %}
30+
{{ path('../' ~ version ~ '/index.md') }}
31+
{% endfor %}
32+
{% endif %}
33+
{% endblock %}
34+
35+
{%- block footer -%}
36+
_{{ 'Generated by %sDoctum, a API Documentation generator and fork of Sami%s.'|trans|format(
37+
'[', '](https://github.com/code-lts/doctum)'
38+
)|raw }}_
39+
{%- endblock -%}
40+

0 commit comments

Comments
 (0)