synops/maskinrommet/src/templates/tidsskrift/index.html
vegard 4b9f520eab Tera-templates: innebygde temaer for publisering (oppgave 14.1)
Implementerer publiseringsmotoren med fire innebygde temaer:
- Avis: multi-kolonne, informasjonstung, hero+sidebar+rutenett
- Magasin: store bilder, luft, editorial, cards-layout
- Blogg: enkel, én kolonne, kronologisk liste
- Tidsskrift: akademisk, tekstdrevet, nummerert innholdsfortegnelse

Hvert tema har artikkelmal + forside-mal som Tera-templates (Jinja2-like).
CSS-variabler for theme_config-overstyring fra publishing-traiten —
fungerer meningsfullt med bare "theme": "magasin" (null konfigurasjon).

Teknisk:
- publishing.rs: Tera engine, render-funksjoner, DB-spørringer, HTTP-handlers
- Templates innebygd via include_str! (kompilert inn i binæren)
- Ruter: GET /pub/{slug} (forside), /pub/{slug}/{id} (artikkel),
  /pub/{slug}/preview/{theme} (forhåndsvisning med testdata)
- 6 enhetstester for CSS-variabler, rendering og tema-fallback

Ref: docs/concepts/publisering.md § "Temaer"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 00:41:54 +00:00

133 lines
3.4 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ index.title }}{% endblock %}
{% block extra_css %}
.journal-layout {
max-width: var(--layout-max-width);
margin: 3rem auto;
padding: 0 1rem;
}
.journal-header {
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 2px solid var(--color-primary);
}
.journal-header__title {
font-family: var(--font-heading);
font-size: 2rem;
color: var(--color-primary);
}
.journal-header__desc {
font-size: 0.95rem;
color: var(--color-muted);
font-style: italic;
margin-top: 0.5rem;
}
/* Nummerert innholdsfortegnelse */
.journal-toc {
counter-reset: article-counter;
list-style: none;
}
.journal-toc__item {
counter-increment: article-counter;
padding: 1rem 0;
border-bottom: 1px solid #eee;
display: flex;
align-items: baseline;
gap: 1rem;
}
.journal-toc__item::before {
content: counter(article-counter) ".";
font-family: var(--font-heading);
font-size: 1.1rem;
color: var(--color-muted);
min-width: 2rem;
text-align: right;
}
.journal-toc__title {
font-family: var(--font-heading);
font-size: 1.1rem;
color: var(--color-primary);
line-height: 1.3;
}
.journal-toc__meta {
font-size: 0.8rem;
color: var(--color-muted);
margin-top: 0.25rem;
}
/* Fremhevet (hero/featured) */
.journal-featured {
margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid var(--color-primary);
}
.journal-featured__label {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--color-accent);
margin-bottom: 0.5rem;
}
.journal-featured__title {
font-family: var(--font-heading);
font-size: 1.5rem;
color: var(--color-primary);
line-height: 1.3;
}
.journal-featured__summary {
font-size: 0.95rem;
color: var(--color-text);
margin-top: 0.5rem;
line-height: 1.5;
}
{% endblock %}
{% block content %}
<div class="journal-layout">
<header class="journal-header">
<h1 class="journal-header__title">{{ index.title }}</h1>
{% if index.description %}
<p class="journal-header__desc">{{ index.description }}</p>
{% endif %}
</header>
{% if index.hero %}
<div class="journal-featured">
<div class="journal-featured__label">Hovedartikkel</div>
<h2 class="journal-featured__title"><a href="{{ base_url }}/{{ index.hero.short_id }}">{{ index.hero.title }}</a></h2>
{% if index.hero.summary %}
<p class="journal-featured__summary">{{ index.hero.summary }}</p>
{% endif %}
</div>
{% endif %}
{% if index.featured | length > 0 %}
{% for item in index.featured %}
<div class="journal-featured" style="border-bottom-color: #eee;">
<h3 class="journal-featured__title"><a href="{{ base_url }}/{{ item.short_id }}">{{ item.title }}</a></h3>
{% if item.summary %}
<p class="journal-featured__summary">{{ item.summary }}</p>
{% endif %}
</div>
{% endfor %}
{% endif %}
{% if index.stream | length > 0 %}
<h2 style="font-family: var(--font-heading); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); margin-bottom: 0.5rem;">Innholdsfortegnelse</h2>
<ol class="journal-toc">
{% for item in index.stream %}
<li class="journal-toc__item">
<div>
<div class="journal-toc__title"><a href="{{ base_url }}/{{ item.short_id }}">{{ item.title }}</a></div>
<div class="journal-toc__meta">{{ item.published_at_short }}</div>
</div>
</li>
{% endfor %}
</ol>
{% endif %}
</div>
{% endblock %}