Vorlage fuer eigene Ableger-Installationen: Website + CMS-Code

Bereinigt von Pilot-Spezifika (echte Inhalte, Erzbistum-Hamburg-Bezuege,
Domain-Werte) - install.env und hugo.toml [params] mit generischen
Platzhaltern. docs/ komplett entfernt: Konzept, Manifest, Installations-
anleitungen leben jetzt auf der Projekt-Website statt redundant im Repo,
README verweist dorthin. Decap-CMS-Version von einer floatenden ^3.0.0
auf ein festes 3.15.1 gepinnt.
This commit is contained in:
2026-08-23 14:37:54 +02:00
commit 5e9da58d23
65 changed files with 5073 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
# Hugo build output
hugo/public/
hugo/resources/
hugo/.hugo_build.lock
# Generated from hugo/hugo.template.toml + install.env (WEBSITE_DOMAIN,
# GITEA_DOMAIN, METHODEN_REPO), see scripts/generate-config.sh -
# hugo.template.toml is the file to maintain, not hugo.toml.
/hugo/hugo.toml
# Method content lives in the separate methods repo, see install.env and
# scripts/sync-methoden.sh
/_content/
# Creation/modification dates, computed from the git history of _content/
# instead of maintained, see scripts/generate-dates.sh
/hugo/data/methoden.json
/hugo/data/varianten.json
# Current commit of this repo itself, computed at deploy/build time - see
# scripts/generate-version-info.sh
/hugo/data/website.json
# Generated from admin/config.template.yml + the vocabulary in
# _content/ableger.yml, see scripts/generate-config.sh - config.template.yml
# is the file to maintain, not config.yml.
/admin/config.yml
# Generated by scripts/generate-vorlagen-manifest.rb, scans the docroot
# live (not just this folder) - see the Methoden-Set chapter on the project website.
/methoden-set/vorlagen/vorlagen-manifest.json
# OS
.DS_Store
+31
View File
@@ -0,0 +1,31 @@
Ableger – Sammlung von Methoden für kirchliche, pastorale und pädagogische Praxis
Dieses Repository enthält Website und CMS-Code von Ableger. Die Methoden-
Inhalte selbst liegen im separaten Methoden-Repo mit eigener LICENSE-Datei
(Hintergrund zur Repo-Trennung: Konzept-Kapitel auf der Projekt-Website).
Software- und Konfigurationsbestandteile dieses Repositories (u. a.
`hugo/`, `admin/config.yml`) sind lizenziert unter einer
Creative Commons Namensnennung 4.0 International Lizenz (CC BY 4.0).
Um eine Kopie dieser Lizenz zu sehen, besuchen Sie:
https://creativecommons.org/licenses/by/4.0/deed.de
Den vollständigen rechtsverbindlichen Lizenztext (Legal Code) finden Sie unter:
https://creativecommons.org/licenses/by/4.0/legalcode.de
Kurzfassung:
Sie dürfen die Inhalte in jedem Format oder Medium vervielfältigen,
verbreiten, öffentlich zeigen, aufführen und in andere Sprachen und
Formate übertragen, sie remixen, verändern und darauf aufbauen –
für beliebige Zwecke, auch kommerziell. Einzige Bedingung:
angemessene Urheber- und Rechteangaben, ein Link zur Lizenz und
Angabe, ob Änderungen vorgenommen wurden.
Ausgenommen sind einzelne eingebundene Drittkomponenten (z. B. Hugo,
Decap CMS), für die deren jeweils eigene Lizenz gilt.
Hinweis für Forks: CC-BY regelt keinen Markenschutz. Forks dieses
Repositories sollten einen eigenen Namen tragen und als
"basierend auf Ableger von [Name der Ursprungsinstitution]"
gekennzeichnet werden (siehe Konzept-Kapitel auf der Projekt-Website).
+109
View File
@@ -0,0 +1,109 @@
# Ableger
Ableger ist eine öffentlich zugängliche, frei lizenzierte Sammlung von Methoden für kirchliche, pastorale und pädagogische Praxis. Inhalte liegen als einfache, versionierte Markdown-Dateien vor, sind über eine grafische Oberfläche (Decap CMS) pflegbar und können von jeder interessierten Institution geforkt und eigenständig weiterentwickelt werden.
**Dies ist das Vorlagen-Repo** – der Ausgangspunkt für eine eigene Installation, ohne institutionsspezifische Inhalte (siehe `beispiel-methode` im zugehörigen Methoden-Repo). Konzept, Datenmodell (Manifest), Architektur und die vollständige Schritt-für-Schritt-Installationsanleitung stehen auf der **[Projekt-Website](https://space.bildungselemente.de/ableger)** – diese README ist nur eine praktische Kurzfassung.
## Grundprinzipien
1. **Öffentlichkeit** – jede Methode ist frei einsehbar, keine Zugangsschranken (mit einer bewussten, optionalen Ausnahme für einen privaten Erprobungsmodus)
2. **Einfache, portable Formate** – Markdown statt proprietärer Formate
3. **Versionierung** – jede Änderung ist über Git nachvollziehbar und rückbaubar
4. **Verzweigung** – Institutionen können eigene, unabhängige Varianten pflegen (siehe [Fork-Starter-Kit](#fork-starter-kit) unten)
5. **GUI als Vermittlungsschicht** – Git-Konzepte bleiben im Hintergrund, Beitragende arbeiten über Formulare
6. **Persönliche Begleitung** – ein Pat:innen-Modell begleitet neue Mitwirkende, nicht nur Dokumentation
Ausführliche Begründung und Hintergrund: Konzept-Kapitel auf der Projekt-Website.
## Repo-Struktur
Zwei getrennte Repos – eigene Zugriffsrechte für Methoden-Inhalte und für Website/CMS-Code.
**Dieses Repo (`ableger`) – Website + CMS-Code**, **separates Repo `ableger_methoden`** – nur Inhalte. Vollständige Ordnerübersicht: `CLAUDE.md`.
`_content/` in diesem Repo entsteht erst durch `scripts/sync-methoden.sh` (lokal wie im Deploy); Hugo bindet darin `_content/methoden` und `_content/varianten` über `module.mounts` in `hugo/hugo.template.toml` ein (daraus generiert `scripts/generate-config.sh` das tatsächlich gelesene `hugo/hugo.toml`, siehe unten).
**Warum Varianten?** Jede Methode kann mehrere Ausprägungen haben (z. B. eine Kurz- und eine Langform, eine Version für eine andere Altersgruppe) – der eigentliche Inhalt und die Anhänge liegen deshalb bei einer eigenen Variante, nicht bei der Methode selbst. Jede Methode startet mit mindestens einer Variante. Die beiden Platzhalter-Methoden `beispiel-methode` (eine Variante) und `beispiel-methode-mit-varianten` (drei Varianten) im Methoden-Repo zeigen beide Fälle mit selbsterklärend ausgefüllten Feldern.
## Eine Methode beitragen
**Über die Formular-Oberfläche** (für alle mit CMS-Zugang):
1. `/admin` der jeweiligen Instanz aufrufen und mit dem eigenen Gitea-Konto anmelden.
2. Neue **Methode** anlegen – das Formular fragt die Steckbrief-Metadaten ab (Titel, Zielgruppe, Dauer, Material, Kompetenzbereich, Kategorie, Lernchancen, Herkunft, Initiator:innen …). Speichern committet direkt auf den Hauptbranch – kein Zwischenschritt (Decap CMS unterstützt gegen Gitea keinen PR-basierten Editorial Workflow).
3. Neue **Variante** anlegen und über das Feld "Methode" der eben angelegten Methode zuordnen – hier kommen der eigentliche Inhalt (Textkörper mit der vorgegebenen Gliederung Vorbereitung / Ablauf / Hintergründe), Autor:innen und Anhänge hinein. Jede Methode braucht mindestens eine Variante, sonst bleibt sie unsichtbar (siehe Punkt 4).
4. Solange das Häkchen "Veröffentlicht" bei der Variante nicht gesetzt ist, ist sie nur im CMS sichtbar, nicht auf der Website. Erst wenn mindestens eine Variante veröffentlicht ist, erscheint auch die zugehörige Methode auf der Website – die Methode selbst hat kein eigenes Veröffentlichungs-Feld.
**Direkt per Git/PR** (unabhängig von CMS-Zugang, z. B. ohne eigenes Gitea-Konto mit Schreibrecht): im separaten Content-Repo über Giteas Web-Editor (forkt automatisch, öffnet einen Pull Request) oder lokal je einen neuen Ordner `methoden/<slug>/index.md` und `varianten/<methode>--<untertitel>/index.md` anlegen, Frontmatter-Schema aus `methoden/beispiel-methode/index.md` bzw. `varianten/beispiel-methode--original/index.md` übernehmen, PR gegen `main` stellen. Ablehnungen erfolgen nie kommentarlos, immer mit Begründung oder Verbesserungsvorschlag.
**Wer CMS-Zugang bekommt** ist eine offene Prozessfrage der jeweiligen Institution, nicht softwareseitig geregelt.
## Lokale Entwicklung
Voraussetzung: [Hugo](https://gohugo.io/) (aktuelle Version). Für die Volltextsuche (`/suche/`) zusätzlich [Pagefind](https://pagefind.app/) – ein statisches Binary ohne Node/npm-Abhängigkeit, Installationshinweise auf der Projekt-Website.
`_content/` ist nicht Teil dieses Repos (siehe oben) – einmalig bzw. bei Bedarf aktualisieren. `hugo/hugo.toml` ist ebenfalls nicht Teil des Repos (generiert aus `hugo/hugo.template.toml` + `install.env`, siehe unten) – ohne diesen Schritt findet Hugo keine Konfiguration:
```bash
./scripts/sync-methoden.sh
./scripts/generate-config.sh
./scripts/generate-version-info.sh
```
Danach:
```bash
cd hugo
hugo server
```
Der lokale Server bindet automatisch die Methoden aus `../_content/methoden` ein. Änderungen an Layouts (`hugo/layouts/`) oder Styles (`hugo/static/`) werden live neu geladen; Änderungen an den Methoden-Inhalten erfordern einen erneuten Lauf von `sync-methoden.sh`. Die Volltextsuche unter `/suche/` bleibt unter `hugo server` ohne Treffer – der Pagefind-Index entsteht erst im Produktions-Build unten.
Für einen Produktions-Build inkl. Such-Index:
```bash
cd hugo
hugo
pagefind --site public
```
Das Ergebnis liegt in `hugo/public/` (per `.gitignore` nicht versioniert).
### Decap CMS lokal testen
Um das Formular (Feldtypen, Pflichtfelder, vorbelegte Gliederung) zu prüfen, ohne Gitea/OAuth/Deployment zu brauchen, unterstützt Decap CMS einen lokalen Testmodus:
1. In `admin/config.template.yml` **temporär** die Zeile `local_backend: true` ergänzen (nicht committen) – **nicht** in `admin/config.yml`, das wird beim nächsten `generate-config.sh`-Lauf überschrieben.
2. `./scripts/sync-methoden.sh` ausführen, falls noch nicht geschehen.
3. `./scripts/generate-config.sh` ausführen, um `admin/config.yml` inkl. `local_backend: true` neu zu erzeugen.
4. `npx decap-server` **innerhalb von `_content/`** starten (läuft auf Port 8081, operiert direkt auf den echten Dateien dieses Checkouts).
5. Das Repo-Root von `ableger` mit einem beliebigen statischen Server ausliefern, z. B. `python3 -m http.server 8080`.
6. `http://localhost:8080/admin/` öffnen, auf **Login** klicken – Decap erkennt den lokalen Proxy automatisch und meldet an, ganz ohne Gitea-Konto.
Speichern schreibt echte Dateien in `_content/methoden/` bzw. `_content/varianten/`. Zum Aufräumen nach dem Test in `_content/` `git status` prüfen und Testeinträge verwerfen (oder `./scripts/sync-methoden.sh` erneut laufen lassen, um zurückzusetzen).
## Deployment
Vollständige, Schritt-für-Schritt getestete Installationsanleitung (Uberspace als Referenz-Hosting): siehe Projekt-Website.
## Lizenz
Alle Methodeninhalte stehen unter **CC BY 4.0**, sofern in der jeweiligen Datei nicht anders angegeben. Details: [LICENSE](LICENSE). Namensnennung erfolgt über die Felder `initiatoren` und `herkunft` im Frontmatter der Methode sowie `autoren` und `quellen` bei der jeweiligen Variante.
## Fork-Starter-Kit
Möchte eine andere Institution (Bistum, Verband, Bildungswerk, Einzelperson) eine eigene, unabhängige Kopie von Ableger pflegen? Das geht vollständig über die grafische Oberfläche, ohne Terminal oder Git-Kenntnisse:
1. **Beide Repos forken**: Auf den Repo-Seiten von `ableger` **und** `ableger_methoden` in Gitea/Forgejo den Button **„Fork"** klicken. Es entstehen in Sekunden zwei vollständige Kopien unter dem eigenen Account oder der eigenen Organisation.
2. **Config anpassen**: In [`install.env`](install.env) `METHODEN_REPO` auf den Namen des eigenen `ableger_methoden`-Forks ändern (`<eure-org>/<euer-methoden-repo-name>`) – eine einzige Datei, direkt im Gitea-Web-Editor bearbeitbar (**nicht** `admin/config.yml` selbst: die wird bei jedem Deploy aus `admin/config.template.yml` + `install.env` neu erzeugt und ist nicht versioniert). Der Deploy-Hook muss ebenfalls auf den eigenen `ableger_methoden`-Fork zeigen – siehe Installationsanleitung auf der Projekt-Website für Details je nach Hosting-Konstellation.
3. **OAuth-App registrieren**: In der eigenen Gitea-Instanz eine OAuth2-Anwendung für Decap CMS anlegen und `GITEA_DOMAIN`, `OAUTH_CLIENT_ID` in `install.env` entsprechend eintragen – Schritt-für-Schritt-Anleitung auf der Projekt-Website.
4. **Eigene Rollen und Rechte**: Die eigene Decap-CMS-Instanz läuft jetzt gegen den eigenen `ableger_methoden`-Fork, mit eigener Benutzerverwaltung (lokale Gitea-Konten oder Anbindung an einen vorhandenen Identity-Provider) – vollständig unabhängig vom Ursprungsrepo. Wer nur an Methoden mitarbeiten soll, braucht nur Zugriff auf den `ableger_methoden`-Fork, nicht auf `ableger`.
5. **Optional: privater Modus**: Für eine geschützte Erprobungsphase kann die Website hinter ein Auth-Gateway gestellt werden, das dieselben Gitea-Konten prüft wie die Formular-Seite – Anleitung auf der Projekt-Website.
6. **Aktuell halten**: Änderungen aus den Ursprungsrepos lassen sich jederzeit per regulärem Pull Request in die eigenen Forks übernehmen (Gitea-Sync-Button, wo verfügbar) – für beide Repos separat.
7. **Rückfluss**: Verbesserungen aus einem Fork können jederzeit per Cross-Repo Pull Request zurück ins jeweilige Ursprungsrepo vorgeschlagen werden – geprüft nach demselben Vertrauensstufen-Modell.
**Mehrserver-Installationen:** Nichts an diesem Modell erzwingt, dass Gitea-Instanz und Hugo-Build/Deploy auf demselben Server laufen. `scripts/sync-methoden.sh` holt `ableger_methoden` standardmäßig per SSH-URL, unabhängig vom Host. Die einzige echte Voraussetzung: `ableger_methoden` braucht eine Gitea/Forgejo-Instanz, weil Decaps Backend deren OAuth-API anspricht; wer zusätzlich den privaten Modus (Schritt 5) nutzt, muss den oauth2-proxy vor der Website gegen *dieselbe* Gitea-Instanz authentifizieren wie Decap CMS, damit ein Login beide Zugriffsarten (Redaktion + Website-Lesen) abdeckt.
**Namenskonvention (empfohlen, nicht technisch erzwungen):** CC BY 4.0 regelt keinen Markenschutz. Forks sollten einen eigenen Namen tragen und sich als *„basierend auf Ableger von [Name der Ursprungsinstitution]"* kennzeichnen.
Details und Hintergrund zu allem oben: **[Projekt-Website](https://space.bildungselemente.de/ableger)**.
+378
View File
@@ -0,0 +1,378 @@
# admin/config.template.yml
# Template for the Decap CMS starting configuration. NOT served directly:
# scripts/generate-config.sh builds admin/config.yml from it (generated,
# not versioned, see .gitignore) - two independent substitution steps:
# (1) fields between "# VOKABULAR:<field>:START/END" markers are replaced
# if a matching entry exists in the content repo under _content/ableger.yml
# (key "vokabular") (a closed selection list instead of free text) - if the
# entry is missing, the block entered here stays unchanged. (2)
# "{{VARIABLE}}" placeholders (see backend/site_url below) are always
# replaced by the like-named values from install.env.
# Details: the Manifest chapter on the project website Teil C, vokabular/README.md.
# Deliberately separate from the website/CMS code repo (ableger_demo/ableger):
# dedicated access rights for method content instead of full access to the
# whole repo via CMS access. Details: the concept chapter on the project website Abschnitt 4 and 9.
# repo/app_id/api_root/base_url/auth_endpoint come from install.env
# (adjust centrally there for a fork), not directly here.
backend:
name: gitea
repo: "{{METHODEN_REPO}}"
app_id: "{{OAUTH_CLIENT_ID}}"
api_root: "https://{{GITEA_DOMAIN}}/api/v1"
base_url: "https://{{GITEA_DOMAIN}}"
auth_endpoint: "https://{{GITEA_DOMAIN}}/login/oauth/authorize"
branch: main
# For the "Preview" link in the editor toolbar (not in the list overview -
# per Decap's own docs, that only shows on the edit page).
# WEBSITE_DOMAIN comes from install.env, must match baseURL in hugo/hugo.toml.
site_url: "https://{{WEBSITE_DOMAIN}}"
# editorial_workflow (branch + PR per submission) would be the actually
# intended model, but is not supported by the Gitea backend in Decap CMS
# (runtime error on load): https://github.com/decaporg/decap-cms/issues/7115
# (open, no workaround). Hence simple: a direct commit for anyone with CMS
# access. Who gets access is a process question outside this config - see
# the concept chapter on the project website Abschnitt 5.
publish_mode: simple
# Fallback for media without their own field-level media_folder (among
# others the global "Media" button in the navigation) - now points into the
# content repo (ableger_demo/ableger_methoden) instead of the website repo,
# see backend.repo above.
media_folder: "_assets"
public_folder: "/_assets"
# Strip umlauts/accents from generated slugs: for the existence check Decap
# runs before every save (GET .../git/trees/main:<path>), Gitea returns a
# 400 error ("sha not found") for a path with non-ASCII characters - and
# that's true even when the path exists, not only for new entries. Verified
# live against the real Gitea API (ableger_methoden, main). Affects not
# only creation but every subsequent save of an existing entry with an
# umlaut in the folder name. Since this is a quirk of Gitea's extended-SHA
# resolution (not a Decap bug), it can't be fixed in this repo's code -
# only worked around via ASCII-clean slugs.
slug:
clean_accents: true
collections:
- name: "methoden"
label: "Methoden"
# Deliberately "methoden" instead of repo root ("") - Decap CMS crashes
# on an empty folder value (config processing sets collection.type only
# inside "if (folder) {...}", an empty string is falsy). Reproduced and
# verified locally, see the ableger_methoden commit "Methoden in
# methoden/-Unterordner verschieben".
folder: "methoden"
create: true
# Slug comes from the dedicated field "kennung", no longer from the
# title (Decap's default {{slug}}): the title may change at any time
# without moving the folder - see the "kennung" field below and
# the Manifest chapter on the project website, section "Bezeichner". Previously {{slug}} (derived
# from titel) - a title change demonstrably deleted the method page
# live and orphaned both variants, see the project website (background/analysis notes),
# Befund A.
slug: "{{fields.kennung}}"
path: "{{slug}}/index"
# {{slug}} in preview_path here (unlike slug: above) means the full
# path compiled from path: "{{slug}}/index", including "index" - would
# result in "beispiel-methode-index" instead of "beispiel-methode".
# {{dirname}} is the parent folder relative to the collection folder,
# which matches the slug exactly. Verified locally.
preview_path: "{{dirname}}"
identifier_field: "titel"
# Last-modified info in the overview, analogous to the variants
# collection below - {{commit_date}}/{{commit_author}} are Decap's own
# tokens fed from the Gitea API (checked live, also work in the summary
# template, not just in sortable_fields).
summary: "{{fields.titel}} | {{commit_date | date('D.M.YY')}} {{commit_author}}"
# Consistent vocabulary/order with the variants collection below:
# "Methode" instead of "Titel" as the label, "Zuletzt geändert am/durch"
# instead of Decap's default labels "Updated On"/"Author" - "Author"
# would be easily confused here with our own "Autor:innen" field (on
# variants), but actually means the commit author.
sortable_fields:
- { field: "titel", label: "Methode" }
- { field: "commit_date", label: "Zuletzt geändert am" }
- { field: "commit_author", label: "Zuletzt geändert durch" }
format: "frontmatter"
media_folder: ""
public_folder: ""
# Deliberately no draft field of its own here: publication is derived
# from the variants (see their "veroeffentlicht" field below) - as soon
# as at least one variant is published, the method is too.
# scripts/compute-methoden-sichtbarkeit.rb sets draft: true
# automatically for that, before every Hugo build, in the local
# _content copy (not in the repo), for every method without a
# published variant - Hugo's own, reliable draft mechanism then takes
# care of the rest (e.g. automatic exclusion from the
# homepage/search/taxonomies, not just the detail page). Details:
# the concept chapter on the project website Abschnitt 5.
#
# Equally deliberately no duration/group-size fields here: these depend
# on the respective variant (different versions of a method can take
# different amounts of time or be meant for different group sizes),
# hence they sit on the variant (see below) and are aggregated into a
# range for the method page from all its variants (see
# hugo/layouts/partials/variantenspanne.html).
#
# Equally deliberately no material field here (since August 2026,
# before that there was one): different variants of the same method
# often need different material - unlike duration/group size, there is
# also no aggregated display for this on the method page, since a
# material list as a union set would be misleading (could suggest you
# need everything together). Lives exclusively on the respective
# variant.
#
# License also on the variant, not here: what's copyrightable is not
# the method as an idea but the concrete description/write-up - which
# has lived entirely there since variants were introduced. The method
# page instead shows the set of licenses present across all variants
# (analogous to the duration range, see partials/variantenspanne.html).
fields:
# Stable identifier - becomes the folder name (see slug above) and
# thereby the target of every variant reference (see their "methode"
# field below). Assigned once, never changed afterward - the title
# may change freely, this may not. No technical lock in the editor
# possible (Decap has no readonly field), the validation script
# (scripts/validate.rb) flags later changes as an error. pattern
# also enforces ASCII-clean folder names directly in the form,
# rather than only via slug.clean_accents.
- label: "Kennung"
name: "kennung"
widget: "string"
hint: "Kurz und selbsterklärend. Kleinbuchstaben/Ziffern/Bindestriche/Unterstriche. Wird zum Ordnernamen und eindeutigen Identifier. Nach dem Anlegen nicht mehr ändern."
pattern: ["^[a-z0-9_]+(-[a-z0-9_]+)*$", "Nur Kleinbuchstaben, Ziffern, Unterstriche und Bindestriche, kein Bindestrich am Anfang/Ende"]
- { label: "Titel", name: "titel", widget: "string" }
- { label: "Kurzbeschreibung", name: "kurzbeschreibung", widget: "text", hint: "Kurze Zusammenfassung von Ziel und Ablauf, für den schnellen Überblick bei der Suche" }
- { label: "Verwendungsmöglichkeit", name: "verwendungsmoeglichkeit", widget: "text", hint: "Wann und wofür eignet sich die Methode?" }
# VOKABULAR:zielgruppe:START
- label: "Zielgruppe"
name: "zielgruppe"
widget: "select"
multiple: true
options:
- "Kinder"
- "Jugendliche"
- "Erwachsene"
- "Senior_innen"
# VOKABULAR:zielgruppe:END
- label: "Kompetenzbereich"
name: "kompetenzbereich"
widget: "select"
multiple: true
hint: "Kompetenzmodell nach Leipold, Kopf & Seidl (2010)"
options:
- "Fachkompetenz"
- "Methodenkompetenz"
- "Sozialkompetenz"
- "Selbstkompetenz"
# VOKABULAR:kategorie:START
- label: "Kategorie"
name: "kategorie"
widget: "list"
hint: "Frei wählbar, z. B. Advent, Firmvorbereitung, Kennenlernen, Konfliktbearbeitung – bewusst kein festes Vokabular"
# VOKABULAR:kategorie:END
- label: "Lernchancen"
name: "lernchancen"
widget: "list"
hint: "Stichsätze zu den (Lern-)Chancen, die mit der Methode verbunden werden"
summary: "{{fields.eintrag}}"
field: { label: "Lernchance", name: "eintrag", widget: "string" }
- label: "Herkunft"
name: "herkunft"
widget: "list"
required: false
hint: "Woher stammt die Methode ursprünglich? (Eigenentwicklung, Vorlage, Tradition o. Ä.) - wovon sich eine einzelne Variante ableitet, steht bei dieser selbst, siehe Collection \"Varianten\", Feld \"Quellen\"."
summary: "{{fields.eintrag}}"
field: { label: "Angabe", name: "eintrag", widget: "string" }
- label: "Initiator:innen"
name: "initiatoren"
widget: "list"
hint: "Wer die Methode ursprünglich entwickelt/eingebracht hat. Autor:innen einzelner Varianten stehen bei der jeweiligen Variante, siehe Collection \"Varianten\"."
summary: "{{fields.eintrag}}"
field: { label: "Initiator:in", name: "eintrag", widget: "string" }
# VOKABULAR:tags:START
- { label: "Tags", name: "tags", widget: "list", required: false }
# VOKABULAR:tags:END
# Every method has at least one variant - no special case for "just one
# version" in the data model, otherwise adding a second variant would
# require a later migration (moving content out of the method into a
# first variant). A method without a variant is deliberately not
# intended, but not technically enforced by the CMS (no access to other
# collections while saving). Linked via a relation field instead of
# nested files in the method folder: whether Decap's path template can
# include the folder of a method referenced via relation is unclear/
# unverified - the link instead happens only in Hugo (see
# hugo/layouts/_default/single.html), similar to a taxonomy.
#
# Own page bundle per variant (like methods), so that attachments - which
# belong to the respective variant, not the method, see the
# untertitel/varianten_beschreibung rationale above - have a fixed
# location where embedded images in the content (![]()) also resolve
# correctly via Hugo page resources. With only one variant, attachments
# stay functionally identical to the previous state (directly in the
# bundle folder of the - then only - variant, no dedicated src
# subfolder, same reason as for methods).
- name: "varianten"
label: "Varianten"
folder: "varianten"
create: true
# methode resolves via value_field (see relation field below) to the
# method's kennung, no longer to its title - title changes therefore no
# longer move variant folders, see the Manifest chapter on the project website and
# the project website (background/analysis notes), Befund A/E.
slug: "{{fields.methode}}--{{fields.kennung}}"
path: "{{slug}}/index"
# {{slug}} in preview_path here (as already with methods) means the
# full path compiled from path: "{{slug}}/index", including "index".
# {{dirname}} is the parent folder relative to the collection folder,
# which matches the slug exactly AND the real live URL: variants do
# live in Hugo's content structure under the "varianten" section (see
# hugo/hugo.toml module.mounts), but via the [permalinks] override
# there without a "varianten/" prefix in the URL - the section is kept
# for the template logic (where site.RegularPages "Section"
# "varianten"), only the URL becomes flat. Slug collisions with methods
# are ruled out, since variant slugs are always
# "<methode-kennung>--<varianten-kennung>", and method slugs never
# contain "--".
preview_path: "{{dirname}}"
identifier_field: "untertitel"
# Without this line, the overview would only show the subtitle (e.g.
# "Kurzform") with no recognizable relation to the method - no longer
# distinguishable with several methods that have similar variant names.
# "Show variants on the method edit page" would be the more obvious
# solution, but Decap CMS doesn't support it (no reverse-relation
# feature) and would need a custom widget - deliberately not built
# here. Method first, then subtitle: this way the overview groups
# sensibly when sorted by "Methode", not just alphabetically by slug.
# {{commit_date}}/{{commit_author}} are Decap's own tokens fed from the
# Gitea API - checked live, also work in the summary template (not just
# in sortable_fields, where they were originally intended for this
# purpose).
summary: "{{fields.methode}} – {{fields.untertitel}} | {{commit_date | date('D.M.YY')}} {{commit_author}}"
# Decap doesn't automatically offer relation fields (like "methode") in
# "Sort by" (checked live: without this line, only "Untertitel" showed
# up there) - added explicitly, so the overview can also be grouped by
# method. "commit_author"/"commit_date" (Decap's built-in, git-based
# sort options) have to be listed explicitly here too: an explicit
# sortable_fields list REPLACES Decap's default selection entirely,
# instead of extending it - without these two entries they would have
# disappeared from this collection, even though they should appear the
# same way for methods (also explicitly set there now, see above).
# Consistent vocabulary/order with the methods collection above:
# "Methode" first, then - only here in addition, since only variants
# have this field - "Variante" (label for the untertitel field), then
# "Zuletzt geändert am/durch" instead of Decap's default labels
# "Updated On"/"Author" - "Author" would be easily confused here with
# our own "Autor:innen" field, but actually means the commit author.
sortable_fields:
- { field: "methode", label: "Methode" }
- { field: "untertitel", label: "Variante" }
- { field: "commit_date", label: "Zuletzt geändert am" }
- { field: "commit_author", label: "Zuletzt geändert durch" }
format: "frontmatter"
media_folder: ""
public_folder: ""
fields:
# Positive polarity (on = published) instead of a switch that writes
# directly into Hugo's "draft" field: marking "on" as "draft" (as
# required for an inverted draft field) is confusing UX. Decap cannot
# write a boolean field inverted into a differently named
# frontmatter field, so scripts/apply-veroeffentlicht.rb translates
# this field, inverted, into Hugo's native "draft" before every Hugo
# build, in the local _content copy (not in the repo) - Hugo's own
# draft mechanism then takes care of reliable build exclusion, as
# with methods (see above).
- label: "Veröffentlicht (auf der Website sichtbar)"
name: "veroeffentlicht"
widget: "boolean"
default: false
hint: "Häkchen setzen, um diese Variante (und damit auch die zugehörige Methode, siehe deren Hinweistext) auf der Website zu veröffentlichen. Bleibt bis dahin in Git gespeichert, ist aber nur im CMS sichtbar."
- label: "Methode"
name: "methode"
widget: "relation"
collection: "methoden"
search_fields: ["titel"]
display_fields: ["titel"]
# value_field determines what's actually stored/used for the slug -
# "kennung" instead of "titel" (the state before kennung was
# introduced), so that a title change on the method no longer
# breaks this reference (see the project website, background/analysis
# notes, Befund A). search_fields/display_fields stay on
# "titel", so the search in the dropdown still searches by the
# readable name, not the kennung. Neither {{slug}} nor {{dirname}}
# give a cleaned folder name here (reproduced live) - a direct
# field reference to "kennung" is the robust way. Linking in Hugo
# correspondingly happens via Params.kennung, not via Params.titel
# or the filename/slug.
value_field: "kennung"
hint: "Zu welcher Methode gehört diese Variante?"
# Stable identifier of this variant - becomes the second part of the
# folder name (see slug above). Assigned once, never changed
# afterward, see the Manifest chapter on the project website. Unlike the method, nothing
# currently references a variant from outside - kept consistent
# anyway, for later fork merges.
- label: "Kennung"
name: "kennung"
widget: "string"
hint: "Kurz und selbsterklärend. Kleinbuchstaben/Ziffern/Bindestriche/Unterstriche. Wird zum Ordnernamen und eindeutigen Identifier. Nach dem Anlegen nicht mehr ändern."
pattern: ["^[a-z0-9_]+(-[a-z0-9_]+)*$", "Nur Kleinbuchstaben, Ziffern, Unterstriche und Bindestriche, kein Bindestrich am Anfang/Ende"]
- { label: "Untertitel", name: "untertitel", widget: "string", hint: "Ein Wort, das die Besonderheit dieser Variante ausdrückt, z. B. \"Kurzform\" oder \"Sommer\"." }
- { label: "Varianten-Beschreibung", name: "varianten_beschreibung", widget: "text", hint: "Kurze Erläuterung, was diese Variante besonders macht - hilft später bei der Orientierung zwischen mehreren Varianten" }
- { label: "Dauer (Minuten)", name: "dauer_minuten", widget: "number", value_type: "int" }
- { label: "Gruppengröße (mindestens)", name: "gruppengroesse_min", widget: "number", value_type: "int", hint: "Für eine feste Gruppengröße hier und beim Maximum denselben Wert eintragen" }
- { label: "Gruppengröße (höchstens)", name: "gruppengroesse_max", widget: "number", value_type: "int" }
- label: "Material"
name: "material"
widget: "list"
hint: "Was für diese Variante konkret gebraucht wird - andere Varianten derselben Methode können anderes Material brauchen"
summary: "{{fields.eintrag}}"
field: { label: "Material", name: "eintrag", widget: "string" }
# VOKABULAR:lizenz:START
- { label: "Lizenz", name: "lizenz", widget: "string", default: "CC-BY 4.0", hint: "Gilt für diesen Text/diese Ausarbeitung - die Methode-Seite zeigt die Menge aller vorkommenden Lizenzen ihrer Varianten" }
# VOKABULAR:lizenz:END
- label: "Quellen"
name: "quellen"
widget: "list"
required: false
hint: "Worauf sich diese konkrete Ausarbeitung stützt (z. B. eine Handreichung, eine Adaption) - wovon die Methode allgemein abstammt, steht bei ihr selbst unter \"Herkunft\""
summary: "{{fields.eintrag}}"
field: { label: "Quelle", name: "eintrag", widget: "string" }
- label: "Autor:innen"
name: "autoren"
widget: "list"
hint: "Wer diese Variante erarbeitet hat (kann sich von den Initiator:innen der Methode unterscheiden)"
summary: "{{fields.eintrag}}"
field: { label: "Autor:in", name: "eintrag", widget: "string" }
- label: "Inhalt (Vorbereitung, Ablauf, Hintergründe)"
name: "body"
widget: "markdown"
default: |
# Vorbereitung
*Stichsätze, was erledigt werden muss, um mit den Inhalten zu starten (bei Bedarf auch Anmerkungen zum Material).*
# Ablauf
*Detaillierter Ablaufplan mit Anweisungen, möglicherweise in weiteren Überschriftenebenen verschachtelt.*
# Hintergründe
*Erläuterung von Hintergründen (Implizites im Ablauf explizit machen), um die Methode zugänglich zu gestalten.*
- label: "Anhänge"
name: "anhaenge"
widget: "list"
required: false
hint: "Arbeitsblätter, Vorlagen o. Ä. zum Herunterladen - gehören zu dieser Variante, nicht zur Methode allgemein"
# Deliberately no dedicated media_folder subfolder (e.g. "src"): a
# git folder that has never contained a file simply doesn't exist -
# Gitea returns HTTP 400 for that instead of an empty list, and
# Decap only catches 404. The variant's own bundle folder, on the
# other hand, always exists (because of index.md), hence
# attachments live directly there.
fields:
- { label: "Datei", name: "datei", widget: "file" }
- { label: "Beschreibung", name: "beschreibung", widget: "string", hint: "Kurze Einordnung, wofür der Anhang gedacht ist" }
+256
View File
@@ -0,0 +1,256 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Ableger – Redaktion</title>
<!-- Same stylesheet as the Hugo website (site-header/site-title/
site-nav, color variables) - for our own header below, not for
Decap's own UI (that's reskinned by the block below). -->
<link rel="stylesheet" href="/css/style.css">
<style>
/*
Decap CMS doesn't ship theming via CSS variables; its class names
are Emotion hashes that can change with every build. We therefore
deliberately target structural partial class names (e.g.
"ControlContainer") instead of exact hash classes - more stable
against Decap version changes, even if not 100% future-proof.
*/
/* Primary color for the active form field (label pill + input
border). Set both background AND text color explicitly: for
nested fields (e.g. in list entries) Decap never marks the label
itself as "active" and therefore never automatically ships the
white text along with it - without our own color, the text would
stay dark gray and barely readable on teal. */
[class*="ControlContainer"]:focus-within [class*="ControlTopbar"] label {
background-color: var(--color-accent) !important;
color: #fff !important;
}
[class*="ControlContainer"] input:focus,
[class*="ControlContainer"] textarea:focus,
[class*="ControlContainer"] select:focus {
border-color: var(--color-accent) !important;
}
/* Group size (min/max) side by side instead of stacked */
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) {
display: flex;
flex-wrap: wrap;
column-gap: 1rem;
}
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) > [class*="ControlContainer"] {
width: 100%;
}
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) > [class*="ControlContainer"]:has(label[for^="gruppengroesse_min-field-"]),
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) > [class*="ControlContainer"]:has(label[for^="gruppengroesse_max-field-"]) {
width: calc(50% - 0.5rem);
}
/* The publish button (edit page) and the sort button (overview) use
the same button type. Depending on state (e.g. "Publish" vs.
"Published", or "Sort by"), Decap ships different, sometimes very
dark text colors that were meant for Decap's respective default
background - not necessarily readable on our teal. Text color is
therefore set uniformly to white for all states. */
[class*="StyledDropdownButton"] {
background-color: var(--color-accent) !important;
color: #fff !important;
}
/* Preview show/hide and auto-scroll icons to the right of the
preview. The icons themselves use currentColor, so the text color
is enough. */
[class*="EditorToggle"] {
color: var(--color-accent) !important;
}
/* Rich text/markdown switch in the markdown field. Do not apply to
boolean fields (e.g. "Veröffentlicht") - their class additionally
contains "BooleanBackground" and needs visibly different colors
for on/off, otherwise the state isn't recognizable. */
[class*="ToggleBackground"]:not([class*="BooleanBackground"]) {
background-color: var(--color-accent) !important;
}
/* Header of the overview page (Contents / Media). "Contents" is a
link (class additionally contains "AppHeaderNavLink"), "Media" on
the other hand is a plain button without that addition -
"AppHeaderButton" is the common denominator. */
[class*="AppHeaderButton"] {
color: var(--color-accent) !important;
}
/* Global "Media" button hidden: it always uploads into the
site-wide fallback folder (media_folder/public_folder above in
config.yml), regardless of which method you're currently working
on - useless for our workflow and potentially confusing. "Media"
is the only match for AppHeaderButton without AppHeaderNavLink
(checked, see comment above), so "Contents" stays untouched. */
[class*="AppHeaderButton"]:not([class*="AppHeaderNavLink"]) {
display: none !important;
}
/* Sidebar (list of collections): text always in the primary color,
the active entry additionally with a lighter primary surface
instead of Decap blue. NOT via [class*="sidebarNavLinkActive"]:
Emotion generates this substring as part of the base class name
for EVERY instance of the component (active or not) - verified
live via DOM inspection, both sidebar entries carried the same
"...sidebarNavLinkActive..." class, making both look active. The
actual difference is the aria-current attribute, which Decap only
sets on the active entry. */
[class*="SidebarNavLink"] {
color: var(--color-accent) !important;
}
[class*="SidebarNavLink"][aria-current="page"] {
background-color: color-mix(in srgb, var(--color-accent) 12%, transparent) !important;
border-left: 2px solid var(--color-accent) !important;
}
/*
A dedicated header around Decap CMS (instead of an isolated page),
so the editorial area feels like part of the same website, not a
jump into a foreign tool. Decap mounts specifically into #nc-root
for this instead of taking over the whole <body> - an officially
supported mechanism, see
https://decapcms.org/docs/custom-mounting/.
Known Decap bug (https://github.com/decaporg/decap-cms/issues/7197):
the editor toolbar is internally "position: fixed" relative to the
viewport, not to #nc-root - without a countermeasure it would slide
over our own header instead of staying below it. Fix: "transform"
on an ancestor of #nc-root creates a new containing block for
"position: fixed" descendants (CSS spec, not a Decap-specific
hack) - effectively makes Decap's toolbar relative to
#nc-root-wrap instead of the real viewport. Verified locally.
*/
.nc-root-wrap {
transform: translate(0, 0);
min-height: calc(100vh - 3.75rem);
}
</style>
</head>
<body>
<header class="site-header">
<a class="site-title" href="/">
<img src="/img/logo.svg" alt="" class="site-logo" width="32" height="32">
<span id="site-title-text">Ableger</span>
</a>
<nav class="site-nav">
<a href="/admin/status/">Status</a>
<a href="/">← Zur Website</a>
</nav>
</header>
<script src="/admin/site-meta.js" data-title-suffix=" – Redaktion"></script>
<div class="nc-root-wrap">
<div id="nc-root"></div>
</div>
<!-- Loads Decap CMS from a CDN; configuration is read automatically from ./config.yml.
Pinned to an exact version, not a floating range like "^3.0.0" - a
floating range would let Decap update itself silently on every page
load, whereas an update should be a deliberate, tested step. See the
dependency-update chapter on the project website for how to check
for and apply updates. -->
<script src="https://unpkg.com/decap-cms@3.15.1/dist/decap-cms.js"></script>
<script>
// Custom preview templates instead of Decap's generic markdown
// rendering, so the preview looks like the real method/variant page
// while editing - including the same CSS classes and therefore the
// same dark-mode switching as the website itself (Decap CMS has no
// dark mode of its own for this, see github.com/decaporg/
// decap-cms/issues/3267, open since 2020 - but that only affects
// Decap's own forms/sidebar, not this preview here).
// API: https://decapcms.org/docs/customization/
var h = window.h;
var createClass = window.createClass;
function labelList(label, values) {
if (!values || !values.size) return null;
return h('div', {},
h('p', { className: 'method__label' }, label),
h('ul', {}, values.map(function (v, i) { return h('li', { key: i }, v); }).toArray())
);
}
function tagChips(values) {
if (!values || !values.size) return null;
return h('ul', { className: 'method__tags' },
values.map(function (v, i) { return h('li', { key: i }, h('span', {}, v)); }).toArray()
);
}
var MethodePreview = createClass({
render: function () {
var data = this.props.entry.get('data');
var zielgruppe = data.get('zielgruppe');
var kompetenzbereich = data.get('kompetenzbereich');
var kategorie = data.get('kategorie');
return h('div', { className: 'preview-wrap' },
h('article', { className: 'method' },
h('header', { className: 'method__header' },
h('h1', {}, data.get('titel')),
data.get('kurzbeschreibung') ? h('p', { className: 'method__lead' }, data.get('kurzbeschreibung')) : null
),
h('div', { className: 'method__section method__section--methode' },
h('h2', {}, 'Steckbrief'),
data.get('verwendungsmoeglichkeit') ? h('div', {},
h('p', { className: 'method__label' }, 'Verwendungsmöglichkeit'),
h('p', {}, data.get('verwendungsmoeglichkeit'))
) : null,
h('dl', { className: 'method__meta-inline' },
zielgruppe && zielgruppe.size ? h('div', {}, h('dt', {}, 'Zielgruppe'), h('dd', {}, zielgruppe.join(', '))) : null,
kompetenzbereich && kompetenzbereich.size ? h('div', {}, h('dt', {}, 'Kompetenzbereich'), h('dd', {}, kompetenzbereich.join(', '))) : null,
kategorie && kategorie.size ? h('div', {}, h('dt', {}, 'Kategorie'), h('dd', {}, kategorie.join(', '))) : null
),
labelList('Lernchancen', data.get('lernchancen')),
labelList('Herkunft', data.get('herkunft')),
labelList('Initiator:innen', data.get('initiatoren')),
tagChips(data.get('tags'))
)
)
);
}
});
var ExemplarPreview = createClass({
render: function () {
var data = this.props.entry.get('data');
var dauer = data.get('dauer_minuten');
var gmin = data.get('gruppengroesse_min');
var gmax = data.get('gruppengroesse_max');
return h('div', { className: 'preview-wrap' },
h('article', { className: 'method variant' },
h('header', { className: 'method__header' },
h('h1', {}, data.get('untertitel'))
),
h('section', { className: 'method__section' },
h('h2', {}, 'Diese Variante'),
data.get('varianten_beschreibung') ? h('p', { className: 'method__lead' }, data.get('varianten_beschreibung')) : null,
h('dl', { className: 'method__meta-inline' },
dauer != null ? h('div', {}, h('dt', {}, 'Dauer'), h('dd', {}, dauer + ' Minuten')) : null,
(gmin != null || gmax != null) ? h('div', {}, h('dt', {}, 'Gruppengröße'), h('dd', {}, gmin === gmax ? gmin : gmin + '–' + gmax)) : null,
data.get('lizenz') ? h('div', {}, h('dt', {}, 'Lizenz'), h('dd', {}, data.get('lizenz'))) : null
),
labelList('Material', data.get('material')),
labelList('Autor:innen', data.get('autoren')),
labelList('Quellen', data.get('quellen'))
),
h('div', { className: 'method__body' }, this.props.widgetFor('body'))
)
);
}
});
CMS.registerPreviewTemplate('methoden', MethodePreview);
CMS.registerPreviewTemplate('varianten', ExemplarPreview);
CMS.registerPreviewStyle('/css/style.css');
// The website itself wraps .method with .site-main (max-width,
// inner padding) - that's not in style.css (that's page layout, not
// component style), so it's rebuilt separately here for the preview.
CMS.registerPreviewStyle('.preview-wrap { max-width: 48rem; margin: 0 auto; padding: 1.5rem; }', { raw: true });
</script>
</body>
</html>
+17
View File
@@ -0,0 +1,17 @@
// Loads the site title from /site-meta.json (see hugo.toml,
// outputFormats.SiteMeta) instead of hardcoding "Ableger" - these pages run
// without Hugo templating (see the installation guide on the project website). On failure, the
// "Ableger" fallback already in the markup stays. Shared by admin/index.html
// and admin/status/index.html, which only differ in the title suffix -
// passed in via this script tag's own "data-title-suffix" attribute.
(function () {
var suffix = document.currentScript.dataset.titleSuffix || '';
fetch('/site-meta.json')
.then(function (r) { return r.json(); })
.then(function (meta) {
if (!meta.title) return;
document.title = meta.title + suffix;
document.getElementById('site-title-text').textContent = meta.title;
})
.catch(function () {});
})();
+115
View File
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Ableger – Deploy-Status</title>
<link rel="stylesheet" href="/css/style.css">
<style>
/* Standalone static page (no Decap, no nc-root needed) - a plain
HTML/JS page that talks to the small dynamic endpoints under
/admin/status/api/ (see scripts/admin-status-server.rb). Both
paths run behind the same write oauth2-proxy instance as /admin/
itself, see the installation guide on the project website. */
.status-badge {
display: inline-block;
padding: 0.2rem 0.7rem;
border-radius: 999px;
font-size: 0.85rem;
font-weight: 600;
}
.status-badge--ok { background: color-mix(in srgb, var(--color-accent) 15%, transparent); color: var(--color-accent); }
.status-badge--fail { background: rgba(200, 60, 60, 0.15); color: #c83c3c; }
.status-log {
background: var(--color-card-bg);
border: 1px solid var(--color-border);
border-radius: var(--radius);
padding: 1rem;
overflow-x: auto;
white-space: pre-wrap;
font-size: 0.85rem;
max-height: 32rem;
overflow-y: auto;
}
#trigger-status { color: var(--color-muted); font-size: 0.9rem; margin-left: 0.75rem; }
</style>
</head>
<body>
<header class="site-header">
<a class="site-title" href="/">
<img src="/img/logo.svg" alt="" class="site-logo" width="32" height="32">
<span id="site-title-text">Ableger</span>
</a>
<nav class="site-nav">
<a href="/admin/">Redaktion</a>
<a href="/">← Zur Website</a>
</nav>
</header>
<main class="site-main">
<h1>Deploy-Status</h1>
<p class="method__lead">Letzter Build (Cron alle 10 Minuten, oder manuell hier ausgelöst) inklusive Prüfskript-Ergebnissen (<code>scripts/validate.rb</code>).</p>
<section class="method__section">
<button type="button" id="trigger-button" class="button block is-primary">Build jetzt auslösen</button>
<span id="trigger-status"></span>
</section>
<section class="method__section" id="status-section">
<p>Lade Status …</p>
</section>
</main>
<script src="/admin/site-meta.js" data-title-suffix=" – Deploy-Status"></script>
<script>
const statusSection = document.getElementById('status-section');
const triggerButton = document.getElementById('trigger-button');
const triggerStatus = document.getElementById('trigger-status');
function render(data) {
if (data.error) {
statusSection.innerHTML = '<p>' + data.error + '</p>';
return;
}
const zeit = new Date(data.timestamp).toLocaleString('de-DE');
const badge = data.success
? '<span class="status-badge status-badge--ok">erfolgreich</span>'
: '<span class="status-badge status-badge--fail">fehlgeschlagen</span>';
statusSection.innerHTML =
'<h2>Letzter Lauf: ' + zeit + ' ' + badge + '</h2>' +
'<pre class="status-log"></pre>';
// Set the log via textContent instead of innerHTML, so that
// characters it contains (e.g. < > from error messages) aren't
// interpreted as HTML.
statusSection.querySelector('.status-log').textContent = data.log || '(kein Log vorhanden)';
}
function load() {
fetch('/admin/status/api/data.json')
.then(function (r) { return r.json(); })
.then(render)
.catch(function () {
statusSection.innerHTML = '<p>Status konnte nicht geladen werden.</p>';
});
}
triggerButton.addEventListener('click', function () {
triggerButton.disabled = true;
triggerStatus.textContent = 'Build läuft …';
fetch('/admin/status/api/trigger', { method: 'POST' })
.then(function (r) { return r.json(); })
.then(function (data) {
render(data);
triggerStatus.textContent = 'Fertig.';
})
.catch(function () {
triggerStatus.textContent = 'Fehlgeschlagen.';
})
.finally(function () {
triggerButton.disabled = false;
});
});
load();
</script>
</body>
</html>
+3
View File
@@ -0,0 +1,3 @@
---
title: "Suche"
---
+175
View File
@@ -0,0 +1,175 @@
# hugo/hugo.template.toml
# Root configuration for Ableger - template, not read by Hugo directly.
# scripts/generate-config.sh generates hugo/hugo.toml from this file (same
# {{VARIABLE}} substitution it already does for admin/config.yml), filling
# in WEBSITE_DOMAIN/GITEA_DOMAIN/METHODEN_REPO from install.env. hugo.toml
# itself is generated and not versioned (see .gitignore) - edit this file
# instead. Reason: Hugo's own config file can't read install.env, so these
# two values (baseURL, methoden_repo_url below) would otherwise have to be
# kept in sync by hand on every fork - found live, twice, while setting up
# a second test instance.
baseURL = "https://{{WEBSITE_DOMAIN}}/"
locale = "de-DE"
title = "Ableger"
# Once module.mounts is set at all, every mount needed must be listed
# explicitly - Hugo's default mounts no longer apply automatically then.
[[module.mounts]]
# Method content lives in the separate repo ableger_demo/ableger_methoden
# (see the concept chapter on the project website Abschnitt 9). ../_content is freshly fetched by
# scripts/sync-methoden.sh (not versioned, see .gitignore) and itself
# contains a methoden/ subfolder (Decap CMS workaround, see
# admin/config.yml).
source = "../_content/methoden"
target = "content"
[[module.mounts]]
# Variants (preparation/procedure/background per method, see Konzept
# Abschnitt 8) live as their own Decap collection in a dedicated top-level
# folder in the content repo, not inside the method's own folder - the
# link to the corresponding method happens via a relation field,
# evaluated in hugo/layouts/_default/single.html via "where", not via
# file paths. varianten/_index.md (in the content repo, not managed by
# Decap) hides variant pages from all views that list methods (cascade
# "_build.list: never") - they can still be opened individually, just
# aren't part of .Site.RegularPages.
source = "../_content/varianten"
target = "content/varianten"
[[module.mounts]]
# protokoll_version for the footer (see layouts/_default/baseof.html) -
# the same file that the Manifest chapter on the project website requires as Regel 14. Lives at the
# root of the content repo, not in methoden/ or varianten/.
source = "../_content/ableger.yml"
target = "data/ableger.yml"
[[module.mounts]]
# Static pages with no relation to the content repo (currently: /suche/,
# see layouts/suche/list.html) - a dedicated mount versioned here in the
# website repo instead of a local hugo/content/ folder, because
# module.mounts is already set, so Hugo's implicit default mount for
# "content" no longer applies (see comment above).
source = "content-static"
target = "content"
[[module.mounts]]
source = "static"
target = "static"
[[module.mounts]]
source = "layouts"
target = "layouts"
[[module.mounts]]
source = "assets"
target = "assets"
[[module.mounts]]
source = "data"
target = "data"
# Taxonomies: map the metadata fields from the schema (Abschnitt 8 of the
# Konzept) directly to filterable, searchable categories - no extra code.
# Key and value deliberately kept identical (instead of e.g.
# zielgruppe = "zielgruppen"): Hugo's automatic singular/plural detection is
# built for English words and otherwise creates extra, empty ghost
# taxonomies for German plural forms. The only exception: `tag`/"tags",
# because the frontmatter field itself is already called "tags".
# Variants live in Hugo's "varianten" section (see module.mounts above),
# but are meant to appear in the URL without a folder prefix, just like
# methods (expected by the Decap preview button, preview_path:
# "{{dirname}}" in admin/config.template.yml - without this override,
# preview would point to a 404 URL without the "varianten/" prefix). :slug
# is always "<methode>--<untertitel>" for variants, so it doesn't collide
# with method slugs.
[permalinks]
# :slug stays empty here (variants have no title/slug frontmatter field -
# the slug is derived purely from the folder name assigned by Decap),
# :contentbasename is used instead, which takes the actual bundle folder
# name. Verified live: with :slug, all variant URLs collapsed onto "/"
# (":filename" would be the obvious name, but has been removed since Hugo
# 0.144).
varianten = "/:contentbasename/"
# Raw markdown per variant, for the methoden-set tool (methoden-set/, see
# the Methoden-Set chapter on the project website) - serves a self-describing markdown document under
# "<variant>index.md" (own YAML header, steckbrief and variant fields,
# content, attachment links) that the client fetches via fetch(), instead
# of parsing HTML.
[outputFormats.MethodenSetMd]
mediaType = "text/markdown"
baseName = "index"
isPlainText = true
notAlternative = true
[[cascade]]
outputs = ["HTML", "MethodenSetMd"]
[cascade.target]
kind = "page"
path = "{/varianten/**}"
# Method URLs also serve "index.md" - with exactly one variant, using the
# same document as the variant itself (see partials/methoden-set-
# dokument.html and _default/single.md), otherwise a short notice document.
# Reason: if a method has only one variant, its HTML page
# (_default/single.html) embeds the variant text directly, without showing
# a visible link to the actual variant URL - so users are likely to copy
# the method URL, not the (non-obvious) variant URL. A dedicated, second
# cascade rule instead of a single "{/**}" pattern for both sections:
# method paths have exactly one segment ("/beispiel-methode"), variant
# paths have two ("/varianten/<slug>") - the "{/*}" glob (no "**") only
# matches single path segments, so it doesn't collide with the rule above.
[[cascade]]
outputs = ["HTML", "MethodenSetMd"]
[cascade.target]
kind = "page"
path = "{/*}"
# Serves the site title (among other things) as JSON under /site-meta.json -
# admin/index.html and admin/status/index.html are plain static files
# without Hugo templating (see the installation guide on the project website, copied unchanged
# via rsync) and therefore load this file via fetch(), so "Ableger" isn't
# hardcoded a second time in the title/header but taken from .Site.Title.
[outputFormats.SiteMeta]
mediaType = "application/json"
baseName = "site-meta"
isPlainText = true
notAlternative = true
[outputs]
home = ["HTML", "RSS", "SiteMeta"]
[taxonomies]
zielgruppe = "zielgruppe"
kompetenzbereich = "kompetenzbereich"
kategorie = "kategorie"
tag = "tags"
[params]
# First sentence on the homepage - deliberately generic instead of
# provider-specific, so forks don't have to change it.
beschreibung = "Ableger ist eine strukturierte Sammlung von Methoden."
# Primary (accent) color of the read UI - set as a CSS custom property in baseof.html.
farbe_primaer = "#3c8a98"
# Footer link to the content repo (see layouts/_default/baseof.html) -
# replaces a blanket license sentence, which would be wrong anyway since
# variants were introduced (no longer ONE value for all methods, see the
# "Manifest" chapter on the project website). Derived automatically from
# GITEA_DOMAIN + METHODEN_REPO in install.env, not edited here directly.
methoden_repo_url = "https://{{GITEA_DOMAIN}}/{{METHODEN_REPO}}"
# Provider name for the footer (see layouts/_default/baseof.html).
# Rendered as a link when betreiber_url is set, otherwise as plain text.
betreiber_name = "Ableger-Projekt"
# Link to the provider. Placeholder - adjust on a fork.
betreiber_url = "https://example.org"
# Imprint, privacy policy, and a link to the website repo (counterpart to
# methoden_repo_url above, for the footer placeholder "Ableger-Projekt") -
# still without a target, since there is no project page for it yet. As
# long as these three lines stay commented out, the footer keeps showing
# the previous "Folgt" placeholder (see baseof.html). On a fork, fill in
# your own URL here once you have one.
# impressum_url = ""
# datenschutz_url = ""
# website_repo_url = ""
@@ -0,0 +1,18 @@
{{/* We resolve image paths in variant content (![](datei.svg)) via the
page resources of the page the content belongs to (the variant) - not
the page that embeds .Content. With only one variant, the method page
(hugo/layouts/_default/single.html) embeds this content directly; a
raw relative path would resolve against the wrong URL there (the file
lives in the variant's bundle folder, not the method's). An absolute
permalink makes the embed location-independent. */}}
{{- $resource := "" }}
{{- if not (urls.Parse .Destination).IsAbs }}
{{- with .Page.Resources.GetMatch .Destination }}
{{- $resource = . }}
{{- end }}
{{- end }}
{{- if $resource }}
<img src="{{ $resource.Permalink }}" alt="{{ .Text }}"{{ with .Title }} title="{{ . }}"{{ end }}>
{{- else }}
<img src="{{ .Destination }}" alt="{{ .Text }}"{{ with .Title }} title="{{ . }}"{{ end }}>
{{- end }}
+191
View File
@@ -0,0 +1,191 @@
<!DOCTYPE html>
<html lang="{{ .Site.Language.Locale | default "de" }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{ $seiten_titel := .Params.titel | default .Title }}
{{ $beschreibung := .Params.kurzbeschreibung | default .Site.Params.beschreibung }}
{{ if eq .Section "varianten" }}
{{ with partial "methode-fuer-variante.html" . }}
{{ $seiten_titel = printf "%s – %s" (.Params.titel | default .Title) $.Params.untertitel }}
{{ $beschreibung = .Params.kurzbeschreibung | default $.Site.Params.beschreibung }}
{{ end }}
{{ end }}
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ $seiten_titel }} · {{ .Site.Title }}{{ end }}</title>
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.beschreibung }}{{ else }}{{ $beschreibung }}{{ end }}">
<link rel="stylesheet" href="{{ "css/style.css" | relURL }}">
{{/* SVG first: has dark-mode switching built in (@media
prefers-color-scheme within the file itself) and is preferred by
current browsers. The PNG variants below are the fallback for
browsers/contexts without SVG favicon support - since PNGs can't do
@media queries themselves, there's a separate light/dark pair for
them with media="(prefers-color-scheme: ...)" on the <link> itself
(introduced by Safari, meanwhile more widely supported). Without
this, the PNG fallback would be low-contrast in dark browser chrome
(dark green icon on a transparent background). */}}
<link rel="icon" href="{{ "favicon.svg" | relURL }}" type="image/svg+xml">
<link rel="icon" href="{{ "favicon-32x32.png" | relURL }}" sizes="32x32" type="image/png" media="(prefers-color-scheme: light)">
<link rel="icon" href="{{ "favicon-16x16.png" | relURL }}" sizes="16x16" type="image/png" media="(prefers-color-scheme: light)">
<link rel="icon" href="{{ "favicon-32x32-dark.png" | relURL }}" sizes="32x32" type="image/png" media="(prefers-color-scheme: dark)">
<link rel="icon" href="{{ "favicon-16x16-dark.png" | relURL }}" sizes="16x16" type="image/png" media="(prefers-color-scheme: dark)">
<link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | relURL }}">
{{ with .Site.Params.farbe_primaer }}
<style>:root{ --color-accent: {{ . }}; }</style>
{{ end }}
</head>
<body>
<header class="site-header">
<a class="site-title" href="{{ "/" | relURL }}">
<img src="{{ "img/logo.svg" | relURL }}" alt="" class="site-logo" width="32" height="32">
{{ .Site.Title }}
</a>
<div class="site-header__actions">
{{/* On a wide screen, a real, always-visible search bar; on narrow
screens it expands via the button. Deliberately NO <details>
here AND for "Stöbern" (browse) (unlike an earlier version):
<details> internally collapses to 0×0 in current Chromium
versions as soon as you try to override the closed state via CSS
(reproduced live) - and has no native "expand on hover" anyway.
Instead both are a button + CSS-driven panel, visible via hover
(only on pointer devices with hover, see style.css), keyboard
focus, or click/tap - click/tap for touch devices without hover,
see inline script below. Also works completely without
JavaScript: a real <form method="get">, submitting navigates to
/?q=... - filter.js prevents that only on the homepage itself
and filters live instead, see there. */}}
<div class="header-search" id="header-search">
<button type="button" class="header-toggle" id="header-search-toggle" aria-expanded="false" aria-controls="header-search-form">Suchen</button>
{{/* Target since the introduction of Pagefind full-text search:
/suche/ instead of / - filter.js still only prevents
submission on the homepage itself (that's where the fast
metadata filtering over the cards lives, see there); on every
other page a real <form method="get"> now navigates to the
full-text search instead of the weaker metadata search on the
homepage. */}}
<form class="header-search__form" id="header-search-form" action="{{ "/suche/" | relURL }}" method="get" role="search">
<label for="header-search-input" class="visually-hidden">Suchen</label>
<input type="search" name="q" id="header-search-input" placeholder="Titel, Beschreibung, Tags …" autocomplete="off">
</form>
</div>
{{/* "Stöbern" (browse) always expands regardless of screen width -
the same four overview pages as previously in the main
navigation. */}}
<div class="header-browse" id="header-browse">
<button type="button" class="header-toggle" id="header-browse-toggle" aria-expanded="false" aria-controls="header-browse-nav">Stöbern</button>
<nav class="header-browse__nav" id="header-browse-nav">
<a href="{{ "/zielgruppe/" | relURL }}">Zielgruppen</a>
<a href="{{ "/kompetenzbereich/" | relURL }}">Kompetenzbereiche</a>
<a href="{{ "/kategorie/" | relURL }}">Kategorien</a>
<a href="{{ "/tags/" | relURL }}">Tags</a>
</nav>
</div>
{{/* Standalone, static app outside of Hugo (like /admin/, see
hugo/hugo.toml module.mounts) - hence a plain link instead of a
relURL reference to a Hugo page. A user-visible feature, so it
lives here in the header next to Suchen/Stöbern, not in the
footer next to Redaktion/Status (see the Methoden-Set chapter on the project website). */}}
<a href="/methoden-set/" class="header-toggle header-toggle--link">Methoden-Set</a>
</div>
</header>
<script>
// Runs on every page (unlike filter.js, which exits immediately if
// #method-grid is missing) - drives click/tap toggling for
// "Suchen"/"Stöbern" (hover itself is plain CSS, see style.css) and
// keeps the search open once something has been entered, even after
// the mouse moves away again or the field loses focus.
(function () {
function wireToggle(wrapperId, toggleId, staysOpen) {
var wrapper = document.getElementById(wrapperId);
var toggle = document.getElementById(toggleId);
if (!wrapper || !toggle) return;
function setOpen(open) {
wrapper.classList.toggle("is-open", open);
toggle.setAttribute("aria-expanded", String(open));
}
toggle.addEventListener("click", function () {
setOpen(!wrapper.classList.contains("is-open"));
});
document.addEventListener("click", function (event) {
if (wrapper.contains(event.target)) return;
if (staysOpen && staysOpen()) return;
setOpen(false);
});
return setOpen;
}
var searchInput = document.getElementById("header-search-input");
var searchHasValue = function () {
return !!(searchInput && searchInput.value.trim());
};
var setSearchOpen = wireToggle("header-search", "header-search-toggle", searchHasValue);
wireToggle("header-browse", "header-browse-toggle", null);
if (searchInput && setSearchOpen) {
searchInput.addEventListener("input", function () {
setSearchOpen(searchHasValue());
});
}
})();
</script>
{{/* data-pagefind-body limits the area indexed by Pagefind to the actual
page content - without this attribute, Pagefind would also index the
header (logo, "Suchen"/"Stöbern", navigation) and footer on every
single page, and every search hit would additionally carry these
terms in the index. This lives here in baseof.html, so it applies
equally to every page - no risk that individual pages drop out of
the index because of it (per Pagefind's own docs: "if
data-pagefind-body appears anywhere on the site, pages without this
attribute are no longer indexed at all"). */}}
<main class="site-main" data-pagefind-body>
{{ block "main" . }}{{ end }}
</main>
<footer class="site-footer">
<div class="site-footer__grid">
<div class="site-footer__col">
<h2 class="site-footer__heading">Ableger</h2>
<p>Ableger ist ein Framework zur Sammlung und Entwicklung von Methoden.</p>
<ul class="site-footer__links">
{{ with .Site.Params.website_repo_url }}<li><a href="{{ . }}">Ableger-Projekt</a></li>{{ else }}<li><span class="site-footer__placeholder" title="Folgt">Ableger-Projekt</span></li>{{ end }}
<li><a href="https://gohugo.io">Hugo</a></li>
<li><a href="https://decapcms.org">Decap CMS</a></li>
<li><a href="https://pagefind.app">Pagefind</a></li>
<li><a href="https://pandoc.org">Pandoc</a></li>
</ul>
</div>
<div class="site-footer__col">
<h2 class="site-footer__heading">Instanz</h2>
<ul class="site-footer__links">
{{ with .Site.Params.methoden_repo_url }}<li><a href="{{ . }}">Quell-Repository</a></li>{{ end }}
{{ if .Site.Params.betreiber_url }}<li>Betreiber: <a href="{{ .Site.Params.betreiber_url }}">{{ .Site.Params.betreiber_name }}</a></li>{{ else }}<li>Betreiber: {{ .Site.Params.betreiber_name }}</li>{{ end }}
{{ with hugo.Data.ableger }}<li>Manifest-Version {{ .protokoll_version }}</li>{{ end }}
{{/* Current commit of THIS website repo, not a frozen "forked
from template version X" marker - see
scripts/generate-version-info.sh. Deliberately separate from
"Manifest-Version" above: that one is a rarely-changing
structural compatibility marker for the data model, this one
changes with every deploy and reflects the code actually
running here (still identical to the template initially,
diverges once a fork develops further on its own). */}}
{{ with hugo.Data.website }}<li>Stand: {{ .commit }} ({{ .datum | time.AsTime | dateFormat "02.01.2006" }})</li>{{ end }}
</ul>
</div>
<div class="site-footer__col">
<ul class="site-footer__links">
{{ with .Site.Params.impressum_url }}<li><a href="{{ . }}">Impressum</a></li>{{ else }}<li><span class="site-footer__placeholder" title="Folgt">Impressum</span></li>{{ end }}
{{ with .Site.Params.datenschutz_url }}<li><a href="{{ . }}">Datenschutz</a></li>{{ else }}<li><span class="site-footer__placeholder" title="Folgt">Datenschutz</span></li>{{ end }}
<li><a href="{{ "/admin/" | relURL }}">Redaktion</a></li>
<li><a href="{{ "/admin/status/" | relURL }}">Status</a></li>
</ul>
</div>
</div>
</footer>
<script src="{{ "js/filter.js" | relURL }}" defer></script>
</body>
</html>
+11
View File
@@ -0,0 +1,11 @@
{{ define "main" }}
<section class="method-list">
<h1>{{ .Title }}</h1>
{{ with .Content }}<div class="taxonomy-intro">{{ . }}</div>{{ end }}
<div class="method-grid">
{{ range sort .Pages "Params.titel" }}
{{ partial "method-card.html" . }}
{{ end }}
</div>
</section>
{{ end }}
+40
View File
@@ -0,0 +1,40 @@
{{ define "main" }}
{{ $methode := . }}
<article class="method">
<header class="method__header">
<h1>{{ .Params.titel | default .Title }}</h1>
{{ with .Params.kurzbeschreibung }}<p class="method__lead">{{ . }}</p>{{ end }}
{{ with index hugo.Data.methoden $.File.ContentBaseName }}
<p class="method__updated">Erstellt: {{ .erstellt | time.AsTime | dateFormat "02.01.2006" }}</p>
<p class="method__updated">Zuletzt geändert: {{ .geaendert | time.AsTime | dateFormat "02.01.2006" }}</p>
{{ end }}
</header>
{{ partial "steckbrief-box.html" (dict "methode" $methode "zeigeKurzbeschreibung" false "zeigeLink" false) }}
{{/* Linked via Params.kennung, not via Params.titel or the folder
name/slug: the title may change at any time (see
the Manifest chapter on the project website), the kennung may not - Decap's relation widget
therefore stores the method's kennung in the variant's "methode"
field (value_field: "kennung" in admin/config.template.yml). */}}
{{ $varianten := partial "varianten-fuer-methode.html" . }}
{{ $varianten = sort $varianten "Params.untertitel" }}
{{ if eq (len $varianten) 1 }}
{{ with index $varianten 0 }}
{{ partial "diese-variante.html" . }}
<div class="method__body">
{{ .Content }}
</div>
{{ partial "attachments.html" . }}
{{ end }}
{{ else if gt (len $varianten) 1 }}
<section class="method__section">
<h2>Varianten</h2>
<div class="variant-grid">
{{ range $varianten }}{{ partial "variante-card.html" . }}{{ end }}
</div>
</section>
{{ end }}
</article>
{{ end }}
+27
View File
@@ -0,0 +1,27 @@
{{/* Served under "<method-url>index.md" (see [outputFormats.MethodenSetMd]
and the second cascade rule in hugo/hugo.toml), for the methoden-set
tool (methoden-set/, see the Methoden-Set chapter on the project website). Same "one variant ->
embed" logic as _default/single.html (see there): if the method has
exactly one variant, this URL returns exactly the same document as
the variant URL itself (partials/methoden-set-dokument.html) - methods
with only one variant otherwise have no URL usable via the tool,
because the HTML page embeds the variant text directly, without
showing a visible link to the actual variant URL. With 0 or several
variants, a short notice document instead of a generic 404 in the
tool - see its error messages in methoden-set/app.js. */}}
{{- $methode := . -}}
{{- $varianten := partial "varianten-fuer-methode.html" . -}}
{{- if eq (len $varianten) 1 -}}
{{- partial "methoden-set-dokument.html" (index $varianten 0) -}}
{{- else -}}
---
titel: {{ (.Params.titel | default .Title) | jsonify }}
quelle: {{ .Permalink | jsonify }}
fehler: {{ if gt (len $varianten) 1 }}"mehrere_varianten"{{ else }}"keine_variante"{{ end }}
---
{{ if gt (len $varianten) 1 -}}
Diese Methode hat mehrere Varianten. Bitte auf der Methoden-Seite die gewünschte Variante öffnen und deren eigenen Link einfügen.
{{- else -}}
Diese Methode hat noch keine veröffentlichte Variante.
{{- end }}
{{- end -}}
+10
View File
@@ -0,0 +1,10 @@
{{ define "main" }}
<section class="taxonomy-overview">
<h1>{{ .Title }}</h1>
<ul class="filter-list">
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a> ({{ len .Pages }})</li>
{{ end }}
</ul>
</section>
{{ end }}
+135
View File
@@ -0,0 +1,135 @@
{{ define "main" }}
{{/* Variants (section "varianten") are detail pages per method, not their
own methods - deliberately excluded everywhere here, otherwise they'd
show up twice in search/filter/card list. Methods themselves live at
the content root (section ""), see hugo/hugo.toml. */}}
{{ $methodenPages := where site.RegularPages "Section" "" }}
{{/* Duration/group size/license no longer sit directly on the method since
variants were introduced, but are aggregated per method from its
variants into a range/set (partials/variantenspanne.html) - here
additionally aggregated across all methods, for the outer bounds of
the filter sliders resp. the license filter list. */}}
{{ $dauerMin := 0 }}{{ $dauerMax := 0 }}{{ $dauerSeen := false }}
{{ $groesseMin := 0 }}{{ $groesseMax := 0 }}{{ $groesseSeen := false }}
{{ $lizenzen := slice }}
{{ range $methodenPages }}
{{/* partialCached with .RelPermalink as the key: method-card.html below
computes the same partial for the same page again - caching avoids
running the variantenspanne.html aggregation twice per method. */}}
{{ $spanne := partialCached "variantenspanne.html" . .RelPermalink }}
{{ $lizenzen = $lizenzen | append $spanne.lizenzen }}
{{ if $spanne.dauerSeen }}
{{ if $dauerSeen }}
{{ if lt $spanne.dauerMin $dauerMin }}{{ $dauerMin = $spanne.dauerMin }}{{ end }}
{{ if gt $spanne.dauerMax $dauerMax }}{{ $dauerMax = $spanne.dauerMax }}{{ end }}
{{ else }}
{{ $dauerMin = $spanne.dauerMin }}{{ $dauerMax = $spanne.dauerMax }}{{ $dauerSeen = true }}
{{ end }}
{{ end }}
{{ if $spanne.groesseSeen }}
{{ if $groesseSeen }}
{{ if lt $spanne.groesseMin $groesseMin }}{{ $groesseMin = $spanne.groesseMin }}{{ end }}
{{ if gt $spanne.groesseMax $groesseMax }}{{ $groesseMax = $spanne.groesseMax }}{{ end }}
{{ else }}
{{ $groesseMin = $spanne.groesseMin }}{{ $groesseMax = $spanne.groesseMax }}{{ $groesseSeen = true }}
{{ end }}
{{ end }}
{{ end }}
{{ $lizenzen = $lizenzen | uniq | sort }}
<section class="toolbar" aria-label="Filter">
<p id="result-count" role="status"></p>
{{/* Bridge to the Pagefind full-text search (layouts/suche/list.html):
the search up here only filters the cards' title/description/tags,
not the full variant text. filter.js keeps the href live in sync
with the current search field content. */}}
<a class="search-more-link" id="search-more-link" href="{{ "/suche/" | relURL }}">Volltextsuche über alle Inhalte</a>
<details class="filter-panel" id="filter-panel">
<summary>Filter</summary>
<div class="filter-panel__body">
<fieldset class="filter-group">
<legend>Zielgruppe</legend>
{{ range $term, $pages := .Site.Taxonomies.zielgruppe }}
<label class="filter-checkbox">
<input type="checkbox" data-facet="zielgruppe" value="{{ $term }}">
{{ $term | title }} <span class="filter-count">({{ len $pages }})</span>
</label>
{{ end }}
</fieldset>
<fieldset class="filter-group">
<legend>Kompetenzbereich</legend>
{{ range $term, $pages := .Site.Taxonomies.kompetenzbereich }}
<label class="filter-checkbox">
<input type="checkbox" data-facet="kompetenzbereich" value="{{ $term }}">
{{ $term | title }} <span class="filter-count">({{ len $pages }})</span>
</label>
{{ end }}
</fieldset>
<fieldset class="filter-group">
<legend>Kategorie</legend>
{{ range $term, $pages := .Site.Taxonomies.kategorie }}
<label class="filter-checkbox">
<input type="checkbox" data-facet="kategorie" value="{{ $term }}">
{{ $term | title }} <span class="filter-count">({{ len $pages }})</span>
</label>
{{ end }}
</fieldset>
{{ if gt (len $lizenzen) 1 }}
<fieldset class="filter-group">
<legend>Lizenz</legend>
{{ range $lizenzen }}
<label class="filter-checkbox">
<input type="checkbox" data-facet="lizenz" value="{{ . }}">
{{ . }}
</label>
{{ end }}
</fieldset>
{{ end }}
{{ if $dauerSeen }}
<div class="filter-group filter-range" data-range-facet="dauer" data-min="{{ $dauerMin }}" data-max="{{ $dauerMax }}">
<div class="filter-range__label">
Dauer: <output data-range-output-min>{{ $dauerMin }}</output>–<output data-range-output-max>{{ $dauerMax }}</output> Min.
</div>
<div class="filter-range__slider">
<div class="filter-range__track"></div>
<div class="filter-range__fill" data-range-fill></div>
<input type="range" min="{{ $dauerMin }}" max="{{ $dauerMax }}" value="{{ $dauerMin }}" data-range-min>
<input type="range" min="{{ $dauerMin }}" max="{{ $dauerMax }}" value="{{ $dauerMax }}" data-range-max>
</div>
</div>
{{ end }}
{{ if $groesseSeen }}
<div class="filter-group filter-range" data-range-facet="groesse" data-min="{{ $groesseMin }}" data-max="{{ $groesseMax }}">
<div class="filter-range__label">
Gruppengröße: <output data-range-output-min>{{ $groesseMin }}</output>–<output data-range-output-max>{{ $groesseMax }}</output>
</div>
<div class="filter-range__slider">
<div class="filter-range__track"></div>
<div class="filter-range__fill" data-range-fill></div>
<input type="range" min="{{ $groesseMin }}" max="{{ $groesseMax }}" value="{{ $groesseMin }}" data-range-min>
<input type="range" min="{{ $groesseMin }}" max="{{ $groesseMax }}" value="{{ $groesseMax }}" data-range-max>
</div>
</div>
{{ end }}
<button type="button" id="filter-reset">Filter zurücksetzen</button>
</div>
</details>
</section>
<section class="method-list" id="ergebnisse">
<div class="method-grid" id="method-grid">
{{ range sort $methodenPages "Params.titel" }}
{{ partial "method-card.html" . }}
{{ end }}
</div>
<p id="no-results" hidden>Keine Methoden gefunden. Filter anpassen oder Suchbegriff ändern.</p>
</section>
{{ end }}
+5
View File
@@ -0,0 +1,5 @@
{{- /* Site metadata for admin/index.html and admin/status/index.html (see
hugo.toml, outputFormats.SiteMeta) - these two files are plain static
HTML without Hugo templating and load this file via fetch(), so the
site title isn't hardcoded a second time. */ -}}
{{- dict "title" .Site.Title | jsonify -}}
+16
View File
@@ -0,0 +1,16 @@
{{/* Attachments belong to the variant (page resources in the respective
bundle folder), not the method - called with the respective variant
page as context. */}}
{{ with .Params.anhaenge }}
<section class="method__section">
<h2>Anhänge</h2>
<ul class="method__attachments">
{{ range . }}
{{ $anhang := . }}
{{ with $.Resources.GetMatch $anhang.datei }}
<li><a href="{{ .RelPermalink }}">{{ $anhang.beschreibung | default $anhang.datei }}</a></li>
{{ end }}
{{ end }}
</ul>
</section>
{{ end }}
+33
View File
@@ -0,0 +1,33 @@
{{/* "Diese Variante" (this variant) - all variant-specific details,
deliberately NOT in the steckbrief box (see
partials/steckbrief-box.html), so the box always looks the same
regardless of the number of variants. The variant description is
deliberately shown first, right under the heading. Shared between the
method page (when the method has exactly one variant) and the variant
page itself - see the project website (background/analysis notes) Teil 2.3. Called with
the respective variant as context. */}}
{{ $variante := . }}
<section class="method__section">
<h2>Diese Variante</h2>
{{ with $variante.Params.varianten_beschreibung }}<p class="method__lead">{{ . }}</p>{{ end }}
<dl class="method__meta-inline">
{{ if isset $variante.Params "dauer_minuten" }}<div><dt>Dauer</dt><dd>{{ $variante.Params.dauer_minuten }} Minuten</dd></div>{{ end }}
{{ if or (isset $variante.Params "gruppengroesse_min") (isset $variante.Params "gruppengroesse_max") }}
<div><dt>Gruppengröße</dt><dd>{{ if eq $variante.Params.gruppengroesse_min $variante.Params.gruppengroesse_max }}{{ $variante.Params.gruppengroesse_min }}{{ else }}{{ $variante.Params.gruppengroesse_min }}–{{ $variante.Params.gruppengroesse_max }}{{ end }}</dd></div>
{{ end }}
{{ with $variante.Params.lizenz }}<div><dt>Lizenz</dt><dd>{{ . }}</dd></div>{{ end }}
{{ with $variante.Params.kennung }}<div><dt>ID</dt><dd>{{ . }}</dd></div>{{ end }}
</dl>
{{ with $variante.Params.material }}
<p class="method__label">Material</p>
<ul>{{ range . }}<li>{{ . }}</li>{{ end }}</ul>
{{ end }}
{{ with $variante.Params.autoren }}
<p class="method__label">Autor:innen</p>
<ul>{{ range . }}<li>{{ . }}</li>{{ end }}</ul>
{{ end }}
{{ with $variante.Params.quellen }}
<p class="method__label">Quellen</p>
<ul>{{ range . }}<li>{{ . }}</li>{{ end }}</ul>
{{ end }}
</section>
+65
View File
@@ -0,0 +1,65 @@
{{ $p := . }}
{{ $spanne := partialCached "variantenspanne.html" $p $p.RelPermalink }}
{{ $searchbits := slice ($p.Params.titel | default $p.Title) }}
{{ with $p.Params.kurzbeschreibung }}{{ $searchbits = $searchbits | append . }}{{ end }}
{{ with $p.Params.verwendungsmoeglichkeit }}{{ $searchbits = $searchbits | append . }}{{ end }}
{{ with $p.Params.zielgruppe }}{{ $searchbits = $searchbits | append (delimit . " ") }}{{ end }}
{{ with $p.Params.kompetenzbereich }}{{ $searchbits = $searchbits | append (delimit . " ") }}{{ end }}
{{ with $p.Params.kategorie }}{{ $searchbits = $searchbits | append (delimit . " ") }}{{ end }}
{{ with $p.Params.tags }}{{ $searchbits = $searchbits | append (delimit . " ") }}{{ end }}
{{ with $spanne.lizenzen }}{{ $searchbits = $searchbits | append (delimit . " ") }}{{ end }}
{{ $searchtext := delimit $searchbits " " | lower }}
<article class="method-card"
data-search="{{ $searchtext }}"
data-zielgruppe="{{ with $p.Params.zielgruppe }}{{ delimit . "|" }}{{ end }}"
data-kompetenzbereich="{{ with $p.Params.kompetenzbereich }}{{ delimit . "|" }}{{ end }}"
data-kategorie="{{ with $p.Params.kategorie }}{{ delimit . "|" }}{{ end }}"
data-lizenz="{{ with $spanne.lizenzen }}{{ delimit . "|" }}{{ end }}"
data-dauer-min="{{ if $spanne.dauerSeen }}{{ $spanne.dauerMin }}{{ end }}"
data-dauer-max="{{ if $spanne.dauerSeen }}{{ $spanne.dauerMax }}{{ end }}"
data-gruppengroesse-min="{{ if $spanne.groesseSeen }}{{ $spanne.groesseMin }}{{ end }}"
data-gruppengroesse-max="{{ if $spanne.groesseSeen }}{{ $spanne.groesseMax }}{{ end }}"
>
<h3><a href="{{ $p.RelPermalink }}">{{ $p.Params.titel | default $p.Title }}</a></h3>
{{ with $p.Params.kurzbeschreibung }}<p class="method-card__desc">{{ . }}</p>{{ end }}
<dl class="method-card__meta">
{{ if $spanne.dauerSeen }}
<div><dt>Dauer</dt><dd>{{ if eq $spanne.dauerMin $spanne.dauerMax }}{{ $spanne.dauerMin }}{{ else }}{{ $spanne.dauerMin }}–{{ $spanne.dauerMax }}{{ end }} Min.</dd></div>
{{ end }}
{{ if $spanne.groesseSeen }}
<div><dt>Gruppengröße</dt><dd>{{ if eq $spanne.groesseMin $spanne.groesseMax }}{{ $spanne.groesseMin }}{{ else }}{{ $spanne.groesseMin }}–{{ $spanne.groesseMax }}{{ end }}</dd></div>
{{ end }}
</dl>
{{ with $p.Params.zielgruppe }}
<div class="method-card__group">
<p class="method-card__label">Zielgruppe</p>
<ul class="method-card__tags method-card__tags--zielgruppe">
{{ range . }}<li><button type="button" class="facet-chip" data-facet="zielgruppe" data-value="{{ . }}">{{ . }}</button></li>{{ end }}
</ul>
</div>
{{ end }}
{{ with $p.Params.kompetenzbereich }}
<div class="method-card__group">
<p class="method-card__label">Kompetenzbereich</p>
<ul class="method-card__tags method-card__tags--kompetenz">
{{ range . }}<li><button type="button" class="facet-chip" data-facet="kompetenzbereich" data-value="{{ . }}">{{ . }}</button></li>{{ end }}
</ul>
</div>
{{ end }}
{{ with $p.Params.kategorie }}
<div class="method-card__group">
<p class="method-card__label">Kategorie</p>
<ul class="method-card__tags method-card__tags--kategorie">
{{ range . }}<li><button type="button" class="facet-chip" data-facet="kategorie" data-value="{{ . }}">{{ . }}</button></li>{{ end }}
</ul>
</div>
{{ end }}
{{ with $p.Params.tags }}
<div class="method-card__group">
<p class="method-card__label">Tags</p>
<ul class="method-card__tags">
{{ range . }}<li><button type="button" class="facet-chip facet-chip--tag" data-facet="search" data-value="{{ . }}">{{ . }}</button></li>{{ end }}
</ul>
</div>
{{ end }}
</article>
@@ -0,0 +1,7 @@
{{/* Returns the method page belonging to the variant (or nil, if none is
found - should practically never happen due to Regel 1 in
scripts/validate.rb). Called with the respective variant as context.
Linked via Params.kennung, not via Params.titel or the filename/slug,
see admin/config.template.yml and the Manifest chapter on the project website. */}}
{{ $matches := where site.RegularPages "Params.kennung" .Params.methode }}
{{ if $matches }}{{ return (index $matches 0) }}{{ end }}
@@ -0,0 +1,85 @@
{{/* Self-describing markdown document for a variant, for the methoden-set
tool (methoden-set/, see the Methoden-Set chapter on the project website). Shared by
varianten/single.md (own variant URL) and _default/single.md (method
URL, when the method has exactly one variant - the same "one variant
-> embed" logic as _default/single.html, see there) - methods with
only one variant otherwise have no URL usable via the tool, because
their HTML page embeds the variant text directly, without showing a
visible link to the actual variant URL. Deliberately ONLY a minimal
YAML header (titel, quelle) - the client only needs the title from it
for the sort list and the source as a validation anchor; authors/
license/origin are instead written as readable text directly into the
body (a prose citation at the end), no second metadata structure to
parse in JS needed for that - assembly happens here in Hugo, not in
the client. Fields/order follow partials/steckbrief-box.html and
partials/diese-variante.html, just rendered as markdown instead of
HTML. Called with the respective variant as context. */}}
{{- $variante := . -}}
{{- $methode := partial "methode-fuer-variante.html" . -}}
{{- $methodenTitel := "" -}}
{{- with $methode }}{{ $methodenTitel = (.Params.titel | default .Title) }}{{ end -}}
{{- $titel := printf "%s – %s" $methodenTitel $variante.Params.untertitel -}}
{{/* Embedded images (![](datei.svg)) are still relative in the raw
markdown - unlike .Content (see _markup/render-image.html), Hugo does
not apply its render hooks to .RawContent. So for every page resource
of the variant, the filename in the parenthesized part of a markdown
image reference is replaced here by the absolute permalink URL, so the
image also resolves outside the original page (zip/markdown/Word) -
covers the "![Alt](datei)" case used in practice, not every
conceivable markdown syntax variant (e.g. reference links). */ -}}
{{- $inhalt := $variante.RawContent -}}
{{- range $variante.Resources -}}
{{- $inhalt = replace $inhalt (printf "](%s)" .Name) (printf "](%s)" .Permalink) -}}
{{- end -}}
{{/* Sections written by users (preparation/procedure/background) are H1 in
the editor, but here should sit under the document heading and
"## Diese Variante", not next to it - see
partials/methoden-set-shift-headings.html. */ -}}
{{- $inhalt = partial "methoden-set-shift-headings.html" $inhalt -}}
---
titel: {{ $titel | jsonify }}
quelle: {{ $variante.Permalink | jsonify }}
---
# {{ $titel }}
{{ with $methode }}
{{ with .Params.verwendungsmoeglichkeit }}{{ . }}
{{ end }}
## Steckbrief
{{ with .Params.zielgruppe }}- Zielgruppe: {{ delimit . ", " }}
{{ end -}}
{{ with .Params.kompetenzbereich }}- Kompetenzbereich: {{ delimit . ", " }}
{{ end -}}
{{ with .Params.kategorie }}- Kategorie: {{ delimit . ", " }}
{{ end -}}
{{ if isset $variante.Params "dauer_minuten" }}- Dauer: {{ $variante.Params.dauer_minuten }} Minuten
{{ end -}}
{{ if or (isset $variante.Params "gruppengroesse_min") (isset $variante.Params "gruppengroesse_max") -}}
- Gruppengröße: {{ if eq $variante.Params.gruppengroesse_min $variante.Params.gruppengroesse_max }}{{ $variante.Params.gruppengroesse_min }}{{ else }}{{ $variante.Params.gruppengroesse_min }}–{{ $variante.Params.gruppengroesse_max }}{{ end }}
{{ end -}}
{{ with $variante.Params.lizenz }}- Lizenz: {{ . }}
{{ end }}
{{ with .Params.lernchancen }}**Lernchancen:** {{ delimit . ", " }}
{{ end -}}
{{ end }}
## Diese Variante
{{ with $variante.Params.varianten_beschreibung }}{{ . }}
{{ end -}}
{{ $inhalt }}
{{ with $variante.Params.anhaenge }}
## Anhänge
{{ range . }}
{{ $anhang := . }}
{{ with $variante.Resources.GetMatch $anhang.datei }}- [{{ $anhang.beschreibung | default $anhang.datei }}]({{ .Permalink }})
{{ end -}}
{{ end }}
{{ end }}
---
*Quelle: [{{ $titel }}]({{ $variante.Permalink }}){{ with $variante.Params.autoren }} · Autor:innen: {{ delimit . ", " }}{{ end }}{{ with $variante.Params.lizenz }} · Lizenz: {{ . }}{{ end }}*
@@ -0,0 +1,36 @@
{{/* Shifts ATX headings (#, ##, ...) in the given markdown text down by one
level (H1->H2 etc.), outside fenced code blocks (``` or ~~~). Reason:
users write preparation/procedure/background as standalone H1
sections (see the Decap CMS editor), which in the methoden-set
document (varianten/single.md) should sit under the document heading
and "## Diese Variante" though, not next to it at the same level.
Called with the text as context, returns the shifted text (see
hugo/layouts/varianten/single.md). Known limit: at most H5->H6, an H6
would stay unshifted (no valid H7 in markdown) - doesn't occur in
practice for this content (preparation/procedure/background, rarely
deeper than H3). */}}
{{- $text := . -}}
{{- $lines := split $text "\n" -}}
{{- $inFence := false -}}
{{- $fenceChar := "" -}}
{{- $ergebnis := slice -}}
{{- range $lines -}}
{{- $line := . -}}
{{- $trimmed := trim $line " \t" -}}
{{- $neueZeile := $line -}}
{{- if or (hasPrefix $trimmed "```") (hasPrefix $trimmed "~~~") -}}
{{- $char := substr $trimmed 0 1 -}}
{{- if not $inFence -}}
{{- $inFence = true -}}
{{- $fenceChar = $char -}}
{{- else if eq $char $fenceChar -}}
{{- $inFence = false -}}
{{- end -}}
{{- else if not $inFence -}}
{{- if findRE "^#{1,5} " $line -}}
{{- $neueZeile = printf "#%s" $line -}}
{{- end -}}
{{- end -}}
{{- $ergebnis = $ergebnis | append $neueZeile -}}
{{- end -}}
{{- delimit $ergebnis "\n" -}}
+51
View File
@@ -0,0 +1,51 @@
{{/* The "Steckbrief" (profile) box looks the same everywhere, regardless of
whether it's seen on the method page (with one or several variants)
or on the variant page - see the project website (background/analysis notes) Teil 2.3. It
therefore contains exclusively method-owned details:
verwendungsmoeglichkeit, zielgruppe/kompetenzbereich/kategorie/ID,
lernchancen, herkunft, initiatoren, tags. Variant-specific fields
(variant description, duration, group size, material, authors,
license, sources) deliberately do NOT belong here, see
partials/diese-variante.html - otherwise the box would look different
depending on the number of variants. Expects a dict: methode,
zeigeKurzbeschreibung (true only on the variant page, since it's not
visible anywhere else there - on the method page it's already in
method__header), zeigeLink (true only on the variant page, for the
back-link to the method). */}}
{{ $methode := .methode }}
<div class="method__section method__section--methode">
<h2>Steckbrief</h2>
{{ if .zeigeKurzbeschreibung }}
{{ with $methode.Params.kurzbeschreibung }}<p class="method__lead">{{ . }}</p>{{ end }}
{{ end }}
{{ with $methode.Params.verwendungsmoeglichkeit }}
<p class="method__label">Verwendungsmöglichkeit</p>
<p>{{ . }}</p>
{{ end }}
<dl class="method__meta-inline">
{{ with $methode.Params.zielgruppe }}<div><dt>Zielgruppe</dt><dd>{{ delimit . ", " }}</dd></div>{{ end }}
{{ with $methode.Params.kompetenzbereich }}<div><dt>Kompetenzbereich</dt><dd>{{ delimit . ", " }}</dd></div>{{ end }}
{{ with $methode.Params.kategorie }}<div><dt>Kategorie</dt><dd>{{ delimit . ", " }}</dd></div>{{ end }}
{{ with $methode.Params.kennung }}<div><dt>ID</dt><dd>{{ . }}</dd></div>{{ end }}
</dl>
{{ with $methode.Params.lernchancen }}
<p class="method__label">Lernchancen</p>
<ul>{{ range . }}<li>{{ . }}</li>{{ end }}</ul>
{{ end }}
{{ with $methode.Params.herkunft }}
<p class="method__label">Herkunft</p>
<ul>{{ range . }}<li>{{ . }}</li>{{ end }}</ul>
{{ end }}
{{ with $methode.Params.initiatoren }}
<p class="method__label">Initiator:innen</p>
<ul>{{ range . }}<li>{{ . }}</li>{{ end }}</ul>
{{ end }}
{{ with $methode.Params.tags }}
<ul class="method__tags">
{{ range . }}<li><a href="{{ (printf "/tags/%s/" (. | urlize)) | relURL }}">{{ . }}</a></li>{{ end }}
</ul>
{{ end }}
{{ if .zeigeLink }}
<p class="method__updated"><a href="{{ $methode.RelPermalink }}">Zur Methode „{{ $methode.Params.titel | default $methode.Title }}“ →</a></p>
{{ end }}
</div>
+25
View File
@@ -0,0 +1,25 @@
{{/* Comparison card for a variant - used both in the multi-variant list on
the method page and in the "Andere Varianten dieser Methode" (other
variants of this method) section on the variant page itself (see
hugo/layouts/_default/single.html and
hugo/layouts/varianten/single.html). Deliberately shows only the
fields meant for comparison - variant description, duration, group
size, authors, license, date - no material and no attachments (see
the project website (background/analysis notes) Teil 2.2), no highlighting of differing
values. Called with the respective variant as context. */}}
{{ $variante := . }}
<article class="variant-card">
<h3><a href="{{ $variante.RelPermalink }}">{{ $variante.Params.untertitel }}</a></h3>
{{ with $variante.Params.varianten_beschreibung }}<p class="variant-card__desc">{{ . }}</p>{{ end }}
<dl class="variant-card__meta">
{{ if isset $variante.Params "dauer_minuten" }}<div><dt>Dauer</dt><dd>{{ $variante.Params.dauer_minuten }} Min.</dd></div>{{ end }}
{{ if or (isset $variante.Params "gruppengroesse_min") (isset $variante.Params "gruppengroesse_max") }}
<div><dt>Gruppengröße</dt><dd>{{ if eq $variante.Params.gruppengroesse_min $variante.Params.gruppengroesse_max }}{{ $variante.Params.gruppengroesse_min }}{{ else }}{{ $variante.Params.gruppengroesse_min }}–{{ $variante.Params.gruppengroesse_max }}{{ end }}</dd></div>
{{ end }}
{{ with $variante.Params.lizenz }}<div><dt>Lizenz</dt><dd>{{ . }}</dd></div>{{ end }}
</dl>
{{ with $variante.Params.autoren }}<p class="variant-card__autoren">Autor:innen: {{ delimit . ", " }}</p>{{ end }}
{{ with index hugo.Data.varianten $variante.File.ContentBaseName }}
<p class="method__updated">Zuletzt geändert: {{ .geaendert | time.AsTime | dateFormat "02.01.2006" }}</p>
{{ end }}
</article>
@@ -0,0 +1,10 @@
{{/* Returns all variant pages (section "varianten") belonging to the given
method page, matched via Params.kennung, not title/slug (see
admin/config.template.yml and the Manifest chapter on the project website) - the reverse
direction of partials/methode-fuer-variante.html. Called with the
respective method as context. Unsorted and unfiltered - callers apply
their own sort/exclusion on top (see hugo/layouts/_default/single.html,
hugo/layouts/varianten/single.html, partials/variantenspanne.html,
hugo/layouts/_default/single.md). */}}
{{ $varianten := where (where site.RegularPages "Section" "varianten") "Params.methode" .Params.kennung }}
{{ return $varianten }}
@@ -0,0 +1,37 @@
{{/* Computes the duration/group-size range and the set of licenses present
for a method from its variants. Called with the respective method
page as context, returns a dict with dauerMin/dauerMax/dauerSeen,
groesseMin/groesseMax/groesseSeen ("Seen" distinguishes "no value
present" from "value is 0") and lizenzen (sorted, unique list). Used
by the method page, the cards on the homepage, and the filters there,
so the same logic doesn't exist multiple times. Material deliberately
NOT here: no aggregation planned on the method page, see
admin/config.template.yml. */}}
{{ $methode := . }}
{{ $varianten := partial "varianten-fuer-methode.html" $methode }}
{{ $dauerMin := 0 }}{{ $dauerMax := 0 }}{{ $dauerSeen := false }}
{{ $groesseMin := 0 }}{{ $groesseMax := 0 }}{{ $groesseSeen := false }}
{{ $lizenzen := slice }}
{{ range $varianten }}
{{ if isset .Params "dauer_minuten" }}
{{ $dauer := .Params.dauer_minuten }}
{{ if $dauerSeen }}
{{ if lt $dauer $dauerMin }}{{ $dauerMin = $dauer }}{{ end }}
{{ if gt $dauer $dauerMax }}{{ $dauerMax = $dauer }}{{ end }}
{{ else }}
{{ $dauerMin = $dauer }}{{ $dauerMax = $dauer }}{{ $dauerSeen = true }}
{{ end }}
{{ end }}
{{ if isset .Params "gruppengroesse_min" }}
{{ $gmin := .Params.gruppengroesse_min }}
{{ if $groesseSeen }}{{ if lt $gmin $groesseMin }}{{ $groesseMin = $gmin }}{{ end }}{{ else }}{{ $groesseMin = $gmin }}{{ $groesseSeen = true }}{{ end }}
{{ end }}
{{ if isset .Params "gruppengroesse_max" }}
{{ if gt .Params.gruppengroesse_max $groesseMax }}{{ $groesseMax = .Params.gruppengroesse_max }}{{ end }}
{{ end }}
{{ with .Params.lizenz }}{{ $lizenzen = $lizenzen | append . }}{{ end }}
{{ end }}
{{ $lizenzen = $lizenzen | uniq | sort }}
{{ return dict "dauerMin" $dauerMin "dauerMax" $dauerMax "dauerSeen" $dauerSeen "groesseMin" $groesseMin "groesseMax" $groesseMax "groesseSeen" $groesseSeen "lizenzen" $lizenzen }}
+66
View File
@@ -0,0 +1,66 @@
{{ define "main" }}
{{/* A dedicated, deliberately simple full-text search via Pagefind instead
of trying to merge it here with the homepage's facet search
(index.html, filter.js) into one component: Pagefind only knows
pages/URLs, not the method-vs-variant relationship, so mixing it with
the card facets there would be a lot of glue code for little benefit.
Robustness over feature scope: Pagefind's own bundled default widget
(PagefindUI) instead of custom rendering of the results - see
https://pagefind.app/docs/ui/. The index itself is only created AFTER
the Hugo build (command-line step "pagefind --site public", see
the installation guide on the project website) - under "hugo server" there is no index yet,
see the note below in the script. */}}
<section class="search-page" data-pagefind-ignore="all">
<h1>{{ .Title }}</h1>
<p class="search-page__hint">
Durchsucht alle veröffentlichten Methoden und Varianten vollständig –
auch Vorbereitung, Ablauf und Hintergründe, nicht nur Titel und Tags.
Für eine schnelle Filterung nach Zielgruppe, Kompetenzbereich, Kategorie,
Dauer oder Gruppengröße: <a href="{{ "/" | relURL }}">Startseite mit Filtern</a>.
</p>
<div id="pagefind-suche"></div>
</section>
<link href="{{ "pagefind/pagefind-ui.css" | relURL }}" rel="stylesheet">
<script src="{{ "pagefind/pagefind-ui.js" | relURL }}" defer></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
// "pagefind-ui.js" only exists after the separate indexing step
// following the Hugo build (see comment above) - deliberately stay
// silent here without an index instead of showing an error, e.g. under
// "hugo server".
if (typeof PagefindUI === "undefined") return;
var ui = new PagefindUI({
element: "#pagefind-suche",
showSubResults: true,
autofocus: true,
// German translation given explicitly instead of relying on
// Pagefind's automatic language detection via <html lang>: more
// robust against differing locale spellings (here "de-DE" instead
// of "de"), see hugo/layouts/_default/baseof.html. Wording taken
// 1:1 from Pagefind's own de.json.
translations: {
placeholder: "Suchen",
clear_search: "Löschen",
load_more: "Weitere Ergebnisse laden",
search_label: "Diese Seite durchsuchen",
filters_label: "Filter",
zero_results: "Keine Ergebnisse für [SEARCH_TERM]",
many_results: "[COUNT] Ergebnisse für [SEARCH_TERM]",
one_result: "Ein Ergebnis für [SEARCH_TERM]",
alt_search: "Keine Ergebnisse für [SEARCH_TERM]. Stattdessen erscheinen Ergebnisse für [DIFFERENT_TERM].",
search_suggestion: "Keine Ergebnisse für [SEARCH_TERM]. Probier einen der folgenden Vorschläge:",
searching: "[SEARCH_TERM] wird gesucht …"
}
});
// Takes ?q=... from the URL (from the search field in the header, see
// baseof.html - whose form now submits here instead of to the
// homepage) as a pre-filled search, the documented way via the
// PagefindUI instance method, see https://pagefind.app/docs/ui/.
var q = new URLSearchParams(window.location.search).get("q");
if (q) ui.triggerSearch(q);
});
</script>
{{ end }}
+10
View File
@@ -0,0 +1,10 @@
{{ define "main" }}
{{/* Deliberately empty: variants are detail pages per method and are only
linked from there (see hugo/layouts/_default/single.html), not via
their own overview page. A dedicated template instead of a
content/varianten/_index.md with "build.render: never", so that no
file sits in the content repo that Decap CMS would incorrectly list
as a (broken) entry in the variants collection - the same class of
bug as a README.md in the collection folder, see the concept chapter on the project website
Abschnitt 9. */}}
{{ end }}
+42
View File
@@ -0,0 +1,42 @@
{{ define "main" }}
{{/* Linked via Params.kennung, not via Params.titel or the folder
name/slug, see hugo/layouts/_default/single.html and
admin/config.template.yml. The steckbrief box and "Diese Variante" are
the same partials as on the method page (case: exactly one variant) -
see the project website (background/analysis notes) Teil 2.3. */}}
{{ $variante := . }}
{{ $methode := partial "methode-fuer-variante.html" . }}
<article class="method variant">
<header class="method__header">
{{ with $methode }}<p class="variant__back"><a href="{{ .RelPermalink }}">← {{ .Params.titel | default .Title }}</a></p>{{ end }}
<h1>{{ with $methode }}{{ .Params.titel | default .Title }} – {{ end }}{{ $variante.Params.untertitel }}</h1>
{{ with index hugo.Data.varianten $.File.ContentBaseName }}
<p class="method__updated">Erstellt: {{ .erstellt | time.AsTime | dateFormat "02.01.2006" }}</p>
<p class="method__updated">Zuletzt geändert: {{ .geaendert | time.AsTime | dateFormat "02.01.2006" }}</p>
{{ end }}
</header>
{{ with $methode }}
{{ partial "steckbrief-box.html" (dict "methode" . "zeigeKurzbeschreibung" true "zeigeLink" true) }}
{{ end }}
{{ partial "diese-variante.html" $variante }}
<div class="method__body">
{{ $variante.Content }}
</div>
{{ partial "attachments.html" $variante }}
{{ with $methode }}
{{ $andere := where (partial "varianten-fuer-methode.html" .) "Params.kennung" "ne" $variante.Params.kennung }}
{{ with $andere }}
<section class="method__section">
<h2>Andere Varianten dieser Methode</h2>
<div class="variant-grid">
{{ range . }}{{ partial "variante-card.html" . }}{{ end }}
</div>
</section>
{{ end }}
{{ end }}
</article>
{{ end }}
+6
View File
@@ -0,0 +1,6 @@
{{/* Served under "<variant-url>index.md" (see [outputFormats.MethodenSetMd]
and the cascade rule in hugo/hugo.toml) - the assembly logic lives
together with _default/single.md (method with exactly one variant) in
partials/methoden-set-dokument.html. Called with the respective
variant as context (section "varianten"). */ -}}
{{- partial "methoden-set-dokument.html" . -}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

+517
View File
@@ -0,0 +1,517 @@
:root {
--color-bg: #fdfcfb;
--color-text: #1f2320;
--color-muted: #5b645d;
--color-accent: #3c8a98;
--color-accent-contrast: #fff;
--color-border: #dcd8d0;
--color-card-bg: #ffffff;
--radius: 8px;
--spacing: 1rem;
}
@media (prefers-color-scheme: dark) {
:root {
--color-bg: #16181a;
--color-text: #e9e9e6;
--color-muted: #a3aba5;
--color-accent: #6fc2d1;
--color-accent-contrast: #06272b;
--color-border: #33372f;
--color-card-bg: #1f2321;
}
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--color-bg);
color: var(--color-text);
line-height: 1.55;
}
a { color: var(--color-accent); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.site-header {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: var(--spacing);
padding: var(--spacing) 1.5rem;
border-bottom: 1px solid var(--color-border);
/* Explicit background instead of inheriting from body: on
admin/index.html, Decap's own, later-loading CSS-in-JS overrides
body's background color with its light-gray default - our text color
here (.site-title, our own class, untouched by Decap) still switches
correctly in dark mode though, which resulted in light text on a
light background. Found and verified live. */
background: var(--color-bg);
}
.site-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 700;
text-decoration: none;
color: var(--color-text);
}
.site-logo { display: block; }
.visually-hidden {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
/* --- Header: "Suchen" and "Stöbern" ---------------------------------
Both open on hover (only on pointer devices that support hover -
deliberately not on touch, see media query below), on keyboard focus
(:focus-within, e.g. Tab to the search field), or on click/tap (the
"is-open" class, toggled by the inline script in baseof.html - the
only way on touch devices without hover). The search additionally
stays open once it contains a value, even without hover/focus - also
driven via "is-open", see script. */
.site-header__actions { display: flex; gap: 1.5rem; align-items: flex-start; }
.header-search, .header-browse { position: relative; }
.header-toggle {
display: inline-block;
cursor: pointer;
padding: 0.5rem 0.25rem;
border: 0;
background: transparent;
color: var(--color-text);
font: inherit;
font-weight: 500;
font-size: 0.9rem;
user-select: none;
}
.header-toggle:hover, .header-toggle[aria-expanded="true"] { color: var(--color-accent); }
/* header-toggle was designed for the Suchen/Stöbern <button> elements,
which naturally have no underline - the methoden-set link is a real
<a> (standalone page, no panel to expand/collapse) and therefore needs
the reset explicitly, otherwise the browser underlines it like any
other link. */
.header-toggle--link { text-decoration: none; }
.header-search__form,
.header-browse__nav {
display: none;
position: absolute;
/* Attach directly to the button (top: 100%, no gap) instead of leaving
a gap: a gap would not be a hoverable area - moving the mouse down
from the button to the menu would briefly leave every hoverable
surface, closing the menu before the mouse arrives there (reported
live). The visual spacing to the links instead comes from the
"padding" below, which counts as part of the box's own hoverable
area. */
top: 100%;
right: 0;
z-index: 10;
background: var(--color-card-bg);
border: 1px solid var(--color-border);
border-radius: var(--radius);
padding: 0.5rem;
}
.header-search__form { width: max(18rem, 80vw); max-width: 22rem; }
.header-browse__nav { flex-direction: column; gap: 0.25rem; min-width: 12rem; }
@media (hover: hover) and (pointer: fine) {
.header-search:hover .header-search__form,
.header-search:focus-within .header-search__form,
.header-browse:hover .header-browse__nav,
.header-browse:focus-within .header-browse__nav {
display: flex;
}
}
.header-search.is-open .header-search__form,
.header-browse.is-open .header-browse__nav {
display: flex;
}
.header-search__form input[type="search"] {
width: 100%;
padding: 0.6rem 0.8rem;
border: 1px solid var(--color-border);
border-radius: var(--radius);
background: var(--color-bg);
color: var(--color-text);
font-size: 1rem;
}
.header-search__form input[type="search"]:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 1px; }
.header-browse__nav a {
padding: 0.5rem 0.75rem;
border-radius: calc(var(--radius) - 2px);
text-decoration: none;
font-weight: 500;
color: var(--color-text);
}
.header-browse__nav a:hover { background: var(--color-bg); color: var(--color-accent); }
/* At sufficient width, "Suchen" is no longer a collapsible bar but an
always-visible search bar directly in the header - the rules above
(hover/focus/is-open) are deliberately ignored here (!important beats
the lower specificity of the display:none default). "Stöbern" stays a
collapsible bar at every width. */
@media (min-width: 48rem) {
.header-search .header-toggle { display: none; }
.header-search__form {
display: flex !important;
position: static;
width: 16rem;
max-width: none;
background: none;
border: 0;
padding: 0;
}
}
.site-nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 500; }
.site-nav a:hover { text-decoration: underline; }
.site-main {
max-width: 72rem;
margin: 0 auto;
padding: 2rem 1.5rem 4rem;
}
/* --- Footer: three columns, stack on narrow screens ----------------- */
.site-footer {
padding: 2.5rem 1.5rem;
color: var(--color-muted);
font-size: 0.875rem;
border-top: 1px solid var(--color-border);
}
.site-footer__grid {
display: grid;
grid-template-columns: 1fr;
gap: 2rem;
max-width: 72rem;
margin: 0 auto;
}
@media (min-width: 40rem) {
.site-footer__grid { grid-template-columns: repeat(3, 1fr); }
}
.site-footer__heading {
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.03em;
color: var(--color-muted);
margin: 0 0 0.6rem;
}
.site-footer__col p { margin: 0 0 0.75rem; }
.site-footer__links {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 0.4rem;
}
.site-footer__links a { color: var(--color-muted); }
.site-footer__links a:hover { color: var(--color-accent); }
.site-footer__placeholder {
color: var(--color-muted);
opacity: 0.6;
cursor: default;
border-bottom: 1px dashed var(--color-border);
}
.filter-list {
list-style: none;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
padding: 0;
margin: 0.5rem 0 1.5rem;
}
.filter-list li a {
display: inline-block;
padding: 0.35rem 0.75rem;
border: 1px solid var(--color-border);
border-radius: 999px;
text-decoration: none;
font-size: 0.875rem;
}
.filter-list li a:hover { border-color: var(--color-accent); }
/* --- Filter -----------------------------------------------------------
The search itself has lived in the <header> (baseof.html,
.header-search) since the header rework, instead of here on the
homepage. */
.toolbar {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 1rem;
flex-wrap: wrap;
margin: 2rem 0;
}
.toolbar #result-count { padding-top: 0.7rem; }
.filter-panel {
border: 1px solid var(--color-border);
border-radius: var(--radius);
background: var(--color-card-bg);
margin-bottom: 1rem;
flex: 0 0 auto;
}
/* Opens at full width (matching the width of the method cards below)
instead of only as wide as the "Filter" button - result-count wraps
onto its own line on its own thanks to flex-wrap on .toolbar. */
.filter-panel[open] { flex: 1 1 100%; }
.filter-panel summary {
cursor: pointer;
padding: 0.75rem 1rem;
font-weight: 600;
}
.filter-panel[open] summary { border-bottom: 1px solid var(--color-border); }
.filter-panel__body {
padding: 1.25rem;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
gap: 1.5rem;
}
.filter-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.filter-group legend, .filter-range__label { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.5rem; padding: 0; }
.filter-checkbox {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.9rem;
padding: 0.2rem 0;
cursor: pointer;
}
.filter-count { color: var(--color-muted); font-size: 0.8rem; }
.filter-range__slider {
position: relative;
height: 2rem;
margin-top: 0.5rem;
}
.filter-range__track, .filter-range__fill {
position: absolute;
top: 50%;
height: 4px;
transform: translateY(-50%);
border-radius: 2px;
}
.filter-range__track { left: 0; right: 0; background: var(--color-border); }
.filter-range__fill { background: var(--color-accent); }
.filter-range__slider input[type="range"] {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2rem;
margin: 0;
background: transparent;
pointer-events: none;
-webkit-appearance: none;
appearance: none;
}
.filter-range__slider input[type="range"]::-webkit-slider-runnable-track { background: transparent; }
.filter-range__slider input[type="range"]::-moz-range-track { background: transparent; }
.filter-range__slider input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
pointer-events: auto;
width: 18px;
height: 18px;
border-radius: 50%;
background: var(--color-accent);
border: 2px solid var(--color-card-bg);
box-shadow: 0 0 0 1px var(--color-border);
cursor: pointer;
margin-top: 6px;
}
.filter-range__slider input[type="range"]::-moz-range-thumb {
pointer-events: auto;
width: 18px;
height: 18px;
border-radius: 50%;
background: var(--color-accent);
border: 2px solid var(--color-card-bg);
box-shadow: 0 0 0 1px var(--color-border);
cursor: pointer;
}
#filter-reset {
grid-column: 1 / -1;
justify-self: start;
padding: 0.5rem 1rem;
border: 1px solid var(--color-border);
border-radius: var(--radius);
background: transparent;
color: var(--color-text);
cursor: pointer;
font-size: 0.875rem;
}
#filter-reset:hover { border-color: var(--color-accent); }
#result-count { color: var(--color-muted); font-size: 0.875rem; margin: 0; }
#no-results { color: var(--color-muted); padding: 2rem 0; }
.search-more-link { font-size: 0.875rem; padding-top: 0.7rem; }
/* --- Full-text search (/suche/, layouts/suche/list.html) ---------------
PagefindUI brings its own CSS (pagefind-ui.css) and reads its colors
via these custom properties - see
https://pagefind.app/docs/ui/#styling-the-ui - instead of writing
custom CSS against the result list generated by Pagefind. */
.search-page { max-width: 40rem; margin: 2rem auto 0; }
.search-page__hint { color: var(--color-muted); margin-bottom: 1.5rem; }
#pagefind-suche {
--pagefind-ui-primary: var(--color-accent);
--pagefind-ui-text: var(--color-text);
--pagefind-ui-background: var(--color-bg);
--pagefind-ui-border: var(--color-border);
--pagefind-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.method-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
gap: 1.25rem;
margin-top: 1rem;
}
.method-card {
background: var(--color-card-bg);
border: 1px solid var(--color-border);
border-radius: var(--radius);
padding: 1.25rem;
}
.method-card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.method-card h3 a { text-decoration: none; }
.method-card h3 a:hover { text-decoration: underline; }
.method-card__desc { color: var(--color-muted); font-size: 0.9rem; margin: 0 0 0.75rem; }
.method-card__meta { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin: 0 0 0.75rem; font-size: 0.825rem; }
.method-card__meta div { display: flex; gap: 0.35rem; }
.method-card__meta dt { color: var(--color-muted); margin: 0; }
.method-card__meta dd { margin: 0; font-weight: 500; }
.method-card__group { margin-top: 0.6rem; }
.method-card__label {
color: var(--color-muted);
font-size: 0.75rem;
margin: 0;
}
.method-card__tags {
list-style: none;
display: flex;
flex-wrap: wrap;
gap: 0.35rem;
padding: 0;
margin: 0.3rem 0 0;
}
.facet-chip {
font: inherit;
font-size: 0.75rem;
background: var(--color-border);
color: var(--color-text);
border: 0;
border-radius: 999px;
padding: 0.15rem 0.6rem;
cursor: pointer;
}
.facet-chip:hover { filter: brightness(0.92); }
.method-card__tags--kompetenz .facet-chip { background: var(--color-accent); color: var(--color-accent-contrast); }
.method-card__tags--kategorie .facet-chip { background: transparent; border: 1px solid var(--color-border); }
.method__header { margin-bottom: 1.5rem; }
.method__lead { color: var(--color-muted); font-size: 1.05rem; }
.method__updated { font-size: 0.8rem; color: var(--color-muted); }
.method__section { margin: 1.75rem 0; }
.method__section h2 { font-size: 1.1rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.25rem; }
.method__meta dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.75rem 1.5rem; }
.method__meta dt { color: var(--color-muted); font-size: 0.8rem; margin: 0; }
.method__meta dd { margin: 0; font-weight: 500; }
.method__body { margin: 2rem 0; }
.method__body h1 { font-size: 1.3rem; }
.method__body h2 { font-size: 1.1rem; }
.method__tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; }
.method__tags li a {
display: inline-block;
font-size: 0.8rem;
background: var(--color-border);
border-radius: 999px;
padding: 0.2rem 0.7rem;
text-decoration: none;
color: var(--color-text);
}
.method__label { color: var(--color-muted); font-size: 0.8rem; margin: 1rem 0 0.25rem; }
.method__meta-inline { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin: 0.75rem 0; }
.method__meta-inline div { display: flex; gap: 0.35rem; font-size: 0.9rem; }
.method__meta-inline dt { color: var(--color-muted); margin: 0; }
.method__meta-inline dd { margin: 0; font-weight: 500; }
/* "About the method" - a visually distinct block on the variant page, so
it stays clear what comes from the method and what belongs to the
variant itself (see the project website (background/analysis notes) Teil 2.3). */
.method__section--methode {
background: var(--color-card-bg);
border: 1px solid var(--color-border);
border-radius: var(--radius);
padding: 1.25rem 1.5rem;
}
.variant__back { font-size: 0.875rem; margin: 0 0 0.5rem; }
.variant__back a { color: var(--color-muted); text-decoration: none; }
.variant__back a:hover { text-decoration: underline; }
.variant-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
gap: 1.25rem;
margin-top: 1rem;
}
.variant-card {
background: var(--color-card-bg);
border: 1px solid var(--color-border);
border-radius: var(--radius);
padding: 1.25rem;
}
.variant-card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.variant-card h3 a { text-decoration: none; }
.variant-card h3 a:hover { text-decoration: underline; }
.variant-card__desc { color: var(--color-muted); font-size: 0.9rem; margin: 0 0 0.75rem; }
.variant-card__autoren { font-size: 0.85rem; margin: 0.5rem 0 0; }
.variant-card__meta { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin: 0 0 0.5rem; font-size: 0.825rem; }
.variant-card__meta div { display: flex; gap: 0.35rem; }
.variant-card__meta dt { color: var(--color-muted); margin: 0; }
.variant-card__meta dd { margin: 0; font-weight: 500; }
Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

+11
View File
@@ -0,0 +1,11 @@
<svg width="32" height="32" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Ableger">
<style>
path { fill: #1f504a; stroke: #1f504a; }
@media (prefers-color-scheme: dark) {
path { fill: #6fc9bd; stroke: #6fc9bd; }
}
</style>
<g transform="matrix(0.108231,0,0,0.108231,5.88452,7.40178)">
<path d="M476.581,897.288C471.876,892.583 472.935,897.826 471.752,802.641C470.881,732.626 470.647,676.385 469.299,661.783C456.112,518.95 392.326,426.644 292.656,406.16C273.275,402.176 247.201,401.016 247.44,404.147C247.812,409.029 269.225,439.924 279.884,450.957C305.357,477.327 328.637,487.571 363.745,487.86C382.443,488.014 382.443,488.014 390.921,499.937C395.583,506.494 398.573,512.591 397.564,513.485C389.061,521.02 347.21,523.041 324.551,517.011C280.051,505.17 244.563,471.758 216.916,415.674C202.628,386.691 201.446,380.615 208.687,373.375C213.031,369.03 216.707,368.551 245.492,368.58C310.457,368.643 361.736,387.469 405.952,427.486C442.724,460.767 476.309,523.964 491.347,588.173C503.043,638.112 504.796,636.454 504.88,786.757C504.942,896.233 505.913,892.089 500.912,897.091C494.512,903.491 482.878,903.585 476.581,897.288L476.581,897.288ZM494.977,522.071C484.075,490.832 482.34,475.515 486.095,443.677C501.157,315.959 558.365,220.986 644.094,181.377C678.021,165.702 728.466,157.191 769.191,160.271C797.977,162.448 801.625,169.861 788.118,198.725C755.903,267.567 700.57,310.625 644.316,310.625C630.288,310.625 602.763,305.02 599.166,301.432C598.227,300.494 601.585,294.339 606.628,287.752C615.799,275.777 615.799,275.777 642.174,275.703C667.171,275.63 669.414,275.205 685.06,267.503C704.655,257.856 727.381,236.527 741.729,214.316C756.122,192.036 755.883,191.593 730.597,193.651C638.193,201.172 571.599,258.906 538.599,360.101C525.333,400.779 519.373,431.371 515.088,480.774C512.721,508.058 506.928,546.826 504.987,548.37C504.629,548.655 500.124,536.821 494.977,522.071ZM521.756,270.404C522.881,265.57 524.288,260.283 526.01,254.509C543.966,194.319 618.428,72.847 625.54,70.773C636.909,67.457 647.233,75.36 646.429,86.764C646.171,90.419 613.517,136.837 584.212,196.334C559.921,215.848 538.944,240.801 521.756,270.404Z" style="fill-rule:nonzero;stroke-width:14;stroke-linejoin:round;stroke-linecap:round;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File
+11
View File
@@ -0,0 +1,11 @@
<svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Ableger">
<style>
path { fill: #1f504a; }
@media (prefers-color-scheme: dark) {
path { fill: #6fc9bd; }
}
</style>
<g transform="matrix(0.108231,0,0,0.108231,5.88452,7.40178)">
<path d="M476.581,897.288C471.876,892.583 472.935,897.826 471.752,802.641C470.881,732.626 470.647,676.385 469.299,661.783C456.112,518.95 392.326,426.644 292.656,406.16C273.275,402.176 247.201,401.016 247.44,404.147C247.812,409.029 269.225,439.924 279.884,450.957C305.357,477.327 328.637,487.571 363.745,487.86C382.443,488.014 382.443,488.014 390.921,499.937C395.583,506.494 398.573,512.591 397.564,513.485C389.061,521.02 347.21,523.041 324.551,517.011C280.051,505.17 244.563,471.758 216.916,415.674C202.628,386.691 201.446,380.615 208.687,373.375C213.031,369.03 216.707,368.551 245.492,368.58C310.457,368.643 361.736,387.469 405.952,427.486C442.724,460.767 476.309,523.964 491.347,588.173C503.043,638.112 504.796,636.454 504.88,786.757C504.942,896.233 505.913,892.089 500.912,897.091C494.512,903.491 482.878,903.585 476.581,897.288L476.581,897.288ZM494.977,522.071C484.075,490.832 482.34,475.515 486.095,443.677C501.157,315.959 558.365,220.986 644.094,181.377C678.021,165.702 728.466,157.191 769.191,160.271C797.977,162.448 801.625,169.861 788.118,198.725C755.903,267.567 700.57,310.625 644.316,310.625C630.288,310.625 602.763,305.02 599.166,301.432C598.227,300.494 601.585,294.339 606.628,287.752C615.799,275.777 615.799,275.777 642.174,275.703C667.171,275.63 669.414,275.205 685.06,267.503C704.655,257.856 727.381,236.527 741.729,214.316C756.122,192.036 755.883,191.593 730.597,193.651C638.193,201.172 571.599,258.906 538.599,360.101C525.333,400.779 519.373,431.371 515.088,480.774C512.721,508.058 506.928,546.826 504.987,548.37C504.629,548.655 500.124,536.821 494.977,522.071ZM521.756,270.404C522.881,265.57 524.288,260.283 526.01,254.509C543.966,194.319 618.428,72.847 625.54,70.773C636.909,67.457 647.233,75.36 646.429,86.764C646.171,90.419 613.517,136.837 584.212,196.334C559.921,215.848 538.944,240.801 521.756,270.404Z" style="fill-rule:nonzero;"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+303
View File
@@ -0,0 +1,303 @@
(function () {
"use strict";
var grid = document.getElementById("method-grid");
if (!grid) return; // Not on the homepage
var cards = Array.prototype.slice.call(grid.querySelectorAll(".method-card"));
// Search field has lived in the <header> (baseof.html) since the header
// rework, no longer on the homepage itself - the same field on every
// page, wired up here additionally for live filtering only on the
// homepage.
var searchInput = document.getElementById("header-search-input");
var searchForm = searchInput ? searchInput.closest("form") : null;
var resultCount = document.getElementById("result-count");
var searchMoreLink = document.getElementById("search-more-link");
var searchMoreBaseHref = searchMoreLink ? searchMoreLink.getAttribute("href") : "";
var noResults = document.getElementById("no-results");
var resetButton = document.getElementById("filter-reset");
var filterPanel = document.getElementById("filter-panel");
var checkboxes = Array.prototype.slice.call(document.querySelectorAll("[data-facet]"));
var rangeGroups = Array.prototype.slice.call(document.querySelectorAll("[data-range-facet]"));
function checkboxesFor(facet) {
return checkboxes.filter(function (el) {
return el.dataset.facet === facet && el.type === "checkbox";
});
}
function selectedValues(facet) {
return checkboxesFor(facet)
.filter(function (el) { return el.checked; })
.map(function (el) { return el.value.toLowerCase(); });
}
function cardValues(card, key) {
var raw = card.dataset[key] || "";
if (!raw) return [];
return raw.split("|").map(function (v) { return v.toLowerCase(); });
}
// --- Dual range slider -----------------------------------------------
function rangeState(group) {
var minInput = group.querySelector("[data-range-min]");
var maxInput = group.querySelector("[data-range-max]");
return {
group: group,
minInput: minInput,
maxInput: maxInput,
bounds: [parseFloat(group.dataset.min), parseFloat(group.dataset.max)],
};
}
function updateRangeVisuals(state) {
var min = parseFloat(state.minInput.value);
var max = parseFloat(state.maxInput.value);
var lo = state.bounds[0];
var hi = state.bounds[1];
var span = hi - lo || 1;
var outMin = state.group.querySelector("[data-range-output-min]");
var outMax = state.group.querySelector("[data-range-output-max]");
if (outMin) outMin.textContent = min;
if (outMax) outMax.textContent = max;
var fill = state.group.querySelector("[data-range-fill]");
if (fill) {
var left = ((min - lo) / span) * 100;
var right = ((max - lo) / span) * 100;
fill.style.left = left + "%";
fill.style.width = Math.max(0, right - left) + "%";
}
}
var rangeStates = rangeGroups.map(function (group) {
var state = rangeState(group);
function onMinInput() {
if (parseFloat(state.minInput.value) > parseFloat(state.maxInput.value)) {
state.minInput.value = state.maxInput.value;
}
updateRangeVisuals(state);
applyFilters();
syncUrl();
}
function onMaxInput() {
if (parseFloat(state.maxInput.value) < parseFloat(state.minInput.value)) {
state.maxInput.value = state.minInput.value;
}
updateRangeVisuals(state);
applyFilters();
syncUrl();
}
state.minInput.addEventListener("input", onMinInput);
state.maxInput.addEventListener("input", onMaxInput);
updateRangeVisuals(state);
return state;
});
function rangeIsNarrowed(state) {
return (
parseFloat(state.minInput.value) > state.bounds[0] ||
parseFloat(state.maxInput.value) < state.bounds[1]
);
}
// --- Filtering ----------------------------------------------------------
function matchesFacets(card) {
// "lizenz" is multi-valued here just like the other facets since
// variants were introduced (a method can have several licenses via
// its variants) - the same cardValues logic is enough, no special
// handling needed anymore.
var groups = { zielgruppe: 1, kompetenzbereich: 1, kategorie: 1, lizenz: 1 };
for (var facet in groups) {
var selected = selectedValues(facet);
if (selected.length === 0) continue;
var values = cardValues(card, facet);
var hasMatch = values.some(function (v) { return selected.indexOf(v) !== -1; });
if (!hasMatch) return false;
}
return true;
}
function matchesRanges(card) {
for (var i = 0; i < rangeStates.length; i++) {
var state = rangeStates[i];
if (!rangeIsNarrowed(state)) continue;
var facet = state.group.dataset.rangeFacet;
var fMin = parseFloat(state.minInput.value);
var fMax = parseFloat(state.maxInput.value);
if (facet === "dauer") {
// Duration has been a range per method since variants were
// introduced (shortest to longest variant), no longer a single
// value - same overlap logic as "groesse" below.
var dMinRaw = card.dataset.dauerMin;
var dMaxRaw = card.dataset.dauerMax;
if (dMinRaw === "" || dMaxRaw === "") return false;
var dMin = parseFloat(dMinRaw);
var dMax = parseFloat(dMaxRaw);
if (dMax < fMin || dMin > fMax) return false;
} else if (facet === "groesse") {
var gMinRaw = card.dataset.gruppengroesseMin;
var gMaxRaw = card.dataset.gruppengroesseMax;
if (gMinRaw === "" || gMaxRaw === "") return false;
var gMin = parseFloat(gMinRaw);
var gMax = parseFloat(gMaxRaw);
// Overlap of the two intervals
if (gMax < fMin || gMin > fMax) return false;
}
}
return true;
}
function matchesSearch(card) {
var q = searchInput.value.trim().toLowerCase();
if (!q) return true;
return (card.dataset.search || "").indexOf(q) !== -1;
}
function applyFilters() {
var visible = 0;
cards.forEach(function (card) {
var match = matchesSearch(card) && matchesFacets(card) && matchesRanges(card);
card.hidden = !match;
if (match) visible++;
});
if (resultCount) {
resultCount.textContent = visible + " von " + cards.length + " Methoden";
}
if (noResults) {
noResults.hidden = visible !== 0;
}
if (searchMoreLink) {
var q = searchInput.value.trim();
searchMoreLink.href = q ? searchMoreBaseHref + "?q=" + encodeURIComponent(q) : searchMoreBaseHref;
}
}
// --- Clickable chips on the cards ---------------------------------------
grid.addEventListener("click", function (event) {
var chip = event.target.closest(".facet-chip");
if (!chip) return;
var facet = chip.dataset.facet;
var value = chip.dataset.value;
if (facet === "search") {
searchInput.value = value;
applyFilters();
syncUrl();
searchInput.focus();
} else {
var box = checkboxesFor(facet).filter(function (el) {
return el.value.toLowerCase() === value.toLowerCase();
})[0];
if (box) {
box.checked = true;
if (filterPanel) filterPanel.open = true;
applyFilters();
syncUrl();
}
}
document.getElementById("ergebnisse").scrollIntoView({ behavior: "smooth", block: "start" });
});
// --- Reset ---------------------------------------------------------------
if (resetButton) {
resetButton.addEventListener("click", function () {
searchInput.value = "";
checkboxes.forEach(function (el) { el.checked = false; });
rangeStates.forEach(function (state) {
state.minInput.value = state.bounds[0];
state.maxInput.value = state.bounds[1];
updateRangeVisuals(state);
});
applyFilters();
syncUrl();
});
}
// --- URL sync (shareable filtered views) ----------------------------
function syncUrl() {
var params = new URLSearchParams();
var q = searchInput.value.trim();
if (q) params.set("q", q);
["zielgruppe", "kompetenzbereich", "kategorie", "lizenz"].forEach(function (facet) {
var values = selectedValues(facet);
if (values.length) params.set(facet, values.join(","));
});
rangeStates.forEach(function (state) {
if (!rangeIsNarrowed(state)) return;
var facet = state.group.dataset.rangeFacet;
params.set(facet + "_min", state.minInput.value);
params.set(facet + "_max", state.maxInput.value);
});
var query = params.toString();
var url = window.location.pathname + (query ? "?" + query : "");
window.history.replaceState(null, "", url);
}
function restoreFromUrl() {
var params = new URLSearchParams(window.location.search);
var q = params.get("q");
if (q) searchInput.value = q;
["zielgruppe", "kompetenzbereich", "kategorie", "lizenz"].forEach(function (facet) {
var raw = params.get(facet);
if (!raw) return;
var wanted = raw.split(",").map(function (v) { return v.toLowerCase(); });
checkboxesFor(facet).forEach(function (el) {
if (wanted.indexOf(el.value.toLowerCase()) !== -1) el.checked = true;
});
});
var anyFacetChecked = checkboxes.some(function (el) { return el.checked; });
rangeStates.forEach(function (state) {
var facet = state.group.dataset.rangeFacet;
var min = params.get(facet + "_min");
var max = params.get(facet + "_max");
if (min !== null) state.minInput.value = min;
if (max !== null) state.maxInput.value = max;
if (min !== null || max !== null) anyFacetChecked = true;
updateRangeVisuals(state);
});
if ((q || anyFacetChecked) && filterPanel) filterPanel.open = true;
}
// --- Wire up ----------------------------------------------------------
searchInput.addEventListener("input", function () {
applyFilters();
syncUrl();
});
// Without JavaScript, the search form navigates completely normally to
// /?q=... (a real <form method="get">, see baseof.html) - on the
// already-loaded homepage itself, the "input" event above filters live
// instead; an additional full reload on Enter would only be disruptive.
if (searchForm) {
searchForm.addEventListener("submit", function (event) {
event.preventDefault();
});
}
checkboxes.forEach(function (el) {
el.addEventListener("change", function () {
applyFilters();
syncUrl();
});
});
restoreFromUrl();
applyFilters();
})();
+48
View File
@@ -0,0 +1,48 @@
# install.env
# Installation-specific values for the git server, domains, and deploy
# paths - the single source for scripts/generate-config.sh,
# scripts/sync-methoden.sh, and scripts/admin-status-server.rb. Adjust
# here on a fork instead of at the individual usage sites. Branding/text
# variables (provider, color, imprint/privacy links) live in
# hugo/hugo.toml [params] instead - those are plain Hugo values maintained
# directly there.
#
# Not a secret store: OAuth client secrets, cookie secrets etc. do NOT
# belong here, but in the server/deploy configuration (see the "Installation"
# chapter on the project website).
#
# EVERY value below is a placeholder - replace all of them with your own
# fork's values before deploying. See the project website's "Installation"
# chapter for the full step-by-step guide.
# Gitea/Forgejo instance that hosts your own fork of the methods repo
# (Decap CMS backend) and against which private mode also authenticates.
# GITEA_SSH_USER/-PORT are only needed as a fallback for local development
# (see scripts/sync-methoden.sh) - in the deploy hook, the source is
# instead explicitly overridden via ABLEGER_METHODEN_URL.
GITEA_DOMAIN="git.example.org"
GITEA_SSH_USER="dein-benutzername"
GITEA_SSH_PORT="22"
# Org/name of your fork of the methods repo (content, separate repo) and
# of this website/CMS code repo.
METHODEN_REPO="deine-org/ableger_methoden"
WEBSITE_REPO="deine-org/ableger"
# OAuth2 application that registers Decap CMS against your own Gitea
# instance above (public client/PKCE, no secret - see the "Installation"
# chapter on the project website for how to register one).
OAUTH_CLIENT_ID="deine-oauth-client-id"
# Domain your Hugo website runs live under. Must match baseURL in
# hugo/hugo.toml (maintained separately there - Hugo's own configuration
# file can't read this file itself).
WEBSITE_DOMAIN="ableger.example.org"
# Docroot on your deploy server that hugo/public/ and admin/ are copied
# into.
DEPLOY_DOCROOT="/pfad/zu/deinem/docroot"
# Port the admin status server (scripts/admin-status-server.rb) listens
# on.
STATUS_SERVER_PORT="4182"
+607
View File
@@ -0,0 +1,607 @@
/* Methoden-Set: collect variant links, sort them, and download as
zip/markdown/Word. Merge/sort/page-break/outline logic modeled on the
"Mappe erstellen" tab from tobias_ebh/pandoc_ebh_paket (same author, same
basic idea: order several markdown pieces via drag & drop, page-break
toggle per transition, outline preview) - rewritten here for automatic
fetching from this website instead of manual file upload.
Details/rationale: the Methoden-Set chapter on the project website. */
(function () {
"use strict";
const linkForm = document.getElementById("link-form");
const linkInput = document.getElementById("link-input");
const itemList = document.getElementById("item-list");
const outline = document.getElementById("outline");
const titelInput = document.getElementById("titel-input");
const formatRadios = document.querySelectorAll('input[name="format"]');
const vorlageListe = document.getElementById("vorlage-liste");
const btnZip = document.getElementById("btn-zip");
const btnMd = document.getElementById("btn-md");
const btnDokument = document.getElementById("btn-dokument");
const status = document.getElementById("status");
function currentFormat() {
return document.querySelector('input[name="format"]:checked').value; // "docx" or "odt"
}
let items = []; // { id, url, titel, body, pageBreakBefore, pageBreakAfter, error }
let idCounter = 0;
function setStatus(msg, state) {
status.textContent = msg || "";
if (state) status.dataset.state = state; else delete status.dataset.state;
}
function el(tag, attrs, children) {
const node = document.createElement(tag);
for (const key in attrs || {}) {
if (key === "text") node.textContent = attrs[key];
else if (key === "html") node.innerHTML = attrs[key];
// setAttribute("className", ...) would create a no-op "classname"
// attribute instead of the real class property (DOM setAttribute
// doesn't know "className", only "class") - hence mapped
// specifically to the property instead of setAttribute.
else if (key === "className") node.className = attrs[key];
else if (attrs[key] !== undefined && attrs[key] !== false) node.setAttribute(key, attrs[key]);
}
for (const child of children || []) node.appendChild(child);
return node;
}
// --- Parse the frontmatter of the markdown response ---------------------
// Generated by hugo/layouts/partials/methoden-set-dokument.html (variant
// and method URLs return the same format) - fields are always written
// via Hugo's "jsonify" (valid JSON = valid YAML flow scalar) - so a
// simple regex + JSON.parse is enough, no custom YAML implementation
// needed. "fehler" only comes from method URLs with 0 or >1 variants
// (_default/single.md) - then without a usable body.
function parseFrontMatter(text) {
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/.exec(text);
if (!match) return null;
const [, header, body] = match;
const titelMatch = /^titel:\s*(".*")\s*$/m.exec(header);
const quelleMatch = /^quelle:\s*(".*")\s*$/m.exec(header);
const fehlerMatch = /^fehler:\s*(".*")\s*$/m.exec(header);
if (!titelMatch || !quelleMatch) return null;
try {
return {
titel: JSON.parse(titelMatch[1]),
quelle: JSON.parse(quelleMatch[1]),
fehler: fehlerMatch ? JSON.parse(fehlerMatch[1]) : null,
body: body.replace(/^\s+/, "")
};
} catch (e) {
return null;
}
}
const FEHLER_TEXT = {
mehrere_varianten: "Diese Methode hat mehrere Varianten. Bitte auf der Methoden-Seite die gewünschte Variante öffnen und deren eigenen Link einfügen.",
keine_variante: "Diese Methode hat noch keine veröffentlichte Variante."
};
// --- Add link --------------------------------------------------------
function normalizeMarkdownUrl(raw) {
let url;
try {
url = new URL(raw, window.location.href);
} catch (e) {
throw new Error("Das ist keine gültige Internetadresse.");
}
if (url.origin !== window.location.origin) {
throw new Error("Nur Links auf diese Ableger-Instanz werden akzeptiert.");
}
if (!url.pathname.endsWith("/")) url.pathname += "/";
url.pathname += "index.md";
url.search = "";
url.hash = "";
return url;
}
async function addLink(raw) {
const id = ++idCounter;
const item = { id, url: raw, titel: raw, body: "", pageBreakBefore: false, pageBreakAfter: false, error: "Wird geladen …" };
items.push(item);
render();
try {
const mdUrl = normalizeMarkdownUrl(raw);
const response = await fetch(mdUrl.toString());
if (!response.ok) {
throw new Error(
response.status === 404
? "Das ist kein Link auf eine Methode oder Variante dieser Website (Seite existiert nicht)."
: "Konnte nicht geladen werden (Status " + response.status + ")."
);
}
const text = await response.text();
const parsed = parseFrontMatter(text);
if (!parsed) throw new Error("Antwort hatte nicht das erwartete Format.");
if (parsed.fehler) throw new Error(FEHLER_TEXT[parsed.fehler] || parsed.fehler);
item.titel = parsed.titel;
item.quelle = parsed.quelle;
item.body = parsed.body;
item.error = null;
} catch (err) {
item.error = err && err.message ? err.message : String(err);
}
render();
}
// Enter (without Shift) in the text field triggers immediate adding as
// usual, instead of inserting a line break - Shift+Enter and pasting
// from the clipboard remain free for adding several lines at once.
linkInput.addEventListener("keydown", (e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
linkForm.requestSubmit();
}
});
linkForm.addEventListener("submit", (e) => {
e.preventDefault();
const zeilen = linkInput.value.split(/\r?\n/).map((z) => z.trim()).filter(Boolean);
if (!zeilen.length) return;
linkInput.value = "";
zeilen.forEach(addLink);
});
// --- Render list: drag & drop, page-break conflict check ---------------
// Same pattern as renderMappeList() in pandoc_ebh_paket/src/app.html.tmpl.
function render() {
itemList.innerHTML = "";
if (!items.length) {
itemList.appendChild(el("div", { className: "hint", text: "Noch keine Links eingefügt." }));
renderOutline();
return;
}
items.forEach((item, index) => {
const isFirst = index === 0;
const isLast = index === items.length - 1;
const prevItem = index > 0 ? items[index - 1] : null;
const nextItem = index < items.length - 1 ? items[index + 1] : null;
let beforeDisabledReason = "";
if (isFirst) beforeDisabledReason = "Nicht möglich vor der ersten Datei.";
else if (prevItem.pageBreakAfter) beforeDisabledReason = "Nicht möglich: die vorherige Methode hat bereits „Seitenumbruch danach“ gesetzt.";
let afterDisabledReason = "";
if (isLast) afterDisabledReason = "Nicht möglich nach der letzten Datei.";
else if (nextItem.pageBreakBefore) afterDisabledReason = "Nicht möglich: die nächste Methode hat bereits „Seitenumbruch davor“ gesetzt.";
if (beforeDisabledReason) item.pageBreakBefore = false;
if (afterDisabledReason) item.pageBreakAfter = false;
const row = el("div", { className: "item-row" + (item.error ? " error" : ""), draggable: !item.error }, []);
row.dataset.id = String(item.id);
const removeBtn = el("button", { type: "button", className: "icon-btn", title: "entfernen", text: "✕" });
removeBtn.addEventListener("click", () => {
items = items.filter((it) => it.id !== item.id);
render();
});
const main = el("div", { className: "item-row__main" }, [
el("span", { className: "drag-handle", text: "⠿" }),
el("span", { className: "item-name", title: item.error ? item.url : item.titel, text: item.error ? item.url : item.titel }),
removeBtn
]);
row.appendChild(main);
if (item.error) {
row.appendChild(el("div", { className: "item-row__error", text: item.error }));
} else {
// Toggle buttons instead of checkbox+label: a larger, unambiguous
// click target (native checkboxes are tiny and hard to hit on
// narrow viewports).
const beforeBtn = el("button", {
type: "button", className: "pb-toggle", "aria-pressed": String(item.pageBreakBefore),
disabled: Boolean(beforeDisabledReason), title: beforeDisabledReason || undefined, text: "Umbruch davor"
});
beforeBtn.addEventListener("click", () => { item.pageBreakBefore = !item.pageBreakBefore; render(); });
const afterBtn = el("button", {
type: "button", className: "pb-toggle", "aria-pressed": String(item.pageBreakAfter),
disabled: Boolean(afterDisabledReason), title: afterDisabledReason || undefined, text: "Umbruch danach"
});
afterBtn.addEventListener("click", () => { item.pageBreakAfter = !item.pageBreakAfter; render(); });
row.appendChild(el("div", { className: "item-row__controls" }, [beforeBtn, afterBtn]));
}
row.addEventListener("dragstart", (e) => {
e.dataTransfer.setData("text/plain", String(item.id));
e.dataTransfer.effectAllowed = "move";
row.classList.add("dragging");
});
row.addEventListener("dragend", () => row.classList.remove("dragging"));
row.addEventListener("dragover", (e) => { e.preventDefault(); e.dataTransfer.dropEffect = "move"; });
row.addEventListener("drop", (e) => {
e.preventDefault();
const draggedId = Number(e.dataTransfer.getData("text/plain"));
if (draggedId === item.id) return;
const fromIndex = items.findIndex((it) => it.id === draggedId);
const toIndex = items.findIndex((it) => it.id === item.id);
if (fromIndex === -1 || toIndex === -1) return;
const [moved] = items.splice(fromIndex, 1);
items.splice(toIndex, 0, moved);
render();
});
itemList.appendChild(row);
});
renderOutline();
}
// --- Outline preview -----------------------------------------------------
function extractHeadings(text) {
const headings = [];
const lines = text.split(/\r?\n/);
let inFence = false;
let fenceChar = "";
for (const line of lines) {
const fenceMatch = /^ {0,3}(`{3,}|~{3,})/.exec(line);
if (fenceMatch) {
if (!inFence) { inFence = true; fenceChar = fenceMatch[1][0]; }
else if (fenceMatch[1][0] === fenceChar) inFence = false;
continue;
}
if (inFence) continue;
const m = /^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(line);
if (m) headings.push({ level: m[1].length, text: m[2].trim() });
}
return headings;
}
function renderOutline() {
outline.innerHTML = "";
const usable = items.filter((it) => !it.error);
const entries = [];
for (const item of usable) {
for (const h of extractHeadings(item.body)) entries.push({ level: h.level, text: h.text, source: item.titel });
}
if (!entries.length) {
outline.appendChild(el("div", { className: "hint", text: "Noch keine Überschriften erkannt." }));
return;
}
const baseLevel = Math.min(...entries.map((e) => e.level));
const counters = [0, 0, 0, 0, 0, 0];
for (const e of entries) {
counters[e.level - 1] += 1;
for (let i = e.level; i < 6; i++) counters[i] = 0;
e.number = counters.slice(baseLevel - 1, e.level).join(".");
}
for (const e of entries) {
outline.appendChild(el("div", { className: "outline-row", style: "padding-left:" + (e.level - baseLevel) * 1.1 + "rem;" }, [
el("span", { className: "outline-number", text: e.number }),
el("span", { text: e.text }),
el("span", { className: "outline-source", text: e.source })
]));
}
}
// --- Images: fetch same-origin references and rename them locally -------
// Only relevant for zip/Word: Word (Pandoc WASM) can't fetch https images
// itself (no network access from the WASM sandbox), and a zip should be
// browsable offline. The plain markdown file, on the other hand,
// deliberately keeps the absolute URLs (works anywhere the file
// currently has an internet connection, without separately bundled
// images).
const IMAGE_RE = /!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g;
function sanitizeFileName(name) {
return name.replace(/[\\/:*?"<>|]+/g, "_");
}
async function collectAssets(usableItems) {
const urlToLocalName = new Map();
const files = new Map(); // localName -> Blob
const used = new Set();
for (const item of usableItems) {
IMAGE_RE.lastIndex = 0;
let m;
while ((m = IMAGE_RE.exec(item.body))) {
const src = m[2];
let parsed;
try { parsed = new URL(src, window.location.href); } catch (e) { continue; }
if (parsed.origin !== window.location.origin) continue;
if (urlToLocalName.has(parsed.href)) continue;
let base = sanitizeFileName(decodeURIComponent(parsed.pathname.split("/").pop() || "bild"));
let candidate = base;
let n = 1;
while (used.has(candidate)) { candidate = base.replace(/(\.[^.]*)?$/, "_" + (++n) + "$1"); }
used.add(candidate);
urlToLocalName.set(parsed.href, candidate);
try {
const res = await fetch(parsed.href);
if (res.ok) files.set(candidate, await res.blob());
} catch (e) {
// Image stays unreachable - the reference is rewritten anyway,
// it just ends up missing in the result (analogous to the known
// limitation in pandoc_ebh_paket, see its README).
}
}
}
function rewrite(body, pathPrefix) {
return body.replace(IMAGE_RE, (whole, alt, src) => {
let parsed;
try { parsed = new URL(src, window.location.href); } catch (e) { return whole; }
const local = urlToLocalName.get(parsed.href);
if (!local) return whole;
return "![" + alt + "](" + pathPrefix + local + ")";
});
}
return { files, rewrite };
}
// --- Download: trigger via an invisible link -----------------------------
function triggerDownload(blob, filename) {
const url = URL.createObjectURL(blob);
const a = el("a", { href: url, download: filename });
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(() => URL.revokeObjectURL(url), 10000);
}
function safeBaseName() {
const base = (titelInput.value || "methoden-set").trim() || "methoden-set";
return sanitizeFileName(base);
}
function usable() {
return items.filter((it) => !it.error && it.body);
}
// --- As a folder (.zip) ---------------------------------------------------
btnZip.addEventListener("click", async () => {
const list = usable();
if (!list.length) { setStatus("Bitte mindestens eine gültig geladene Variante einfügen.", "error"); return; }
btnZip.disabled = true;
setStatus("Zip wird zusammengestellt …", "busy");
try {
const { files, rewrite } = await collectAssets(list);
const entries = [];
list.forEach((item, index) => {
const name = String(index + 1).padStart(2, "0") + "-" + sanitizeFileName(item.titel).slice(0, 60) + ".md";
const content = rewrite(item.body, "bilder/");
entries.push({ path: name, data: new TextEncoder().encode(content) });
});
for (const [name, blob] of files) {
entries.push({ path: "bilder/" + name, data: new Uint8Array(await blob.arrayBuffer()) });
}
const zipBlob = AblegerZip.write(entries);
triggerDownload(zipBlob, safeBaseName() + ".zip");
setStatus("Fertig – Download gestartet.", "ok");
} catch (err) {
console.error(err);
setStatus("Fehler: " + (err && err.message ? err.message : err), "error");
} finally {
btnZip.disabled = false;
}
});
// --- As markdown (one file) ------------------------------------------------
btnMd.addEventListener("click", () => {
const list = usable();
if (!list.length) { setStatus("Bitte mindestens eine gültig geladene Variante einfügen.", "error"); return; }
const parts = [
"# " + (titelInput.value || "Methoden-Set").trim(),
...list.map((item) => item.body.trim())
];
const blob = new Blob([parts.join("\n\n---\n\n")], { type: "text/markdown;charset=utf-8" });
triggerDownload(blob, safeBaseName() + ".md");
setStatus("Fertig – Download gestartet.", "ok");
});
// --- As Word (.docx) via Pandoc WASM ----------------------------------------
// Loads pandoc.wasm + the loader patched for offline capability only on
// demand (not on page load) - see methoden-set/vendor/.
let pandocInstancePromise = null;
function loadPandocCoreModule() {
const base = new URL("vendor/wasi-shim/", window.location.href);
return Promise.all([
fetch(new URL("wasi_defs.js", base)).then((r) => r.text()),
fetch(new URL("debug.js", base)).then((r) => r.text()),
fetch(new URL("fd.js", base)).then((r) => r.text()),
fetch(new URL("fs_mem.js", base)).then((r) => r.text()),
fetch(new URL("wasi.js", base)).then((r) => r.text()),
fetch(new URL("pandoc-core-adapted.js", base)).then((r) => r.text())
]).then(([defsSrc, debugSrc, fdSrc, fsMemSrc, wasiSrc, coreSrc]) => {
const defsUrl = URL.createObjectURL(new Blob([defsSrc], { type: "text/javascript" }));
const debugUrl = URL.createObjectURL(new Blob([debugSrc], { type: "text/javascript" }));
const fdPatched = fdSrc.split('"./wasi_defs.js"').join('"' + defsUrl + '"');
const fdUrl = URL.createObjectURL(new Blob([fdPatched], { type: "text/javascript" }));
const fsMemPatched = fsMemSrc
.split('"./debug.js"').join('"' + debugUrl + '"')
.split('"./wasi_defs.js"').join('"' + defsUrl + '"')
.split('"./fd.js"').join('"' + fdUrl + '"');
const fsMemUrl = URL.createObjectURL(new Blob([fsMemPatched], { type: "text/javascript" }));
const wasiPatched = wasiSrc
.split('"./wasi_defs.js"').join('"' + defsUrl + '"')
.split('"./debug.js"').join('"' + debugUrl + '"');
const wasiUrl = URL.createObjectURL(new Blob([wasiPatched], { type: "text/javascript" }));
const corePatched = coreSrc
.split('"__WASI_SHIM_FS_MEM_URL__"').join('"' + fsMemUrl + '"')
.split('"__WASI_SHIM_WASI_URL__"').join('"' + wasiUrl + '"');
const coreUrl = URL.createObjectURL(new Blob([corePatched], { type: "text/javascript" }));
return import(/* webpackIgnore: true */ coreUrl);
});
}
function loadPandoc() {
if (pandocInstancePromise) return pandocInstancePromise;
pandocInstancePromise = (async () => {
setStatus("Pandoc wird geladen (einmalig, ca. 58 MB, kann etwas dauern) …", "busy");
const [core, wasmResponse] = await Promise.all([
loadPandocCoreModule(),
fetch(new URL("vendor/pandoc.wasm", window.location.href))
]);
const wasmBytes = await wasmResponse.arrayBuffer();
return core.createPandocInstance(wasmBytes);
})();
return pandocInstancePromise;
}
// --- Template selection: from vorlagen/vorlagen-manifest.json -----------
// Generated on every deploy from the actual contents of methoden-set/
// vorlagen/ on the server (scripts/generate-vorlagen-manifest.rb, see
// the Methoden-Set chapter on the project website) - also captures templates someone copied onto
// the server manually, not just the ones from this repo. If the file is
// missing (e.g. in a local preview without the deploy hook), the app
// falls back to the two known default templates instead of staying
// empty.
let vorlagenManifest = null;
async function ladeVorlagenManifest() {
if (vorlagenManifest) return vorlagenManifest;
try {
const res = await fetch(new URL("vorlagen/vorlagen-manifest.json", window.location.href));
if (!res.ok) throw new Error("Status " + res.status);
vorlagenManifest = await res.json();
} catch (e) {
vorlagenManifest = [
{ datei: "ableger-standard.docx", format: "docx", label: "Ableger Standard" },
{ datei: "ableger-standard.odt", format: "odt", label: "Ableger Standard" }
];
}
return vorlagenManifest;
}
function aktualisiereDateiFeld() {
const datei = document.getElementById("vorlage-datei");
if (!datei) return;
datei.disabled = document.querySelector('input[name="vorlage"]:checked').value !== "eigen";
}
async function renderVorlagenListe() {
const format = currentFormat();
const manifest = await ladeVorlagenManifest();
const passend = manifest.filter((e) => e.format === format);
vorlageListe.innerHTML = "";
passend.forEach((eintrag, index) => {
const radio = el("input", { type: "radio", name: "vorlage", value: eintrag.datei, checked: index === 0 });
vorlageListe.appendChild(el("label", {}, [radio, document.createTextNode(" " + eintrag.label)]));
radio.addEventListener("change", aktualisiereDateiFeld);
});
const eigenRadio = el("input", { type: "radio", name: "vorlage", value: "eigen", checked: !passend.length });
vorlageListe.appendChild(el("label", {}, [eigenRadio, document.createTextNode(" Eigene Vorlage hochladen")]));
eigenRadio.addEventListener("change", aktualisiereDateiFeld);
const dateiInput = el("input", { type: "file", id: "vorlage-datei", accept: "." + format, disabled: passend.length > 0 });
vorlageListe.appendChild(dateiInput);
}
// Reference templates are format-bound (a .docx template doesn't work
// for odt output and vice versa) - the template list and button label
// therefore adapt to the format choice.
function aktualisiereFormatUI() {
btnDokument.textContent = currentFormat() === "odt" ? "OpenDocument erstellen" : "Word-Dokument erstellen";
renderVorlagenListe();
}
formatRadios.forEach((radio) => radio.addEventListener("change", aktualisiereFormatUI));
aktualisiereFormatUI();
async function currentReferenceDoc(format) {
const gewaehlt = document.querySelector('input[name="vorlage"]:checked').value;
const dateiInput = document.getElementById("vorlage-datei");
if (gewaehlt === "eigen") {
if (!dateiInput || !dateiInput.files[0]) throw new Error("Bitte eine eigene Vorlage-Datei auswählen.");
return dateiInput.files[0];
}
const res = await fetch(new URL("vorlagen/" + gewaehlt, window.location.href));
return res.blob();
}
btnDokument.addEventListener("click", async () => {
const list = usable();
if (!list.length) { setStatus("Bitte mindestens eine gültig geladene Variante einfügen.", "error"); return; }
const format = currentFormat();
btnDokument.disabled = true;
try {
const instance = await loadPandoc();
setStatus("Dokument wird erstellt …", "busy");
const { files, rewrite } = await collectAssets(list);
const pageBreak = '```{=openxml}\n<w:p><w:r><w:br w:type="page"/></w:r></w:p>\n```';
const body = list
.map((item, index) => {
let chunk = rewrite(item.body, "").trim();
if (item.pageBreakBefore && index > 0) chunk = pageBreak + "\n\n" + chunk;
if (item.pageBreakAfter && index < list.length - 1) chunk = chunk + "\n\n" + pageBreak;
return chunk;
})
.join("\n\n");
const titel = (titelInput.value || "Methoden-Set").trim();
const fullMarkdown = "---\ntitle: " + JSON.stringify(titel) + "\n---\n\n" + body;
const referenceBlob = await currentReferenceDoc(format);
const referenceFileName = "reference." + format;
const filesForConvert = { [referenceFileName]: referenceBlob };
for (const [name, blob] of files) filesForConvert[name] = blob;
const options = {
from: "markdown",
to: format,
standalone: true,
"reference-doc": referenceFileName,
"output-file": "output." + format
};
if (document.getElementById("toc-checkbox").checked) {
options["table-of-contents"] = true;
options.metadata = { "toc-title": "Inhalt" };
}
if (document.getElementById("numsections-checkbox").checked) {
options["number-sections"] = true;
}
const result = await instance.convert(options, fullMarkdown, filesForConvert);
if (result.stderr) console.warn("[pandoc stderr]", result.stderr);
const missingImages = Array.from(new Set(
(result.warnings || [])
.filter((w) => w.type === "CouldNotFetchResource" && w.path)
.map((w) => w.path)
));
if (missingImages.length) {
setStatus("Fertig, aber diese Bilder fehlen im Dokument: " + missingImages.join(", "), "error");
} else {
setStatus("Fertig – Download gestartet.", "ok");
}
const outputBlob = result.files["output." + format];
if (!outputBlob || !outputBlob.size) throw new Error("Pandoc hat keine Ausgabedatei erzeugt. Details siehe Browser-Konsole.");
triggerDownload(outputBlob, safeBaseName() + "." + format);
} catch (err) {
console.error(err);
setStatus("Fehler: " + (err && err.message ? err.message : err), "error");
} finally {
btnDokument.disabled = false;
}
});
render();
setStatus("Bereit.", "ok");
})();
+155
View File
@@ -0,0 +1,155 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Ableger – Methoden-Set</title>
<!-- Same stylesheet as the Hugo website (site-header/site-title/
site-nav, color variables) - see admin/index.html for the same pattern. -->
<link rel="stylesheet" href="/css/style.css">
<style>
#methoden-set { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
#methoden-set h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
#methoden-set .lead { color: var(--color-muted); margin: 0 0 2rem; }
#methoden-set h2 { font-size: 1.1rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.25rem; margin: 2rem 0 1rem; }
#methoden-set .schritt-nr {
display: inline-flex; align-items: center; justify-content: center;
width: 1.6rem; height: 1.6rem; border-radius: 50%;
background: var(--color-accent); color: var(--color-accent-contrast);
font-size: 0.85rem; font-weight: 700; margin-right: 0.5rem;
}
#methoden-set .hint { color: var(--color-muted); font-size: 0.875rem; margin: 0.35rem 0 0.75rem; }
#methoden-set textarea,
#methoden-set input[type="text"],
#methoden-set input[type="url"],
#methoden-set select {
width: 100%; box-sizing: border-box; padding: 0.55rem 0.7rem;
border: 1px solid var(--color-border); border-radius: var(--radius);
background: var(--color-card-bg); color: var(--color-text); font: inherit;
}
#methoden-set textarea:focus-visible,
#methoden-set input:focus-visible,
#methoden-set select:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 1px; }
#methoden-set button {
font: inherit; cursor: pointer; border-radius: var(--radius);
padding: 0.55rem 1rem; border: 1px solid var(--color-border);
background: var(--color-card-bg); color: var(--color-text);
}
#methoden-set button:hover { border-color: var(--color-accent); }
#methoden-set button:disabled { opacity: 0.5; cursor: not-allowed; }
#methoden-set button.primary { background: var(--color-accent); color: var(--color-accent-contrast); border-color: var(--color-accent); }
#methoden-set .link-form { display: flex; gap: 0.5rem; align-items: flex-start; }
#methoden-set .link-form textarea { flex: 1; resize: vertical; min-height: 2.6rem; font-family: inherit; }
#methoden-set .item-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0; }
#methoden-set .item-row {
display: flex; flex-direction: column; gap: 0.5rem; padding: 0.65rem 0.75rem;
border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-card-bg);
}
#methoden-set .item-row[draggable="true"] { cursor: grab; }
#methoden-set .item-row.dragging { opacity: 0.4; }
#methoden-set .item-row.error { border-color: #b3261e; }
#methoden-set .item-row__main { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
#methoden-set .drag-handle { color: var(--color-muted); flex: none; }
#methoden-set .item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#methoden-set .item-row__error { color: #b3261e; font-size: 0.85rem; padding-left: 1.6rem; }
#methoden-set .item-row__controls { display: flex; gap: 0.5rem; flex-wrap: wrap; padding-left: 1.6rem; }
#methoden-set .pb-toggle {
font-size: 0.78rem; padding: 0.4rem 0.75rem; border-radius: 999px;
border: 1px solid var(--color-border); background: transparent; color: var(--color-muted);
display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem;
}
#methoden-set .pb-toggle::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 1px solid currentColor; flex: none; }
#methoden-set .pb-toggle[aria-pressed="true"] { background: var(--color-accent); color: var(--color-accent-contrast); border-color: var(--color-accent); }
#methoden-set .pb-toggle[aria-pressed="true"]::before { background: currentColor; }
#methoden-set .pb-toggle:disabled { opacity: 0.4; cursor: not-allowed; }
#methoden-set .icon-btn { border: none; background: none; padding: 0.3rem 0.5rem; flex: none; font-size: 1rem; }
#methoden-set .outline { font-size: 0.875rem; }
#methoden-set .outline-row { padding: 0.15rem 0; display: flex; gap: 0.5rem; }
#methoden-set .outline-number { color: var(--color-muted); min-width: 2.5rem; }
#methoden-set .outline-source { color: var(--color-muted); margin-left: auto; font-size: 0.78rem; }
#methoden-set .download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; margin-top: 1rem; }
#methoden-set .vorlage-wahl { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0 1.25rem; }
#methoden-set .vorlage-wahl label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
#methoden-set #status { margin-top: 1rem; font-size: 0.9rem; min-height: 1.3em; }
#methoden-set #status[data-state="busy"] { color: var(--color-muted); }
#methoden-set #status[data-state="error"] { color: #b3261e; }
#methoden-set #status[data-state="ok"] { color: var(--color-accent); }
#methoden-set .feld { margin: 0 0 1rem; }
#methoden-set .feld label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
</style>
</head>
<body>
<header class="site-header">
<a class="site-title" href="/">
<img src="/img/logo.svg" alt="" class="site-logo" width="32" height="32">
Ableger
</a>
<nav class="site-nav">
<a href="/">← Zur Website</a>
</nav>
</header>
<main id="methoden-set">
<h1>Methoden-Set zusammenstellen</h1>
<p class="lead">
Mehrere Methoden von der Ableger-Website zu einer eigenen Sammlung
zusammenfassen und als Ordner, als eine Markdown-Datei oder als
Word-Dokument herunterladen. Läuft vollständig in diesem Browser -
nichts wird irgendwohin übertragen.
</p>
<h2><span class="schritt-nr">1</span>Links einfügen</h2>
<p class="hint">
Links auf einzelne Methoden oder Varianten dieser Website - keine
fremden Adressen. Bei Methoden mit mehreren Varianten bitte den Link
der gewünschten Variante einfügen (auf der Methoden-Seite verlinkt).
Mehrere Links auf einmal: einen pro Zeile einfügen.
</p>
<form class="link-form" id="link-form">
<label for="link-input" class="visually-hidden">Links, einer pro Zeile</label>
<textarea id="link-input" rows="1" placeholder="https://…/name-der-variante/" required></textarea>
<button type="submit" class="primary">Hinzufügen</button>
</form>
<h2><span class="schritt-nr">2</span>Reihenfolge festlegen</h2>
<p class="hint">Per Ziehen sortieren. Seitenumbruch-Regler wirken sich nur auf den Word-Export aus.</p>
<div class="item-list" id="item-list"></div>
<details>
<summary class="hint" style="cursor:pointer;">Gliederungsvorschau</summary>
<div class="outline" id="outline"></div>
</details>
<h2><span class="schritt-nr">3</span>Herunterladen</h2>
<div class="feld">
<label for="titel-input">Titel des Sets</label>
<input type="text" id="titel-input" value="Methoden-Set">
</div>
<div class="vorlage-wahl">
<label><input type="radio" name="format" value="docx" checked> Word (.docx)</label>
<label><input type="radio" name="format" value="odt"> OpenDocument (.odt)</label>
</div>
<div class="vorlage-wahl" id="vorlage-liste">
<!-- filled by app.js from vorlagen/vorlagen-manifest.json (see the Methoden-Set chapter on the project website) -->
</div>
<div class="vorlage-wahl">
<label><input type="checkbox" id="toc-checkbox" checked> Inhaltsverzeichnis</label>
<label><input type="checkbox" id="numsections-checkbox"> Kapitelnummerierung</label>
</div>
<p class="hint">Format, Vorlage, Inhaltsverzeichnis und Kapitelnummerierung wirken sich nur auf den Dokument-Export aus.</p>
<div class="download-grid">
<button type="button" id="btn-zip">Als Ordner (.zip)</button>
<button type="button" id="btn-md">Als Markdown</button>
<button type="button" id="btn-dokument" class="primary">Dokument erstellen</button>
</div>
<p id="status" role="status" aria-live="polite"></p>
</main>
<script src="/methoden-set/zip-writer.js"></script>
<script src="/methoden-set/app.js"></script>
</body>
</html>
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
let Debug=class Debug{enable(enabled){this.log=createLogger(enabled===undefined?true:enabled,this.prefix)}get enabled(){return this.isEnabled}constructor(isEnabled){this.isEnabled=isEnabled;this.prefix="wasi:";this.enable(isEnabled)}};function createLogger(enabled,prefix){if(enabled){const a=console.log.bind(console,"%c%s","color: #265BA0",prefix);return a}else{return()=>{}}}export const debug=new Debug(false);
+1
View File
@@ -0,0 +1 @@
import*as wasi from"./wasi_defs.js";export class Fd{fd_allocate(offset,len){return wasi.ERRNO_NOTSUP}fd_close(){return 0}fd_fdstat_get(){return{ret:wasi.ERRNO_NOTSUP,fdstat:null}}fd_fdstat_set_flags(flags){return wasi.ERRNO_NOTSUP}fd_fdstat_set_rights(fs_rights_base,fs_rights_inheriting){return wasi.ERRNO_NOTSUP}fd_filestat_get(){return{ret:wasi.ERRNO_NOTSUP,filestat:null}}fd_filestat_set_size(size){return wasi.ERRNO_NOTSUP}fd_filestat_set_times(atim,mtim,fst_flags){return wasi.ERRNO_NOTSUP}fd_pread(size,offset){return{ret:wasi.ERRNO_NOTSUP,data:new Uint8Array}}fd_prestat_get(){return{ret:wasi.ERRNO_NOTSUP,prestat:null}}fd_pwrite(data,offset){return{ret:wasi.ERRNO_NOTSUP,nwritten:0}}fd_read(size){return{ret:wasi.ERRNO_NOTSUP,data:new Uint8Array}}fd_readdir_single(cookie){return{ret:wasi.ERRNO_NOTSUP,dirent:null}}fd_seek(offset,whence){return{ret:wasi.ERRNO_NOTSUP,offset:0n}}fd_sync(){return 0}fd_tell(){return{ret:wasi.ERRNO_NOTSUP,offset:0n}}fd_write(data){return{ret:wasi.ERRNO_NOTSUP,nwritten:0}}path_create_directory(path){return wasi.ERRNO_NOTSUP}path_filestat_get(flags,path){return{ret:wasi.ERRNO_NOTSUP,filestat:null}}path_filestat_set_times(flags,path,atim,mtim,fst_flags){return wasi.ERRNO_NOTSUP}path_link(path,inode,allow_dir){return wasi.ERRNO_NOTSUP}path_unlink(path){return{ret:wasi.ERRNO_NOTSUP,inode_obj:null}}path_lookup(path,dirflags){return{ret:wasi.ERRNO_NOTSUP,inode_obj:null}}path_open(dirflags,path,oflags,fs_rights_base,fs_rights_inheriting,fd_flags){return{ret:wasi.ERRNO_NOTDIR,fd_obj:null}}path_readlink(path){return{ret:wasi.ERRNO_NOTSUP,data:null}}path_remove_directory(path){return wasi.ERRNO_NOTSUP}path_rename(old_path,new_fd,new_path){return wasi.ERRNO_NOTSUP}path_unlink_file(path){return wasi.ERRNO_NOTSUP}}export class Inode{static issue_ino(){return Inode.next_ino++}static root_ino(){return 0n}constructor(){this.ino=Inode.issue_ino()}}Inode.next_ino=1n;
File diff suppressed because one or more lines are too long
+396
View File
@@ -0,0 +1,396 @@
/* pandoc-wasm: Core pandoc logic (environment-agnostic)
This file contains all the pandoc conversion logic but doesn't handle
WASM loading. The WASM binary must be provided by the caller.
Unveraendert aus pandoc-wasm@1.1.0 src/core.js uebernommen - einzige
Aenderung ist der Import-Block direkt darunter: statt vom bare-specifier
"@bjorn3/browser_wasi_shim" (der einen Bundler braucht) wird von zwei
Platzhaltern importiert, die die App zur Laufzeit durch echte Blob-URLs
ersetzt (siehe loadPandocCoreModule() im App-Code) - dieselbe, bereits
getestete Technik wie in tobias_ebh/pandoc_ebh_paket, hier erneut gegen
frisch von npm bezogene Dateien angewendet statt aus dessen Vendor-Ordner
uebernommen (siehe das Methoden-Set-Kapitel auf der Projekt-Website).
*/
import {
ConsoleStdout,
Directory,
File,
OpenFile,
PreopenDirectory
} from "__WASI_SHIM_FS_MEM_URL__"
import WASI from "__WASI_SHIM_WASI_URL__"
// Initialize and export the pandoc instance creator
export function createPandocInstance(wasmBinary) {
// Initialize WASM module
const args = ["pandoc.wasm", "+RTS", "-H64m", "-RTS"]
const env = []
const fileSystem = new Map()
const fds = [
new OpenFile(new File(new Uint8Array(), {readonly: true})),
ConsoleStdout.lineBuffered(msg => console.log(`[WASI stdout] ${msg}`)),
ConsoleStdout.lineBuffered(msg => console.warn(`[WASI stderr] ${msg}`)),
new PreopenDirectory("/", fileSystem)
]
const options = {debug: false}
const wasi = new WASI(args, env, fds, options)
// Instantiate WASM
return WebAssembly.instantiate(wasmBinary, {
wasi_snapshot_preview1: wasi.wasiImport
}).then(({instance}) => {
wasi.initialize(instance)
instance.exports.__wasm_call_ctors()
function memory_data_view() {
return new DataView(instance.exports.memory.buffer)
}
const argc_ptr = instance.exports.malloc(4)
memory_data_view().setUint32(argc_ptr, args.length, true)
const argv = instance.exports.malloc(4 * (args.length + 1))
for (let i = 0; i < args.length; ++i) {
const arg = instance.exports.malloc(args[i].length + 1)
new TextEncoder().encodeInto(
args[i],
new Uint8Array(
instance.exports.memory.buffer,
arg,
args[i].length
)
)
memory_data_view().setUint8(arg + args[i].length, 0)
memory_data_view().setUint32(argv + 4 * i, arg, true)
}
memory_data_view().setUint32(argv + 4 * args.length, 0, true)
const argv_ptr = instance.exports.malloc(4)
memory_data_view().setUint32(argv_ptr, argv, true)
instance.exports.hs_init_with_rtsopts(argc_ptr, argv_ptr)
// Helper function to add file to filesystem
// Accepts either a Blob or a string
async function addFile(filename, data, readonly) {
let uint8Array
if (typeof data === "string") {
// Convert string to Uint8Array
uint8Array = new TextEncoder().encode(data)
} else {
// Assume it's a Blob
const buffer = await data.arrayBuffer()
uint8Array = new Uint8Array(buffer)
}
const file = new File(uint8Array, {readonly: readonly})
fileSystem.set(filename, file)
}
// Main API: query function
function query(options) {
const opts_str = JSON.stringify(options)
const encoded = new TextEncoder().encode(opts_str)
// Allocate memory based on byte length, not character count
const opts_ptr = instance.exports.malloc(encoded.length)
new TextEncoder().encodeInto(
opts_str,
new Uint8Array(
instance.exports.memory.buffer,
opts_ptr,
encoded.length
)
)
// Setup filesystem
fileSystem.clear()
const out_file = new File(new Uint8Array(), {readonly: false})
const err_file = new File(new Uint8Array(), {readonly: false})
fileSystem.set("stdout", out_file)
fileSystem.set("stderr", err_file)
instance.exports.query(opts_ptr, encoded.length)
const err_text = new TextDecoder("utf-8", {fatal: true}).decode(
err_file.data
)
if (err_text) {
console.log(err_text)
}
const out_text = new TextDecoder("utf-8", {fatal: true}).decode(
out_file.data
)
return JSON.parse(out_text)
}
// Main API: convert function
async function convert(options, stdin, files) {
const opts_str = JSON.stringify(options)
const encoded = new TextEncoder().encode(opts_str)
const opts_ptr = instance.exports.malloc(encoded.length)
new TextEncoder().encodeInto(
opts_str,
new Uint8Array(
instance.exports.memory.buffer,
opts_ptr,
encoded.length
)
)
// Clone files object to avoid mutating the input parameter
files = {...files}
// Setup filesystem
fileSystem.clear()
const in_file = new File(new Uint8Array(), {readonly: true})
const out_file = new File(new Uint8Array(), {readonly: false})
const err_file = new File(new Uint8Array(), {readonly: false})
const warnings_file = new File(new Uint8Array(), {readonly: false})
fileSystem.set("stdin", in_file)
fileSystem.set("stdout", out_file)
fileSystem.set("stderr", err_file)
fileSystem.set("warnings", warnings_file)
// Track known files to detect newly created media files
// We track system files, input files, output files, and extract-media archives
const knownFiles = new Set([
"stdin",
"stdout",
"stderr",
"warnings"
])
// Add input files (can be Blobs or strings)
for (const filename in files) {
await addFile(filename, files[filename], true)
knownFiles.add(filename)
}
// Track output file and extract-media separately
// These should NOT be included in mediaFiles (only extracted media should be)
const outputFileName = options["output-file"] || null
const extractMediaPath = options["extract-media"] || null
// Add output file placeholder if specified
if (outputFileName) {
await addFile(outputFileName, new Blob(), false)
knownFiles.add(outputFileName)
}
// Add placeholder file for extract-media zip archives. For
// directory targets nothing is pre-created: pandoc creates the
// directory itself, and a file placeholder at that path would
// make it fail with ENOTDIR.
if (extractMediaPath && extractMediaPath.endsWith(".zip")) {
await addFile(extractMediaPath, new Blob(), false)
knownFiles.add(extractMediaPath)
}
// Set stdin content
if (stdin) {
in_file.data = new TextEncoder().encode(stdin)
}
// Run conversion
instance.exports.convert(opts_ptr, encoded.length)
// Collect output file if generated
if (options["output-file"]) {
const outputFile = fileSystem.get(options["output-file"])
if (
outputFile &&
outputFile.data &&
outputFile.data.length > 0
) {
files[options["output-file"]] = new Blob([outputFile.data])
}
}
// Collect extracted media if generated
if (options["extract-media"]) {
const mediaFile = fileSystem.get(options["extract-media"])
if (mediaFile && mediaFile.data && mediaFile.data.length > 0) {
files[options["extract-media"]] = new Blob(
[mediaFile.data],
{
type: "application/zip"
}
)
}
}
// Collect any newly created files (e.g., extracted media images).
// Media extracted to a directory is nested (e.g. docx media lands
// at "<extract-media>/media/image1.png"), so walk directories
// recursively. mediaFiles should ONLY contain extracted media,
// NOT the output file or extract-media zip archive (both are
// tracked in knownFiles).
const mediaFiles = {}
const collectNewFiles = (map, prefix) => {
for (const [name, entry] of map.entries()) {
const path = prefix ? `${prefix}/${name}` : name
if (entry instanceof Directory) {
collectNewFiles(entry.contents, path)
} else if (
!knownFiles.has(path) &&
entry.data &&
entry.data.length > 0
) {
const blob = new Blob([entry.data])
files[path] = blob
mediaFiles[path] = blob
}
}
}
collectNewFiles(fileSystem, "")
// Parse warnings
const rawWarnings = new TextDecoder("utf-8", {fatal: true}).decode(
warnings_file.data
)
let warnings = []
if (rawWarnings) {
try {
warnings = JSON.parse(rawWarnings)
} catch (e) {
console.warn("Failed to parse warnings:", e)
}
}
return {
stdout: new TextDecoder("utf-8", {fatal: true}).decode(
out_file.data
),
stderr: new TextDecoder("utf-8", {fatal: true}).decode(
err_file.data
),
warnings: warnings,
files: files,
mediaFiles: mediaFiles
}
}
// Helper function to convert data to Uint8Array
async function toUint8Array(inData) {
let uint8Array
if (typeof inData === "string") {
const encoder = new TextEncoder()
uint8Array = encoder.encode(inData)
} else if (inData instanceof Blob) {
const arrayBuffer = await inData.arrayBuffer()
uint8Array = new Uint8Array(arrayBuffer)
} else {
throw new Error(
"Unsupported type: inData must be a string or a Blob"
)
}
return uint8Array
}
const textDecoder = new TextDecoder("utf-8", {fatal: true})
function convertData(data) {
let outData
try {
// Attempt to decode as UTF-8 text
outData = textDecoder.decode(data)
} catch (_e) {
// If decoding fails, return as Blob
outData = new Blob([data])
}
return outData
}
// Legacy API: pandoc function (for backward compatibility)
async function pandoc(args_str, inData, resources = []) {
// Parse command line arguments into options object
const argParts = args_str.trim().split(/\s+/)
const options = {}
const files = {}
let i = 0
while (i < argParts.length) {
const arg = argParts[i]
if (arg === "-f" || arg === "--from") {
options.from = argParts[++i]
} else if (arg === "-t" || arg === "--to") {
options.to = argParts[++i]
} else if (arg === "-o" || arg === "--output") {
options["output-file"] = argParts[++i]
} else if (arg === "-s" || arg === "--standalone") {
options.standalone = true
} else if (arg === "--extract-media") {
options["extract-media"] = argParts[++i]
} else if (arg === "--toc" || arg === "--table-of-contents") {
options["table-of-contents"] = true
}
i++
}
// Add resource files (convert to string or keep as Blob)
for (const resource of resources) {
// If contents is a string, keep it as string
// Otherwise, convert to Blob
if (typeof resource.contents === "string") {
files[resource.filename] = resource.contents
} else {
const contents = await toUint8Array(resource.contents)
files[resource.filename] = new Blob([contents])
}
}
// Convert stdin to string
let stdin = null
if (inData) {
if (typeof inData === "string") {
stdin = inData
} else {
const uint8Array = await toUint8Array(inData)
stdin = new TextDecoder("utf-8").decode(uint8Array)
}
}
// Call convert
const result = await convert(options, stdin, files)
// Convert mediaFiles from Object to Map for legacy API compatibility
const mediaFiles = new Map()
for (const [name, blob] of Object.entries(result.mediaFiles)) {
mediaFiles.set(
name,
convertData(new Uint8Array(await blob.arrayBuffer()))
)
}
// Return in legacy format
let out
if (
options["output-file"] &&
result.files[options["output-file"]]
) {
out = convertData(
new Uint8Array(
await result.files[options["output-file"]].arrayBuffer()
)
)
} else {
out = result.stdout
}
return {
out: out,
mediaFiles: mediaFiles
}
}
// Return the API
return {
convert,
query,
pandoc
}
})
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
+116
View File
@@ -0,0 +1,116 @@
/* Minimal ZIP writer (only "stored", no compression) - no external library
loaded for the zip download, consistent with the principle followed
throughout the project of not pulling in CDN/third-party dependencies
(see the Methoden-Set chapter on the project website). Uncompressed is unproblematic for a
manageable amount of text/image files - correctness over file size. */
(function (global) {
"use strict";
const CRC_TABLE = (function () {
const table = new Uint32Array(256);
for (let n = 0; n < 256; n++) {
let c = n;
for (let k = 0; k < 8; k++) {
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
}
table[n] = c >>> 0;
}
return table;
})();
function crc32(bytes) {
let crc = 0xffffffff;
for (let i = 0; i < bytes.length; i++) {
crc = CRC_TABLE[(crc ^ bytes[i]) & 0xff] ^ (crc >>> 8);
}
return (crc ^ 0xffffffff) >>> 0;
}
function dosDateTime(date) {
const time =
((date.getHours() & 0x1f) << 11) |
((date.getMinutes() & 0x3f) << 5) |
((date.getSeconds() >> 1) & 0x1f);
const dateVal =
(((date.getFullYear() - 1980) & 0x7f) << 9) |
(((date.getMonth() + 1) & 0xf) << 5) |
(date.getDate() & 0x1f);
return { time, date: dateVal };
}
function utf8Bytes(str) {
return new TextEncoder().encode(str);
}
/* entries: Array<{ path: string, data: Uint8Array }> - path with "/" as
the folder separator, relative to the zip root. Returns a Blob. */
function write(entries) {
const now = dosDateTime(new Date());
const chunks = [];
const central = [];
let offset = 0;
for (const entry of entries) {
const nameBytes = utf8Bytes(entry.path);
const data = entry.data;
const crc = crc32(data);
const local = new DataView(new ArrayBuffer(30));
local.setUint32(0, 0x04034b50, true);
local.setUint16(4, 20, true); // Version
local.setUint16(6, 0x0800, true); // Flags: UTF-8 filenames
local.setUint16(8, 0, true); // Method: 0 = stored
local.setUint16(10, now.time, true);
local.setUint16(12, now.date, true);
local.setUint32(14, crc, true);
local.setUint32(18, data.length, true);
local.setUint32(22, data.length, true);
local.setUint16(26, nameBytes.length, true);
local.setUint16(28, 0, true);
chunks.push(new Uint8Array(local.buffer), nameBytes, data);
const centralHeader = new DataView(new ArrayBuffer(46));
centralHeader.setUint32(0, 0x02014b50, true);
centralHeader.setUint16(4, 20, true);
centralHeader.setUint16(6, 20, true);
centralHeader.setUint16(8, 0x0800, true);
centralHeader.setUint16(10, 0, true);
centralHeader.setUint16(12, now.time, true);
centralHeader.setUint16(14, now.date, true);
centralHeader.setUint32(16, crc, true);
centralHeader.setUint32(20, data.length, true);
centralHeader.setUint32(24, data.length, true);
centralHeader.setUint16(28, nameBytes.length, true);
centralHeader.setUint16(30, 0, true);
centralHeader.setUint16(32, 0, true);
centralHeader.setUint16(34, 0, true);
centralHeader.setUint16(36, 0, true);
centralHeader.setUint32(38, 0, true);
centralHeader.setUint32(42, offset, true);
central.push(new Uint8Array(centralHeader.buffer), nameBytes);
offset += 30 + nameBytes.length + data.length;
}
const centralStart = offset;
let centralSize = 0;
for (const part of central) centralSize += part.length;
const end = new DataView(new ArrayBuffer(22));
end.setUint32(0, 0x06054b50, true);
end.setUint16(4, 0, true);
end.setUint16(6, 0, true);
end.setUint16(8, entries.length, true);
end.setUint16(10, entries.length, true);
end.setUint32(12, centralSize, true);
end.setUint32(16, centralStart, true);
end.setUint16(20, 0, true);
return new Blob([...chunks, ...central, new Uint8Array(end.buffer)], {
type: "application/zip"
});
}
global.AblegerZip = { write };
})(window);
+73
View File
@@ -0,0 +1,73 @@
#!/usr/bin/env ruby
# Small, permanently running service for the whole "write" area (/admin/*,
# gated by the "write" oauth2-proxy instance, see
# the installation guide on the project website): normally serves the same static files as its
# former file:// upstream (Decap CMS, admin/status/), AND additionally
# answers the two dynamic endpoints below. A single upstream instead of two
# - oauth2-proxy 7.15.3 did not resolve the multiple, path-distinguished
# upstreams (file:// + http://) via URL fragment in the simple
# "upstreams = [...]" list form as documented (both ended up on path "/",
# "upstream ids must be unique"/"upstream paths must be unique" on start) -
# hence a WEBrick file handler here for the rest instead.
#
# This script itself does not check authorization, that is handled entirely
# by the oauth2-proxy gate in front of it.
#
# STATUS_FILE is written by the deploy hook itself (~/repos/ableger.git/
# hooks/post-receive on the server, not part of this repo - see
# the installation guide on the project website), not by this script.
require 'webrick'
require 'json'
# Small install.env parser instead of a dotenv gem dependency - install.env
# deliberately has a simple KEY="value" format (see there), not YAML.
def load_install_env(pfad)
werte = {}
File.readlines(pfad).each do |zeile|
zeile = zeile.strip
next if zeile.empty? || zeile.start_with?('#')
schluessel, wert = zeile.split('=', 2)
werte[schluessel] = wert.to_s.sub(/\A"/, '').sub(/"\z/, '')
end
werte
end
INSTALL_ENV = load_install_env(File.expand_path('../install.env', __dir__))
STATUS_FILE = File.expand_path('~/deploy/status.json')
# Bare repo name (see the installation guide on the project website, Abschnitt 4) is derived from
# the website repo name, not maintained separately.
HOOK = File.expand_path("~/repos/#{INSTALL_ENV.fetch('WEBSITE_REPO').split('/').last}.git/hooks/post-receive")
DOCROOT = INSTALL_ENV.fetch('DEPLOY_DOCROOT')
PORT = INSTALL_ENV.fetch('STATUS_SERVER_PORT').to_i
def status_body
File.exist?(STATUS_FILE) ? File.read(STATUS_FILE) : { error: 'noch kein Deploy-Status vorhanden' }.to_json
end
server = WEBrick::HTTPServer.new(Port: PORT, BindAddress: '0.0.0.0', DocumentRoot: DOCROOT, Logger: WEBrick::Log.new($stdout), AccessLog: [[$stdout, WEBrick::AccessLog::COMBINED_LOG_FORMAT]])
server.mount_proc '/admin/status/api/data.json' do |req, res|
res['Content-Type'] = 'application/json; charset=utf-8'
res.body = status_body
end
server.mount_proc '/admin/status/api/trigger' do |req, res|
res['Content-Type'] = 'application/json; charset=utf-8'
if req.request_method != 'POST'
res.status = 405
res.body = { error: 'nur POST erlaubt' }.to_json
next
end
# Runs synchronously - the hook itself protects against an already
# running cron/trigger run with a non-blocking flock (see hook script):
# if one is already running, this call aborts immediately with a
# corresponding message in the status instead of waiting or duplicating -
# just click again shortly after.
system(HOOK)
res.body = status_body
end
trap('INT') { server.shutdown }
trap('TERM') { server.shutdown }
server.start
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env ruby
# Translates the form field "veroeffentlicht" (Decap, positive polarity: on
# = published) into Hugo's native draft field (inverted: draft: true =
# unpublished) - only in the local _content copy (not in the content repo),
# before every Hugo build. Decap cannot write a boolean field inverted into
# a differently named frontmatter field, hence this translation step
# instead of a direct CMS mapping. Must run before
# compute-methoden-sichtbarkeit.rb, which in turn reads the draft field set
# here for variants (that script aborts if it still finds untranslated
# "veroeffentlicht" fields, see there).
require_relative 'lib/frontmatter'
root = File.expand_path('..', __dir__)
varianten_dir = File.join(root, '_content', 'varianten')
changed = 0
if Dir.exist?(varianten_dir)
Dir.glob(File.join(varianten_dir, '*', 'index.md')).each do |file|
result = Frontmatter.read(file)
next unless result
fm, body = result
# Missing "veroeffentlicht" (e.g. a variant committed directly via the
# PR path, bypassing Decap's boolean widget with its "default: false")
# must translate to unpublished, not be skipped untranslated - a
# missing "draft" frontmatter key defaults to visible in Hugo, so
# skipping this file entirely would publish it unintentionally.
veroeffentlicht = fm.key?('veroeffentlicht') ? fm.delete('veroeffentlicht') == true : false
fm['draft'] = !veroeffentlicht
Frontmatter.write(file, fm, body, feldreihenfolge: Frontmatter::VARIANTEN_FELDER)
changed += 1
end
end
puts "veroeffentlicht -> draft übersetzt: #{changed} Variante(n)"
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env ruby
# Sets draft: true in the LOCAL copy of every method (_content/methoden/*/index.md)
# whose variants are all still drafts (or has none) - not in the content repo
# itself, only in the working copy freshly fetched on every sync (see sync-methoden.sh).
#
# Methods deliberately no longer have their own draft field
# (admin/config.template.yml): publication is derived from the variants - as
# soon as at least one variant is published, the method is too. This can't
# be modeled as a Decap field (no access to other collections while saving),
# hence this preprocessing step before the Hugo build. Hugo's own draft
# mechanism then reliably takes care of the rest (e.g. automatic exclusion
# from the homepage/search/taxonomies, not just the detail page itself) -
# more robust than rebuilding a custom visibility check in the templates.
#
# Assumes apply-veroeffentlicht.rb has already run (see sync-methoden.sh) -
# otherwise variants would still have "veroeffentlicht" instead of "draft",
# published_methoden would stay empty, and EVERY method would be incorrectly
# marked as draft without anything reporting the error. Hence this safeguard
# here (Befund G/Schritt 6, see the project website (background/analysis notes)): instead of
# silently accepting that, the script aborts loudly as soon as it finds a
# variant with a still-untranslated "veroeffentlicht".
require_relative 'lib/frontmatter'
require 'set'
root = File.expand_path('..', __dir__)
content = File.join(root, '_content')
methoden_dir = File.join(content, 'methoden')
varianten_dir = File.join(content, 'varianten')
published_methoden = Set.new
if Dir.exist?(varianten_dir)
Dir.glob(File.join(varianten_dir, '*', 'index.md')).each do |file|
result = Frontmatter.read(file)
next unless result
fm, = result
if fm.key?('veroeffentlicht')
warn "compute-methoden-sichtbarkeit.rb: #{file} hat noch 'veroeffentlicht' statt 'draft' - apply-veroeffentlicht.rb muss vorher laufen (siehe sync-methoden.sh)"
exit 1
end
next unless fm['draft'] == false
methode = fm['methode']
published_methoden << methode if methode
end
end
changed = 0
Dir.glob(File.join(methoden_dir, '*', 'index.md')).each do |file|
result = Frontmatter.read(file)
next unless result
fm, body = result
kennung = fm['kennung']
should_be_visible = published_methoden.include?(kennung)
# fm['draft'] == true instead of fm.key?('draft'): methods used to have
# their own draft field (since removed, see admin/config.template.yml) -
# so a file may still contain a leftover old "draft: false" value.
# Checking only for the key's presence would incorrectly treat that as
# "currently hidden".
currently_draft = fm['draft'] == true
if should_be_visible == currently_draft
if should_be_visible
fm.delete('draft')
else
fm['draft'] = true
end
Frontmatter.write(file, fm, body, feldreihenfolge: Frontmatter::METHODEN_FELDER)
changed += 1
end
end
puts "Methoden-Sichtbarkeit aktualisiert: #{published_methoden.size} mit veröffentlichter Variante, #{changed} Datei(en) angepasst"
+130
View File
@@ -0,0 +1,130 @@
#!/bin/bash
# Generates admin/config.yml from admin/config.template.yml, AND
# hugo/hugo.toml from hugo/hugo.template.toml (see below) - both share the
# same "{{VARIABLE}}" substitution step, filled from install.env.
#
# admin/config.yml specifically has a second, independent substitution:
# fields between "# VOKABULAR:<field>:START/END" markers are replaced by a
# closed selection list if a vocabulary entry for <field> exists in the
# content repo under _content/ableger.yml - otherwise the block from the
# template stays unchanged (fallback: free text as before). See the
# Manifest chapter on the project website Teil C, vokabular/README.md and
# install.env.
#
# Runs both locally and in deploy (see the installation guide on the
# project website), AFTER sync-methoden.sh (which fetches
# _content/ableger.yml in the first place). Both admin/config.yml and
# hugo/hugo.toml are generated and not versioned (see .gitignore) -
# admin/config.template.yml and hugo/hugo.template.toml are the files to
# maintain.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TEMPLATE="$ROOT/admin/config.template.yml"
OUT="$ROOT/admin/config.yml"
ABLEGER_YML="$ROOT/_content/ableger.yml"
# shellcheck source=/dev/null
source "$ROOT/install.env"
export GITEA_DOMAIN METHODEN_REPO OAUTH_CLIENT_ID WEBSITE_DOMAIN
# hugo.toml only needs the plain "{{VARIABLE}}" substitution, no VOKABULAR
# blocks - a plain sed pass is enough, no need for the Python step below.
HUGO_TEMPLATE="$ROOT/hugo/hugo.template.toml"
HUGO_OUT="$ROOT/hugo/hugo.toml"
sed -e "s|{{GITEA_DOMAIN}}|$GITEA_DOMAIN|g" \
-e "s|{{METHODEN_REPO}}|$METHODEN_REPO|g" \
-e "s|{{WEBSITE_DOMAIN}}|$WEBSITE_DOMAIN|g" \
"$HUGO_TEMPLATE" > "$HUGO_OUT"
echo "hugo.toml generiert: $HUGO_OUT"
# Export the vocabulary from ableger.yml (content repo) into a temporary
# directory with one text file per field (one allowed value per line) - this
# way the rest of the already-proven logic below (Python, reads from text
# files) stays unchanged. Ruby instead of Python for YAML parsing, since
# PyYAML isn't guaranteed to be available here, whereas Ruby's yaml library
# (standard library) is already used elsewhere in the project (see
# scripts/validate.rb).
VOKABULAR="$(mktemp -d)"
trap 'rm -rf "$VOKABULAR"' EXIT
if [ -f "$ABLEGER_YML" ]; then
ruby -ryaml -e '
daten = YAML.load_file(ARGV[0]) || {}
vokabular = daten["vokabular"] || {}
vokabular.each do |feld, werte|
File.write(File.join(ARGV[1], "#{feld}.txt"), Array(werte).join("\n") + "\n")
end
' "$ABLEGER_YML" "$VOKABULAR"
fi
python3 - "$TEMPLATE" "$OUT" "$VOKABULAR" <<'PYEOF'
import os
import re
import sys
from pathlib import Path
template_path, out_path, vokabular_dir = sys.argv[1:4]
text = Path(template_path).read_text()
vokabular_dir = Path(vokabular_dir)
# Always replace "{{VARIABLE}}" placeholders (see install.env), independent
# of the VOKABULAR mechanism below - no fallback logic needed, install.env
# (unlike _content/ableger.yml) is always versioned in this repo.
for feld in ("GITEA_DOMAIN", "METHODEN_REPO", "OAUTH_CLIENT_ID", "WEBSITE_DOMAIN"):
text = text.replace("{{" + feld + "}}", os.environ[feld])
def render_field(feld, indent, values):
lines = [f'{indent}- label: "{feld_labels.get(feld, feld)}"',
f'{indent} name: "{feld}"',
f'{indent} widget: "select"']
# ONLY multi_fields determines multi-select - "more than one option to
# choose from" (len(values) > 1) is not the same as "multiple values
# selectable at once" and must not be conflated. Found live: "lizenz"
# has 3 options, but exactly ONE applies per entry - the earlier
# condition "len(values) > 1 or feld in multi_fields" incorrectly set
# multiple: true as soon as a second vocabulary value was added. Decap
# then stored lizenz as a list ("- CC0") instead of a plain string as
# soon as someone made a selection in the CMS - unnoticed until a value
# was actually changed.
if feld in multi_fields:
lines.append(f'{indent} multiple: true')
lines.append(f'{indent} options:')
for wert in values:
lines.append(f'{indent} - "{wert}"')
return "\n".join(lines)
feld_labels = {
"zielgruppe": "Zielgruppe",
"kategorie": "Kategorie",
"lizenz": "Lizenz",
"tags": "Tags",
}
multi_fields = {"zielgruppe", "kategorie", "tags"}
def replace_block(match):
feld = match.group("feld")
indent = match.group("indent")
vokabular_file = vokabular_dir / f"{feld}.txt"
start = match.group("start")
end = match.group("end")
if not vokabular_file.exists():
return match.group(0)
values = [line.strip() for line in vokabular_file.read_text().splitlines() if line.strip()]
if not values:
return match.group(0)
block = render_field(feld, indent, values)
return f"{indent}{start}\n{block}\n{indent}{end}"
pattern = re.compile(
r'(?P<indent>[ \t]*)(?P<start># VOKABULAR:(?P<feld>\w+):START)\n'
r'.*?\n'
r'[ \t]*(?P<end># VOKABULAR:(?P=feld):END)',
re.DOTALL,
)
result = pattern.sub(replace_block, text)
Path(out_path).write_text(result)
PYEOF
echo "config.yml generiert: $OUT"
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
# Generates hugo/data/methoden.json and hugo/data/varianten.json: creation
# and last-modified date per method/variant, determined from the git
# history of _content/.
#
# Hugo's enableGitInfo/.GitInfo only looks for git history in the repo that
# contains the Hugo page root (ableger_demo/ableger) - but _content/ is a
# separate git repo (ableger_demo/ableger_methoden) mounted via
# module.mounts and is not recognized there (.GitInfo stays nil, no error,
# just silently empty). This has affected "last modified" ever since the
# repo split, unnoticed, because Hugo doesn't warn about it.
# For "created" there would be no Hugo-native equivalent anyway, see
# https://github.com/gohugoio/hugo/issues/11810 (open).
#
# So both dates are read here uniformly from git history ourselves, instead
# of relying on .GitInfo. Recomputed fresh on every sync rather than
# maintained (see sync-methoden.sh, which calls this script automatically) -
# no manual date field, git stays the single source of truth.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
CONTENT_REPO="$ROOT/_content"
dates_for_path() {
local relpath="$1"
local history erstellt geaendert
# One "git log --follow" call instead of two: with the full (not -1)
# history for this path, the first line (newest) is "geaendert" and the
# last line (oldest, following through renames) is "erstellt" - no need
# for a second, separately filtered/unfollowed call to get either.
history="$(git -C "$CONTENT_REPO" log --follow --format=%aI -- "$relpath")"
geaendert="$(echo "$history" | head -1)"
erstellt="$(echo "$history" | tail -1)"
[ -n "$erstellt" ] && [ -n "$geaendert" ] || return 1
jq -n --arg erstellt "$erstellt" --arg geaendert "$geaendert" '{erstellt: $erstellt, geaendert: $geaendert}'
}
# Both methods and variants are one folder per entry with content in
# index.md (Hugo page bundle) - variants ever since attachments moved from
# the method to the respective variant, see admin/config.template.yml.
generate_bundle_dates() {
local name="$1"
local dir="$CONTENT_REPO/$name"
local out="$ROOT/hugo/data/$name.json"
mkdir -p "$(dirname "$out")"
local entries="{}"
if [ -d "$dir" ]; then
for entry_dir in "$dir"/*/; do
local slug
slug="$(basename "$entry_dir")"
[ -f "$entry_dir/index.md" ] || continue
local dates
dates="$(dates_for_path "$name/$slug/index.md")" || continue
entries="$(echo "$entries" | jq --arg slug "$slug" --argjson dates "$dates" '. + {($slug): $dates}')"
done
fi
echo "$entries" > "$out"
echo "$name.json aktualisiert: $(echo "$entries" | jq 'length') Einträge"
}
generate_bundle_dates "methoden"
generate_bundle_dates "varianten"
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# Generates hugo/data/website.json: the current commit (short hash + date)
# of THIS website/CMS-code repo itself - shown in the footer next to the
# Manifest version (see baseof.html) so an installation can tell at a
# glance which code state it's actually running, independent of whether
# it's still identical to the template or has since been developed further
# on its own. Deliberately NOT a frozen "forked from template version X"
# marker - once a fork's own commits land, this reflects those, not the
# template's history.
#
# Unlike hugo/data/methoden.json/varianten.json (generate-dates.sh), this
# reads the website repo's own git history directly - no separate
# module.mounts repo involved, Hugo's enableGitInfo/.GitInfo would actually
# work here, but a plain "git log" call keeps this consistent with the
# same approach already used for methoden/varianten dates.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
OUT="$ROOT/hugo/data/website.json"
mkdir -p "$(dirname "$OUT")"
commit="$(git -C "$ROOT" rev-parse --short HEAD)"
datum="$(git -C "$ROOT" log -1 --format=%aI)"
jq -n --arg commit "$commit" --arg datum "$datum" '{commit: $commit, datum: $datum}' > "$OUT"
echo "website.json aktualisiert: $commit ($datum)"
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env ruby
# Generates vorlagen-manifest.json in the given templates folder - lists all
# .docx/.odt files found there so the methoden-set tool (methoden-set/, see
# the Methoden-Set chapter on the project website) can offer them automatically as template choices,
# including files someone copied manually straight onto the server (not
# just the ones from this repo). Runs in the deploy hook AFTER the rsync of
# methoden-set/ into the docroot (see the installation guide on the project website) and
# therefore deliberately scans the docroot itself, not the git worktree -
# rsync runs there without --delete, so manually added files survive
# across deploys and show up here too.
require 'json'
verzeichnis = ARGV[0] or abort "Verwendung: #{$0} <vorlagen-verzeichnis>"
dateien = Dir.glob(File.join(verzeichnis, '*.{docx,odt}')).map { |pfad| File.basename(pfad) }.sort
# Derive the label from the filename (without extension, hyphens/
# underscores turned into spaces, each word capitalized) - no additional
# metadata field to maintain, the filename itself is the only source.
eintraege = dateien.map do |datei|
format = File.extname(datei).delete_prefix('.')
name = File.basename(datei, '.*')
label = name.gsub(/[-_]+/, ' ').strip.split(' ').map { |w| w.empty? ? w : w[0].upcase + w[1..] }.join(' ')
{ 'datei' => datei, 'format' => format, 'label' => label }
end
File.write(File.join(verzeichnis, 'vorlagen-manifest.json'), JSON.pretty_generate(eintraege))
puts "vorlagen-manifest.json geschrieben: #{eintraege.length} Vorlage(n)"
+59
View File
@@ -0,0 +1,59 @@
# Shared helpers for reading/writing YAML frontmatter in method and variant
# files - previously each script (validate.rb, apply-veroeffentlicht.rb,
# compute-methoden-sichtbarkeit.rb) had its own copy of
# read_frontmatter/write_frontmatter.
#
# More important than the duplication itself: a fixed field order when
# writing (Befund G, see the project website (background/analysis notes) Teil 5, Schritt 6).
# Ruby hashes preserve insertion order - a field that was deleted and
# re-set (e.g. "draft" after fm.delete/fm[]=) used to move to the end,
# creating unnecessary diff noise. Fields outside the canonical order are
# not discarded but appended at the end unchanged (in their previous
# order) - a script that doesn't know a field should still not silently
# lose it.
require 'yaml'
require 'date'
module Frontmatter
# Order per the Manifest chapter on the project website Teil C (field catalog), "draft" added: a
# derived field that never appears in the content repo (see Regel 12),
# only in the local copy translated for Hugo (see compute-methoden-
# sichtbarkeit.rb).
METHODEN_FELDER = %w[
kennung titel kurzbeschreibung verwendungsmoeglichkeit zielgruppe
kompetenzbereich kategorie tags lernchancen herkunft initiatoren draft
].freeze
# "draft" replaces "veroeffentlicht" at the same position in the local
# copy translated for Hugo (see apply-veroeffentlicht.rb) - the two sit
# next to each other in the canonical order, but only one of them ever
# appears in a given committed resp. translated file.
VARIANTEN_FELDER = %w[
kennung methode untertitel varianten_beschreibung veroeffentlicht draft dauer_minuten
gruppengroesse_min gruppengroesse_max material autoren lizenz quellen
anhaenge
].freeze
def self.read(path)
parse(File.read(path, encoding: 'UTF-8'))
end
# Same split+parse as read(), but for text already in memory (e.g. from
# `git show`) instead of a file on disk - see scripts/validate.rb,
# vorherige_kennung.
def self.parse(text)
return nil unless text.start_with?("---\n")
parts = text.split(/^---\s*$/, 3)
return nil unless parts.length == 3
fm = YAML.safe_load(parts[1], permitted_classes: [Date, Time]) || {}
[fm, parts[2]]
end
def self.write(path, fm, body, feldreihenfolge:)
geordnet = {}
feldreihenfolge.each { |feld| geordnet[feld] = fm[feld] if fm.key?(feld) }
(fm.keys - feldreihenfolge).each { |feld| geordnet[feld] = fm[feld] }
yaml = YAML.dump(geordnet).sub(/\A---\n/, '')
File.write(path, "---\n#{yaml}---#{body}", encoding: 'UTF-8')
end
end
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
# Fetches the current state of the separate methods repo
# (ableger_demo/ableger_methoden) into ./_content - for local development and
# in the deploy hook on Uberspace. _content/ is deliberately not part of this
# repo (see .gitignore) and is freshly fetched here on every call instead of
# being pinned as a submodule. Hugo mounts _content/methoden (see
# hugo/hugo.toml) - the content repo itself contains a methoden/ subfolder,
# not just the methods directly at its root (Decap CMS workaround, see
# admin/config.yml).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=/dev/null
source "$ROOT/install.env"
# ABLEGER_METHODEN_URL completely overrides this fallback in the deploy hook
# (a local filesystem path on the same Uberspace account, see
# the installation guide on the project website) - the SSH fallback built here from install.env is
# only needed for local development without that environment variable set.
REPO_URL="${ABLEGER_METHODEN_URL:-ssh://${GITEA_SSH_USER}@${GITEA_DOMAIN}:${GITEA_SSH_PORT}/${METHODEN_REPO}.git}"
TARGET="$ROOT/_content"
if [ -d "$TARGET/.git" ]; then
# "remote set-url" ALWAYS before the fetch, not only on first clone: an
# already existing worktree otherwise keeps the remote URL from its
# original clone time, even if REPO_URL has changed since (e.g. after a
# repo rename/transfer to a different organization). This broke live
# exactly this way: after transferring ableger_methoden to the
# "ableger_demo" organization, the worktree already present on the server
# kept pointing at the old path (tobias/ableger_methoden.git), and the
# cron job then failed on every run (every 10 minutes) until this was
# fixed manually.
git -C "$TARGET" remote set-url origin "$REPO_URL"
git -C "$TARGET" fetch origin main
git -C "$TARGET" reset --hard origin/main
else
rm -rf "$TARGET"
git clone "$REPO_URL" "$TARGET"
fi
echo "_content/ aktuell: $(git -C "$TARGET" rev-parse --short HEAD)"
# Validate against the Manifest chapter on the project website (website repo) BEFORE
# apply-veroeffentlicht.rb and compute-methoden-sichtbarkeit.rb translate the
# state for Hugo - the validation script needs the real, committed state
# (with "veroeffentlicht", without Hugo's "draft"), otherwise its own rules
# (e.g. Regel 12: no derived fields stored) could never be satisfiable
# against its own translation. set -e above ensures that an error (exit
# code 1) here aborts the entire sync/build before a broken reference or
# similar goes live unnoticed (see the project website (background/analysis notes), Befund A/B) -
# warnings (exit code 0) deliberately do not block.
ruby "$(dirname "${BASH_SOURCE[0]}")/validate.rb"
# Recompute creation dates from the freshly fetched history.
"$(dirname "${BASH_SOURCE[0]}")/generate-dates.sh"
# Translate the variants' "veroeffentlicht" field (positive polarity) into
# Hugo's native draft field - must run before compute-methoden-
# sichtbarkeit.rb, which reads that draft field. See
# admin/config.template.yml and the script's own comments.
ruby "$(dirname "${BASH_SOURCE[0]}")/apply-veroeffentlicht.rb"
# Mark methods without a published variant as draft, locally (not in the
# content repo) - see admin/config.template.yml and the script's own comment.
ruby "$(dirname "${BASH_SOURCE[0]}")/compute-methoden-sichtbarkeit.rb"
+299
View File
@@ -0,0 +1,299 @@
#!/usr/bin/env ruby
# Validates _content/ against the rules from the Manifest chapter on the project website, Teil D. Runs
# BEFORE apply-veroeffentlicht.rb and compute-methoden-sichtbarkeit.rb (see
# sync-methoden.sh) - so it checks the real, committed state in the content
# repo (with "veroeffentlicht", without Hugo's translated "draft"), not the
# copy translated for the Hugo build.
#
# Two severity levels:
# FEHLER (error) - structural (broken reference, duplicate/changed
# kennung, wrong folder name) - aborts the run with exit code
# 1; the deploy hook (sync-methoden.sh) must treat this as a
# build stop, otherwise e.g. a method with a broken variant
# reference could go live unnoticed (see the project website,
# background/analysis notes, Befund A - exactly this class of error).
# WARNUNG (warning) - content-related (missing required field, vocabulary
# violation) - is reported but does not block: a single
# incomplete entry shouldn't take down the whole site.
#
# Deliberately NO rule "a method needs at least one variant" - a normal
# in-progress state while creating an entry, not a violation (see Manifest
# Teil D).
#
# The required-field list below still duplicates admin/config.template.yml
# (website repo) - the vocabulary (Regel 9) has read from ableger.yml
# (content repo) since Schritt 5 (see the project website (background/analysis notes), Befund C),
# but the required-field list itself stays hardcoded here for now.
require_relative 'lib/frontmatter'
require 'set'
root = File.expand_path('..', __dir__)
content = File.join(root, '_content')
methoden_dir = File.join(content, 'methoden')
varianten_dir = File.join(content, 'varianten')
fehler = []
warnungen = []
def read_frontmatter(path)
Frontmatter.read(path)
rescue Psych::SyntaxError => e
[{ '__parse_error__' => e.message }, '']
end
def kennung_pattern
# Underscore allowed (e.g. "sinnesparcours-fur-senior_innen" - our
# gender-inclusive spelling "Senior_innen"), otherwise identical to the
# pattern in admin/config.template.yml.
/\A[a-z0-9_]+(-[a-z0-9_]+)*\z/
end
# Reads the previous kennung of the same file from git history (the prior
# commit touching this path) - not the very first commit, since "kennung"
# was introduced later and older commits don't know the field yet (no
# comparison possible, no false positive wanted).
def vorherige_kennung(rel_path, content_dir)
# --follow is crucial here: when the kennung changes, the folder is
# usually renamed along with it (Decap does this automatically, since
# the folder name is derived from the kennung - see slug in
# admin/config.template.yml). Without --follow, "git log -- <path>" stops
# right at that rename and only finds the one new commit - the actual
# violation would go undetected. Verified live against our own test case
# (git mv + kennung changed, without --follow: no warning).
# --name-only together with --follow, to get the historical path of the
# commit under which "git show" needs to read the content.
# Output format is "<hash>\n\n<path>" per commit, WITHOUT a blank line
# between <path> and the next <hash> - so split flatly by lines and read
# in pairs (hash, path, hash, path, ...), not block-wise by blank lines
# (verified live, initially produced mismatched pairs).
zeilen = `cd #{content_dir} && git log --follow --format=%H --name-only -- #{rel_path}`.split("\n").reject(&:empty?)
return nil if zeilen.length < 4
voriger_hash, voriger_pfad = zeilen[2], zeilen[3]
vorheriger_inhalt = `cd #{content_dir} && git show #{voriger_hash}:#{voriger_pfad} 2>/dev/null`.force_encoding('UTF-8')
return nil if vorheriger_inhalt.empty?
result = Frontmatter.parse(vorheriger_inhalt)
return nil unless result
fm, = result
fm['kennung']
rescue StandardError
nil
end
def vokabular(daten, name)
werte = (daten['vokabular'] || {})[name]
werte && Array(werte)
end
methoden_pflichtfelder = %w[kennung titel kurzbeschreibung verwendungsmoeglichkeit zielgruppe kompetenzbereich kategorie lernchancen initiatoren]
varianten_pflichtfelder = %w[veroeffentlicht methode kennung untertitel varianten_beschreibung dauer_minuten gruppengroesse_min gruppengroesse_max material lizenz autoren]
# --- Regel 14: protokoll_version, also the source of the vocabulary (Regel 9) ---
ableger_yml = File.join(content, 'ableger.yml')
ableger_daten = {}
if File.exist?(ableger_yml)
ableger_daten = YAML.load_file(ableger_yml) || {}
version = ableger_daten['protokoll_version']
fehler << "ableger.yml: protokoll_version fehlt" unless version
fehler << "ableger.yml: protokoll_version #{version.inspect} wird von diesem Skript nicht unterstützt (bekannt: 1)" if version && version != 1
else
fehler << "ableger.yml fehlt an der Repo-Wurzel (Regel 14)"
end
# --- Read methods ---
methoden_kennungen = Set.new
methoden_by_kennung = {}
Dir.glob(File.join(methoden_dir, '*')).select { |d| File.directory?(d) }.each do |dir|
ordner = File.basename(dir)
index = File.join(dir, 'index.md')
# Regel 7
unless File.exist?(index)
fehler << "methoden/#{ordner}/: kein index.md gefunden (Regel 7)"
next
end
fm, body = read_frontmatter(index)
if fm.nil? || fm.key?('__parse_error__')
fehler << "methoden/#{ordner}/index.md: YAML-Frontmatter ungültig#{fm ? " (#{fm['__parse_error__']})" : ''}"
next
end
kennung = fm['kennung']
rel_path = "methoden/#{ordner}/index.md"
# Regel 5
if kennung && !kennung_pattern.match?(kennung)
fehler << "#{rel_path}: kennung #{kennung.inspect} passt nicht zum Muster a-z/0-9/- (Regel 5)"
end
# Regel 3
if kennung && kennung != ordner
fehler << "#{rel_path}: Ordnername '#{ordner}' entspricht nicht der Kennung '#{kennung}' (Regel 3)"
end
# Regel 2 (method kennungen unique)
if kennung
if methoden_kennungen.include?(kennung)
fehler << "#{rel_path}: Kennung '#{kennung}' ist nicht eindeutig (Regel 2)"
end
methoden_kennungen << kennung
methoden_by_kennung[kennung] = fm
end
# Regel 6 (immutability)
if kennung
vorher = vorherige_kennung(rel_path, content)
if vorher && vorher != kennung
fehler << "#{rel_path}: Kennung wurde von '#{vorher}' zu '#{kennung}' geändert (Regel 6)"
end
end
# Regel 11 (document body empty)
unless body.strip.empty?
warnungen << "#{rel_path}: Dokumentkörper ist nicht leer, gehört bei Methoden aber zur Variante (Regel 11)"
end
# Regel 12 (no derived fields)
%w[draft dauer_minuten gruppengroesse_min gruppengroesse_max material lizenz erstellt geaendert].each do |feld|
warnungen << "#{rel_path}: enthält abgeleitetes/verschobenes Feld '#{feld}', gehört nicht (mehr) zur Methode (Regel 12)" if fm.key?(feld)
end
# Regel 8 (required fields)
methoden_pflichtfelder.each do |feld|
wert = fm[feld]
leer = wert.nil? || (wert.respond_to?(:empty?) && wert.empty?)
warnungen << "#{rel_path}: Pflichtfeld '#{feld}' fehlt oder ist leer (Regel 8)" if leer
end
# Regel 9 (vocabulary)
# lizenz has not been a method field since the field move, see below under variants.
{ 'zielgruppe' => vokabular(ableger_daten, 'zielgruppe'), 'kompetenzbereich' => vokabular(ableger_daten, 'kompetenzbereich') }.each do |feld, erlaubt|
next unless erlaubt
werte = Array(fm[feld])
werte.each do |w|
warnungen << "#{rel_path}: Wert '#{w}' bei '#{feld}' steht nicht im Vokabular (Regel 9)" unless erlaubt.include?(w)
end
end
end
# --- Read variants ---
varianten_kennungen_je_methode = Hash.new { |h, k| h[k] = Set.new }
Dir.glob(File.join(varianten_dir, '*')).select { |d| File.directory?(d) }.each do |dir|
ordner = File.basename(dir)
index = File.join(dir, 'index.md')
unless File.exist?(index)
fehler << "varianten/#{ordner}/: kein index.md gefunden (Regel 7)"
next
end
fm, _body = read_frontmatter(index)
if fm.nil? || fm.key?('__parse_error__')
fehler << "varianten/#{ordner}/index.md: YAML-Frontmatter ungültig#{fm ? " (#{fm['__parse_error__']})" : ''}"
next
end
rel_path = "varianten/#{ordner}/index.md"
methode_kennung = fm['methode']
eigene_kennung = fm['kennung']
# Regel 1
if methode_kennung.nil? || !methoden_kennungen.include?(methode_kennung)
fehler << "#{rel_path}: methode '#{methode_kennung.inspect}' verweist auf keine existierende Methoden-Kennung (Regel 1)"
end
# Regel 5
if eigene_kennung && !kennung_pattern.match?(eigene_kennung)
fehler << "#{rel_path}: kennung #{eigene_kennung.inspect} passt nicht zum Muster a-z/0-9/- (Regel 5)"
end
# Regel 4
erwarteter_ordner = "#{methode_kennung}--#{eigene_kennung}"
if methode_kennung && eigene_kennung && ordner != erwarteter_ordner
fehler << "#{rel_path}: Ordnername '#{ordner}' entspricht nicht '<methode>--<kennung>' ('#{erwarteter_ordner}') (Regel 4)"
end
# Regel 2 (variant kennungen unique per method)
if methode_kennung && eigene_kennung
if varianten_kennungen_je_methode[methode_kennung].include?(eigene_kennung)
fehler << "#{rel_path}: Kennung '#{eigene_kennung}' ist bei Methode '#{methode_kennung}' nicht eindeutig (Regel 2)"
end
varianten_kennungen_je_methode[methode_kennung] << eigene_kennung
end
# Regel 6 (immutability)
if eigene_kennung
vorher = vorherige_kennung(rel_path, content)
if vorher && vorher != eigene_kennung
fehler << "#{rel_path}: Kennung wurde von '#{vorher}' zu '#{eigene_kennung}' geändert (Regel 6)"
end
end
# Regel 12 (no derived fields)
%w[draft erstellt geaendert].each do |feld|
warnungen << "#{rel_path}: enthält abgeleitetes Feld '#{feld}' - das übernimmt apply-veroeffentlicht.rb/generate-dates.sh selbst (Regel 12)" if fm.key?(feld)
end
# Regel 8 (required fields)
varianten_pflichtfelder.each do |feld|
wert = fm[feld]
leer = wert.nil? || (wert.respond_to?(:empty?) && wert.empty?) || (feld == 'veroeffentlicht' && wert.nil?)
warnungen << "#{rel_path}: Pflichtfeld '#{feld}' fehlt oder ist leer (Regel 8)" if leer && feld != 'veroeffentlicht'
end
# Regel 10
gmin, gmax = fm['gruppengroesse_min'], fm['gruppengroesse_max']
if gmin && gmax && gmin > gmax
fehler << "#{rel_path}: gruppengroesse_min (#{gmin}) > gruppengroesse_max (#{gmax}) (Regel 10)"
end
# lizenz must be a plain string, not a list - found live: a bug in
# generate-config.sh (website repo) incorrectly set multiple: true for
# "lizenz" as soon as the vocabulary had more than one value. Decap then
# saved e.g. "- CC0" instead of "CC0" as soon as someone made a selection
# in the CMS. This type error is structural (Regel 8 wouldn't recognize
# it as "empty" at all, since a non-empty list is not an empty value) and
# is therefore handled separately here as an ERROR, not as a vocabulary
# warning.
if fm['lizenz'].is_a?(Array)
fehler << "#{rel_path}: 'lizenz' ist eine Liste (#{fm['lizenz'].inspect}) statt eines einzelnen Werts - Formularfehler beim Speichern, siehe scripts/generate-config.sh"
else
# Regel 9 (vocabulary)
erlaubt = vokabular(ableger_daten, 'lizenz')
if erlaubt && fm['lizenz']
warnungen << "#{rel_path}: Wert '#{fm['lizenz']}' bei 'lizenz' steht nicht im Vokabular (Regel 9)" unless erlaubt.include?(fm['lizenz'])
end
end
# Regel 13 (attachments exist)
Array(fm['anhaenge']).each do |anhang|
next unless anhang.is_a?(Hash) && anhang['datei']
pfad = File.join(dir, anhang['datei'])
fehler << "#{rel_path}: Anhang '#{anhang['datei']}' existiert nicht im selben Ordner (Regel 13)" unless File.exist?(pfad)
end
end
# --- Ausgabe ---
unless warnungen.empty?
puts "Warnungen (#{warnungen.size}):"
warnungen.each { |w| puts " ⚠ #{w}" }
puts
end
unless fehler.empty?
puts "Fehler (#{fehler.size}):"
fehler.each { |f| puts " ✗ #{f}" }
puts
end
if fehler.empty?
puts "Prüfung bestanden#{warnungen.empty? ? '' : " (#{warnungen.size} Warnung(en))"}."
exit 0
else
puts "Prüfung fehlgeschlagen: #{fehler.size} Fehler."
exit 1
end
+12
View File
@@ -0,0 +1,12 @@
# Vokabular
Das Vokabular (erlaubte Werte für `zielgruppe`, `kompetenzbereich`, `lizenz`) liegt nicht hier, sondern im Content-Repo unter `_content/ableger.yml` (Schlüssel `vokabular`) – siehe das Manifest-Kapitel auf der Projekt-Website, Teil C. Grund: Ein Manifest, dessen Vokabular nur beim Website-Code liegt, teilt das Schicksal der Software, von der es unabhängig sein soll; Repo-Trennung ist für Zugriffsschutz ohnehin das falsche Werkzeug (die eigentliche Vertrauensfrage – wer CMS-Zugang bekommt – ist bewusst eine Prozessfrage außerhalb der Software, siehe `CLAUDE.md`).
Zwei Verbraucher lesen von dort:
- `scripts/validate.rb` (Regel 9) prüft Feldwerte dagegen.
- `scripts/generate-config.sh` baut daraus die geschlossenen Auswahllisten in `admin/config.yml` (exportiert das Vokabular zur Laufzeit in ein temporäres Verzeichnis, damit die Textdatei-Logik dort unverändert bleiben konnte).
`kategorie` und `tags` haben weiterhin bewusst kein Vokabular und bleiben offen – keinen Eintrag dafür in `ableger.yml` ergänzen, ohne das vorher zur Diskussion zu stellen (siehe `CLAUDE.md`).
Dieses Verzeichnis existiert nur noch für diese Erklärung.