Render space pages from Forgejo markdown (CSOC-WP-0004-T04)
Fetch raw files from Forgejo, sanitize markdown to HTML, and show them on space detail. Ship a public demo fixture path and seed_demo_space command.
This commit is contained in:
parent
86b54243b8
commit
1cedd8f219
13 changed files with 606 additions and 26 deletions
|
|
@ -1,5 +1,35 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}{{ space.title }} — {{ site_name }}{% endblock %}
|
||||
{% block title %}{{ page.title|default:space.title }} — {{ site_name }}{% endblock %}
|
||||
{% block extra_head %}
|
||||
<style>
|
||||
.md-body h1 { font-size: 1.75rem; margin-top: 0; }
|
||||
.md-body h2 { font-size: 1.25rem; margin-top: 1.5rem; }
|
||||
.md-body pre {
|
||||
background: #f5f5f5;
|
||||
padding: 0.85rem 1rem;
|
||||
border-radius: 6px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.md-body code { font-family: ui-monospace, monospace; font-size: 0.9em; }
|
||||
.md-body table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
|
||||
.md-body th, .md-body td {
|
||||
border: 1px solid #e5e5e5;
|
||||
padding: 0.4rem 0.65rem;
|
||||
text-align: left;
|
||||
}
|
||||
.md-body blockquote {
|
||||
margin: 1rem 0;
|
||||
padding-left: 1rem;
|
||||
border-left: 3px solid var(--color-primary);
|
||||
color: var(--color-muted);
|
||||
}
|
||||
.content-meta { font-size: 0.85rem; margin-top: 0.5rem; }
|
||||
.content-error {
|
||||
border-color: #fcd34d;
|
||||
background: #fffbeb;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<p class="muted" style="margin:0 0 0.5rem;">
|
||||
<a href="{% url 'core:app_home' %}">← Spaces</a>
|
||||
|
|
@ -9,28 +39,26 @@
|
|||
<p class="muted">{{ space.description }}</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="card">
|
||||
<h2 style="margin-top:0;">Space metadata</h2>
|
||||
<dl>
|
||||
<dt>Slug</dt><dd>{{ space.slug }}</dd>
|
||||
<dt>Tenant</dt><dd>{{ space.tenant_id }}</dd>
|
||||
<dt>Content</dt>
|
||||
<dd>
|
||||
{% if space.has_content_binding %}
|
||||
{{ space.forgejo_owner }}/{{ space.forgejo_repo }}
|
||||
@ {{ space.default_branch }}
|
||||
· root <code>{{ space.content_root }}</code>
|
||||
{% else %}
|
||||
Not bound to a Forgejo repo yet (CSOC-WP-0004-T04).
|
||||
{% endif %}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2 style="margin-top:0;">Pages</h2>
|
||||
<p class="muted" style="margin-bottom:0;">
|
||||
Markdown page rendering from Forgejo lands in T04. This view is metadata only.
|
||||
{% if page.error %}
|
||||
<div class="card content-error">
|
||||
<h2 style="margin-top:0;">Content unavailable</h2>
|
||||
<p style="margin-bottom:0;">{{ page.error }}</p>
|
||||
{% if space.has_content_binding %}
|
||||
<p class="content-meta muted">
|
||||
Binding: {{ space.forgejo_owner }}/{{ space.forgejo_repo }}
|
||||
· {{ page.path }} @ {{ space.default_branch }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card md-body">
|
||||
{{ page.html|safe }}
|
||||
</div>
|
||||
<p class="content-meta muted">
|
||||
Source: {{ page.source }} · {{ page.path }}
|
||||
{% if space.has_content_binding %}
|
||||
· {{ space.forgejo_owner }}/{{ space.forgejo_repo }}@{{ space.default_branch }}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue