Skip to content

Commit ed517f0

Browse files
committed
Improve docs: use tables for topics/domains, order core first
Replace definition lists with tables in Sphinx documentation for better readability. Sort topics with core first, then alphabetically.
1 parent e2cccb4 commit ed517f0

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed

CHANGES.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Changelog
22

3-
## 2.0.1 (unreleased)
3+
## 2.0.1
44

5-
- nothing yet
5+
- Enhancement: Use tables in the generated sphinx code for topic/domains.
6+
[jensens, 02-11-2025]
67

78
## 2.0.0 (2025-10-24)
89

src/mxmake/templates.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ class Topics(Template):
377377
@property
378378
def template_variables(self) -> dict[str, typing.Any]:
379379
topics = load_topics()
380+
# Sort topics: core first, then alphabetically by name
381+
topics = sorted(topics, key=lambda t: (t.name != "core", t.name))
380382
return {"topics": topics}
381383

382384
def render(self):
@@ -406,6 +408,8 @@ class Dependencies(Template):
406408
@property
407409
def template_variables(self) -> dict[str, typing.Any]:
408410
topics = load_topics()
411+
# Sort topics: core first, then alphabetically by name
412+
topics = sorted(topics, key=lambda t: (t.name != "core", t.name))
409413
return {"topics": topics}
410414

411415
def render(self):

src/mxmake/templates/topics.md

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,32 @@
1313

1414
{{ domain.description }}
1515

16-
FQN
17-
: `{{ domain.fqn }}`
18-
19-
{% if domain.depends %}
20-
Depends on
21-
{% for depend in domain.depends %}
22-
: `{{ depend }}`
23-
{% endfor %}
24-
{% endif %}
25-
26-
{% if domain.soft_depends %}
27-
Soft depends on
28-
{% for soft_depends in domain.soft_depends %}
29-
: `{{ soft_depends }}`
30-
{% endfor %}
16+
| Property | Value |
17+
|----------|-------|
18+
| **FQN** | `{{ domain.fqn }}` |
19+
{% if domain.depends or domain.soft_depends %}
20+
| **Dependencies** | {% if domain.depends %}**Hard:** {% for depend in domain.depends %}`{{ depend }}`{% if not loop.last %}, {% endif %}{% endfor %}{% if domain.soft_depends %}<br>{% endif %}{% endif %}{% if domain.soft_depends %}**Soft:** {% for soft_depend in domain.soft_depends %}`{{ soft_depend }}`{% if not loop.last %}, {% endif %}{% endfor %}{% endif %} |
3121
{% endif %}
3222

3323
{% if domain.targets %}
34-
Targets
35-
{% for target in domain.targets %}
36-
: `{{ target.name }}`
3724

38-
: {{ target.description | indent(4) }}
25+
**Targets:**
3926

27+
| Target | Description |
28+
|--------|-------------|
29+
{% for target in domain.targets %}
30+
| `{{ target.name }}` | {{ target.description | replace('\n', '<br>') }} |
4031
{% endfor %}
4132
{% endif %}
4233

4334
{% if domain.settings %}
44-
Settings
45-
{% for setting in domain.settings %}
46-
: `{{ setting.name }}`
4735

48-
: {{ setting.description | indent(4) }}
49-
50-
: Default: `{{ setting.default | indent(4) }}`
36+
**Settings:**
5137

38+
| Setting | Description | Default |
39+
|---------|-------------|---------|
40+
{% for setting in domain.settings %}
41+
| `{{ setting.name }}` | {{ setting.description | replace('\n', '<br>') }} | `{{ setting.default }}` |
5242
{% endfor %}
5343
{% endif %}
5444

0 commit comments

Comments
 (0)