Merge pull request 'Feature/aenderungshistorie' (#3) from feature/aenderungshistorie into main
Reviewed-on: #3
This commit is contained in:
+6
-1
@@ -13,10 +13,15 @@ hugo/.hugo_build.lock
|
|||||||
/_content/
|
/_content/
|
||||||
|
|
||||||
# Creation/modification dates, computed from the git history of _content/
|
# Creation/modification dates, computed from the git history of _content/
|
||||||
# instead of maintained, see scripts/generate-dates.sh
|
# instead of maintained, see scripts/generate-verlauf.rb
|
||||||
/hugo/data/methoden.json
|
/hugo/data/methoden.json
|
||||||
/hugo/data/varianten.json
|
/hugo/data/varianten.json
|
||||||
|
|
||||||
|
# Marks the _content/ HEAD commit the two files above were last computed
|
||||||
|
# from, so generate-verlauf.rb can skip recomputing them when nothing
|
||||||
|
# changed - see the script's own comments.
|
||||||
|
/hugo/data/verlauf-cache.json
|
||||||
|
|
||||||
# Current commit of this repo itself, computed at deploy/build time - see
|
# Current commit of this repo itself, computed at deploy/build time - see
|
||||||
# scripts/generate-version-info.sh
|
# scripts/generate-version-info.sh
|
||||||
/hugo/data/website.json
|
/hugo/data/website.json
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
title: "Änderungsverlauf"
|
||||||
|
---
|
||||||
@@ -181,11 +181,13 @@
|
|||||||
{{ with .Site.Params.datenschutz_url }}<li><a href="{{ . }}">Datenschutz</a></li>{{ else }}<li><span class="site-footer__placeholder" title="Folgt">Datenschutz</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/" | relURL }}">Redaktion</a></li>
|
||||||
<li><a href="{{ "/admin/status/" | relURL }}">Status</a></li>
|
<li><a href="{{ "/admin/status/" | relURL }}">Status</a></li>
|
||||||
|
<li><a href="{{ "/aenderungen/" | relURL }}">Änderungsverlauf</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="{{ "js/filter.js" | relURL }}" defer></script>
|
<script src="{{ "js/filter.js" | relURL }}" defer></script>
|
||||||
|
<script src="{{ "js/aenderungen.js" | relURL }}" defer></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -36,5 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ partial "aenderungshistorie.html" . }}
|
||||||
</article>
|
</article>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
{{ define "main" }}
|
||||||
|
{{/* One row per raw change event (methods and variants both contribute
|
||||||
|
their own, un-merged verlauf entries here - unlike
|
||||||
|
partials/aenderungshistorie.html on individual method pages, this page
|
||||||
|
deliberately does NOT fold a method's variants into its own rows, see
|
||||||
|
the plan discussion: "jede Änderung eine Textzeile" across the whole
|
||||||
|
site). Zielgruppe/Kompetenzbereich/Kategorie/Tags live on the method,
|
||||||
|
not the variant (see the Manifest field catalog) - a variant's row
|
||||||
|
therefore borrows these from its owning method via
|
||||||
|
methode-fuer-variante.html, same as steckbrief-box.html does. */}}
|
||||||
|
{{ $zeilen := slice }}
|
||||||
|
|
||||||
|
{{ range where site.RegularPages "Section" "" }}
|
||||||
|
{{ $seite := . }}
|
||||||
|
{{ $spanne := partialCached "variantenspanne.html" $seite $seite.RelPermalink }}
|
||||||
|
{{ $titelHTML := printf "<a href=%q>%s</a>" $seite.RelPermalink ($seite.Params.titel | default $seite.Title) }}
|
||||||
|
{{ with index hugo.Data.methoden $seite.File.ContentBaseName }}
|
||||||
|
{{ range .verlauf }}
|
||||||
|
{{ $zeilen = $zeilen | append (dict
|
||||||
|
"eintrag" . "titelHTML" $titelHTML
|
||||||
|
"zielgruppe" ($seite.Params.zielgruppe | default slice)
|
||||||
|
"kompetenzbereich" ($seite.Params.kompetenzbereich | default slice)
|
||||||
|
"kategorie" ($seite.Params.kategorie | default slice)
|
||||||
|
"tags" ($seite.Params.tags | default slice)
|
||||||
|
"lizenz" $spanne.lizenzen
|
||||||
|
"dauerMin" $spanne.dauerMin "dauerMax" $spanne.dauerMax "dauerSeen" $spanne.dauerSeen
|
||||||
|
"groesseMin" $spanne.groesseMin "groesseMax" $spanne.groesseMax "groesseSeen" $spanne.groesseSeen
|
||||||
|
) }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ range where site.RegularPages "Section" "varianten" }}
|
||||||
|
{{ $variante := . }}
|
||||||
|
{{ $methode := partial "methode-fuer-variante.html" $variante }}
|
||||||
|
{{ $label := $variante.Params.untertitel | default $variante.Title }}
|
||||||
|
{{ $zielgruppe := slice }}{{ $kompetenzbereich := slice }}{{ $kategorie := slice }}{{ $tags := slice }}
|
||||||
|
{{ with $methode }}
|
||||||
|
{{ $label = printf "%s – %s" (.Params.titel | default .Title) $label }}
|
||||||
|
{{ $zielgruppe = .Params.zielgruppe | default slice }}
|
||||||
|
{{ $kompetenzbereich = .Params.kompetenzbereich | default slice }}
|
||||||
|
{{ $kategorie = .Params.kategorie | default slice }}
|
||||||
|
{{ $tags = .Params.tags | default slice }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $titelHTML := printf "<a href=%q>%s</a>" $variante.RelPermalink $label }}
|
||||||
|
{{ $dauerSeen := isset $variante.Params "dauer_minuten" }}
|
||||||
|
{{ $groesseSeen := isset $variante.Params "gruppengroesse_min" }}
|
||||||
|
{{ $lizenz := slice }}{{ with $variante.Params.lizenz }}{{ $lizenz = slice . }}{{ end }}
|
||||||
|
{{ with index hugo.Data.varianten $variante.File.ContentBaseName }}
|
||||||
|
{{ range .verlauf }}
|
||||||
|
{{ $zeilen = $zeilen | append (dict
|
||||||
|
"eintrag" . "titelHTML" $titelHTML
|
||||||
|
"zielgruppe" $zielgruppe "kompetenzbereich" $kompetenzbereich "kategorie" $kategorie "tags" $tags
|
||||||
|
"lizenz" $lizenz
|
||||||
|
"dauerMin" $variante.Params.dauer_minuten "dauerMax" $variante.Params.dauer_minuten "dauerSeen" $dauerSeen
|
||||||
|
"groesseMin" $variante.Params.gruppengroesse_min "groesseMax" $variante.Params.gruppengroesse_max "groesseSeen" $groesseSeen
|
||||||
|
) }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $zeilen = sort $zeilen "eintrag.datum" "desc" }}
|
||||||
|
|
||||||
|
{{/* Bounds for the filter panel, same aggregation idea as index.html
|
||||||
|
(there per method, here across all rows already collected above). */}}
|
||||||
|
{{ $lizenzen := slice }}
|
||||||
|
{{ $dauerMin := 0 }}{{ $dauerMax := 0 }}{{ $dauerSeen := false }}
|
||||||
|
{{ $groesseMin := 0 }}{{ $groesseMax := 0 }}{{ $groesseSeen := false }}
|
||||||
|
{{ range $zeilen }}
|
||||||
|
{{ $lizenzen = $lizenzen | append .lizenz }}
|
||||||
|
{{ if .dauerSeen }}
|
||||||
|
{{ if $dauerSeen }}
|
||||||
|
{{ if lt .dauerMin $dauerMin }}{{ $dauerMin = .dauerMin }}{{ end }}
|
||||||
|
{{ if gt .dauerMax $dauerMax }}{{ $dauerMax = .dauerMax }}{{ end }}
|
||||||
|
{{ else }}{{ $dauerMin = .dauerMin }}{{ $dauerMax = .dauerMax }}{{ $dauerSeen = true }}{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if .groesseSeen }}
|
||||||
|
{{ if $groesseSeen }}
|
||||||
|
{{ if lt .groesseMin $groesseMin }}{{ $groesseMin = .groesseMin }}{{ end }}
|
||||||
|
{{ if gt .groesseMax $groesseMax }}{{ $groesseMax = .groesseMax }}{{ end }}
|
||||||
|
{{ else }}{{ $groesseMin = .groesseMin }}{{ $groesseMax = .groesseMax }}{{ $groesseSeen = true }}{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $lizenzen = $lizenzen | uniq | sort }}
|
||||||
|
|
||||||
|
<section class="toolbar" aria-label="Filter">
|
||||||
|
<p id="result-count" role="status"></p>
|
||||||
|
<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 }}</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 }}</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 }}</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 }}
|
||||||
|
{{/* Date bounds are computed client-side from the rendered rows'
|
||||||
|
data-datum (see static/js/aenderungen.js) instead of here - a
|
||||||
|
plain date string isn't a usable <input type=range> value, and
|
||||||
|
the JS already needs to parse every row's date for filtering
|
||||||
|
anyway, so bounds fall out of that same pass for free. */}}
|
||||||
|
<div class="filter-group filter-range" data-range-facet="datum" data-datum-range>
|
||||||
|
<div class="filter-range__label">Zeitraum: <output data-range-output-min></output> – <output data-range-output-max></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="0" max="0" value="0" data-range-min>
|
||||||
|
<input type="range" min="0" max="0" value="0" data-range-max>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="filter-reset">Filter zurücksetzen</button>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<ul class="aenderungsliste" id="aenderungsliste">
|
||||||
|
{{ range $zeilen }}
|
||||||
|
<li class="aenderungszeile"
|
||||||
|
data-datum="{{ .eintrag.datum }}"
|
||||||
|
data-zielgruppe="{{ delimit .zielgruppe "|" }}"
|
||||||
|
data-kompetenzbereich="{{ delimit .kompetenzbereich "|" }}"
|
||||||
|
data-kategorie="{{ delimit .kategorie "|" }}"
|
||||||
|
data-lizenz="{{ delimit .lizenz "|" }}"
|
||||||
|
data-dauer-min="{{ if .dauerSeen }}{{ .dauerMin }}{{ end }}"
|
||||||
|
data-dauer-max="{{ if .dauerSeen }}{{ .dauerMax }}{{ end }}"
|
||||||
|
data-gruppengroesse-min="{{ if .groesseSeen }}{{ .groesseMin }}{{ end }}"
|
||||||
|
data-gruppengroesse-max="{{ if .groesseSeen }}{{ .groesseMax }}{{ end }}"
|
||||||
|
data-search="{{ delimit .tags "|" | lower }}"
|
||||||
|
>{{ partial "aenderungssatz.html" (dict "eintrag" .eintrag "titelHTML" .titelHTML) }}</li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
<p id="no-results" hidden>Keine Änderungen gefunden. Filter anpassen.</p>
|
||||||
|
{{ end }}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{{/* Renders the change history section for a Methode or Variante page,
|
||||||
|
called with that page as context. For a Variante: just its own
|
||||||
|
"verlauf" (hugo.Data.varianten). For a Methode: its own "verlauf"
|
||||||
|
merged with every belonging Variante's "verlauf" (via
|
||||||
|
varianten-fuer-methode.html, same lookup as variantenspanne.html),
|
||||||
|
each foreign entry tagged with the variant's untertitel so
|
||||||
|
aenderungssatz.html can append "(Variante ...)" - sorted newest first
|
||||||
|
across the merged set. No title/link needed in the sentences here
|
||||||
|
(aenderungssatz.html's titelHTML stays ""): the entity itself already
|
||||||
|
is the page we're on. */}}
|
||||||
|
{{ $p := . }}
|
||||||
|
{{ $eintraege := slice }}
|
||||||
|
|
||||||
|
{{ if eq $p.Section "varianten" }}
|
||||||
|
{{ with index hugo.Data.varianten $p.File.ContentBaseName }}
|
||||||
|
{{ range .verlauf }}{{ $eintraege = $eintraege | append . }}{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ with index hugo.Data.methoden $p.File.ContentBaseName }}
|
||||||
|
{{ range .verlauf }}{{ $eintraege = $eintraege | append . }}{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ range partial "varianten-fuer-methode.html" $p }}
|
||||||
|
{{ $variante := . }}
|
||||||
|
{{ with index hugo.Data.varianten $variante.File.ContentBaseName }}
|
||||||
|
{{ range .verlauf }}
|
||||||
|
{{ $eintraege = $eintraege | append (merge . (dict "variante" ($variante.Params.untertitel | default $variante.Title))) }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $eintraege = sort $eintraege "datum" "desc" }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with $eintraege }}
|
||||||
|
<section class="method__section method__section--verlauf">
|
||||||
|
<h2>Änderungsverlauf</h2>
|
||||||
|
<ul class="aenderungsliste">
|
||||||
|
{{ range . }}
|
||||||
|
<li>{{ partial "aenderungssatz.html" (dict "eintrag" . "titelHTML" "") }}</li>
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
{{ end }}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{{/* Renders one change-history entry as a full German sentence, per the
|
||||||
|
pattern "<Felder> von <Titel> wurde(n) in <X> Zeilen am <Datum> durch
|
||||||
|
<Autor> geändert. Änderungen in Git anzeigen." (or "<Titel> wurde in
|
||||||
|
<X> Zeilen am <Datum> durch <Autor> angelegt. ..." for a creation
|
||||||
|
entry). Called with a dict:
|
||||||
|
eintrag - one entry from hugo.Data.methoden/varianten's "verlauf"
|
||||||
|
array (datum/autor/hash/zeilen/typ/felder), optionally
|
||||||
|
with an extra "variante" key (the variant's untertitel)
|
||||||
|
when merged in from a variant into a method's aggregated
|
||||||
|
history, see aenderungshistorie.html.
|
||||||
|
titelHTML - pre-rendered link HTML to the method/variant ("<a
|
||||||
|
href=...>Titel</a>"), or "" when this is rendered
|
||||||
|
directly on the entity's own page (no need to name the
|
||||||
|
subject there, see aenderungshistorie.html).
|
||||||
|
Everything below is plain auto-escaped template markup (Hugo/Go's
|
||||||
|
html/template escapes {{ .autor }} etc. on its own, context-aware even
|
||||||
|
inside the git-link href) - titelHTML is the ONE deliberately
|
||||||
|
pre-built HTML fragment, so it's also the only value that needs an
|
||||||
|
explicit "safeHTML" at its single point of use, instead of assembling
|
||||||
|
the whole sentence as a Go string and blanket-marking it safe
|
||||||
|
(previous version - meant every future field added here had to
|
||||||
|
remember to escape itself by hand, with nothing enforcing that).
|
||||||
|
Prints directly (no "return") - callers just place
|
||||||
|
{{ partial "aenderungssatz.html" ... }} where the sentence should
|
||||||
|
appear, see aenderungshistorie.html and layouts/aenderungen/list.html. */}}
|
||||||
|
{{ $eintrag := .eintrag }}
|
||||||
|
{{ $titelHTML := .titelHTML | default "" }}
|
||||||
|
|
||||||
|
{{ $labels := dict
|
||||||
|
"kennung" "Kennung" "titel" "Titel" "kurzbeschreibung" "Kurzbeschreibung"
|
||||||
|
"verwendungsmoeglichkeit" "Verwendungsmöglichkeit" "zielgruppe" "Zielgruppe"
|
||||||
|
"kompetenzbereich" "Kompetenzbereich" "kategorie" "Kategorie" "tags" "Tags"
|
||||||
|
"lernchancen" "Lernchancen" "herkunft" "Herkunft" "initiatoren" "Initiator:innen"
|
||||||
|
"methode" "Methode" "untertitel" "Untertitel" "varianten_beschreibung" "Varianten-Beschreibung"
|
||||||
|
"veroeffentlicht" "Veröffentlicht" "dauer_minuten" "Dauer"
|
||||||
|
"gruppengroesse_min" "Gruppengröße (mindestens)" "gruppengroesse_max" "Gruppengröße (höchstens)"
|
||||||
|
"material" "Material" "autoren" "Autor:innen" "lizenz" "Lizenz" "quellen" "Quellen"
|
||||||
|
"anhaenge" "Anhänge" "inhalt" "Inhalt"
|
||||||
|
}}
|
||||||
|
{{ $felderLesbar := slice }}
|
||||||
|
{{ range $eintrag.felder }}{{ $felderLesbar = $felderLesbar | append (or (index $labels .) .) }}{{ end }}
|
||||||
|
{{ $liste := delimit $felderLesbar ", " }}
|
||||||
|
{{ $verb := "wurden" }}
|
||||||
|
{{ if eq (len $eintrag.felder) 1 }}{{ $verb = "wurde" }}{{ end }}
|
||||||
|
|
||||||
|
{{ $datum := $eintrag.datum | time.AsTime | dateFormat "02.01.2006" }}
|
||||||
|
|
||||||
|
{{ $zeilenText := "" }}
|
||||||
|
{{ with $eintrag.zeilen | int }}
|
||||||
|
{{ if gt . 0 }}{{ $zeilenText = printf "in %d %s " . (cond (eq . 1) "Zeile" "Zeilen") }}{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ $gitLink := "" }}
|
||||||
|
{{ with site.Params.methoden_repo_url }}{{ $gitLink = printf "%s/commit/%s" . $eintrag.hash }}{{ end }}
|
||||||
|
|
||||||
|
{{ if eq $eintrag.typ "erstellt" -}}
|
||||||
|
{{ if eq $titelHTML "" }}Seite{{ else }}{{ $titelHTML | safeHTML }}{{ end }} wurde {{ $zeilenText }}am {{ $datum }} durch {{ $eintrag.autor }} angelegt{{ with $eintrag.variante }} (Variante „{{ . }}“){{ end }}.
|
||||||
|
{{- else -}}
|
||||||
|
{{ $liste }}{{ if ne $titelHTML "" }} von {{ $titelHTML | safeHTML }}{{ end }} {{ $verb }} {{ $zeilenText }}am {{ $datum }} durch {{ $eintrag.autor }} geändert{{ with $eintrag.variante }} (Variante „{{ . }}“){{ end }}.
|
||||||
|
{{- end }}
|
||||||
|
{{- with $gitLink }} <a href="{{ . }}">Änderungen in Git anzeigen</a>{{ end }}
|
||||||
@@ -38,5 +38,7 @@
|
|||||||
</section>
|
</section>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ partial "aenderungshistorie.html" $variante }}
|
||||||
</article>
|
</article>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -452,6 +452,14 @@ a:focus-visible, button:focus-visible { outline: 3px solid var(--color-accent);
|
|||||||
.method__section { margin: 1.75rem 0; }
|
.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__section h2 { font-size: 1.1rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.25rem; }
|
||||||
|
|
||||||
|
/* Log-style change history, both the per-page section (single.html,
|
||||||
|
varianten/single.html) and the /aenderungen/ overview page - deliberately
|
||||||
|
plain text rows, no card layout (see aenderungen/list.html). */
|
||||||
|
.aenderungsliste { list-style: none; margin: 0; padding: 0; }
|
||||||
|
.aenderungszeile { padding: 0.6rem 0; border-bottom: 1px solid var(--color-border); font-size: 0.925rem; }
|
||||||
|
.aenderungszeile:last-child { border-bottom: none; }
|
||||||
|
.aenderungszeile a { font-weight: 600; }
|
||||||
|
|
||||||
.method__meta dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.75rem 1.5rem; }
|
.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 dt { color: var(--color-muted); font-size: 0.8rem; margin: 0; }
|
||||||
.method__meta dd { margin: 0; font-weight: 500; }
|
.method__meta dd { margin: 0; font-weight: 500; }
|
||||||
|
|||||||
@@ -0,0 +1,193 @@
|
|||||||
|
(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Same checkbox-facet / dual-range-slider approach as static/js/filter.js
|
||||||
|
// (homepage), applied to <li> log rows instead of .method-card elements -
|
||||||
|
// kept as a separate file rather than merged into filter.js, since the
|
||||||
|
// DOM (#aenderungsliste vs. #method-grid) and the extra date-range facet
|
||||||
|
// differ enough that sharing would need more branching than duplication.
|
||||||
|
var list = document.getElementById("aenderungsliste");
|
||||||
|
if (!list) return; // Not on the Änderungsverlauf page
|
||||||
|
|
||||||
|
var rows = Array.prototype.slice.call(list.querySelectorAll(".aenderungszeile"));
|
||||||
|
var resultCount = document.getElementById("result-count");
|
||||||
|
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; });
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectedValues(facet) {
|
||||||
|
return checkboxesFor(facet)
|
||||||
|
.filter(function (el) { return el.checked; })
|
||||||
|
.map(function (el) { return el.value.toLowerCase(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowValues(row, key) {
|
||||||
|
var raw = row.dataset[key] || "";
|
||||||
|
return raw ? raw.split("|").map(function (v) { return v.toLowerCase(); }) : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Dual range sliders (Dauer, Gruppengröße, Datum) ---------------------
|
||||||
|
|
||||||
|
function rangeState(group) {
|
||||||
|
return {
|
||||||
|
group: group,
|
||||||
|
minInput: group.querySelector("[data-range-min]"),
|
||||||
|
maxInput: group.querySelector("[data-range-max]"),
|
||||||
|
isDate: group.hasAttribute("data-datum-range"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function bounds(state) {
|
||||||
|
return [parseFloat(state.group.dataset.min), parseFloat(state.group.dataset.max)];
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatValue(state, value) {
|
||||||
|
if (!state.isDate) return value;
|
||||||
|
return new Date(value).toLocaleDateString("de-DE");
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateRangeVisuals(state) {
|
||||||
|
var b = bounds(state);
|
||||||
|
var min = parseFloat(state.minInput.value);
|
||||||
|
var max = parseFloat(state.maxInput.value);
|
||||||
|
var span = (b[1] - b[0]) || 1;
|
||||||
|
|
||||||
|
var outMin = state.group.querySelector("[data-range-output-min]");
|
||||||
|
var outMax = state.group.querySelector("[data-range-output-max]");
|
||||||
|
if (outMin) outMin.textContent = formatValue(state, min);
|
||||||
|
if (outMax) outMax.textContent = formatValue(state, max);
|
||||||
|
|
||||||
|
var fill = state.group.querySelector("[data-range-fill]");
|
||||||
|
if (fill) {
|
||||||
|
var left = ((min - b[0]) / span) * 100;
|
||||||
|
var right = ((max - b[0]) / span) * 100;
|
||||||
|
fill.style.left = left + "%";
|
||||||
|
fill.style.width = Math.max(0, right - left) + "%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The date range's own min/max/value aren't known until the rendered
|
||||||
|
// rows' data-datum attributes are read (see list.html - a plain date
|
||||||
|
// string can't be a native <input type=range> bound) - computed here
|
||||||
|
// once from what's already in the DOM, same pass that filtering needs
|
||||||
|
// anyway.
|
||||||
|
var dateBoundsMs = null;
|
||||||
|
rangeGroups.forEach(function (group) {
|
||||||
|
if (!group.hasAttribute("data-datum-range")) return;
|
||||||
|
var timestamps = rows
|
||||||
|
.map(function (row) { return Date.parse(row.dataset.datum); })
|
||||||
|
.filter(function (t) { return !isNaN(t); });
|
||||||
|
if (!timestamps.length) return;
|
||||||
|
dateBoundsMs = [Math.min.apply(null, timestamps), Math.max.apply(null, timestamps)];
|
||||||
|
group.dataset.min = dateBoundsMs[0];
|
||||||
|
group.dataset.max = dateBoundsMs[1];
|
||||||
|
var minInput = group.querySelector("[data-range-min]");
|
||||||
|
var maxInput = group.querySelector("[data-range-max]");
|
||||||
|
minInput.min = maxInput.min = dateBoundsMs[0];
|
||||||
|
minInput.max = maxInput.max = dateBoundsMs[1];
|
||||||
|
minInput.value = dateBoundsMs[0];
|
||||||
|
maxInput.value = dateBoundsMs[1];
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
function onMaxInput() {
|
||||||
|
if (parseFloat(state.maxInput.value) < parseFloat(state.minInput.value)) {
|
||||||
|
state.maxInput.value = state.minInput.value;
|
||||||
|
}
|
||||||
|
updateRangeVisuals(state);
|
||||||
|
applyFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
state.minInput.addEventListener("input", onMinInput);
|
||||||
|
state.maxInput.addEventListener("input", onMaxInput);
|
||||||
|
updateRangeVisuals(state);
|
||||||
|
return state;
|
||||||
|
});
|
||||||
|
|
||||||
|
function rangeIsNarrowed(state) {
|
||||||
|
var b = bounds(state);
|
||||||
|
return parseFloat(state.minInput.value) > b[0] || parseFloat(state.maxInput.value) < b[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Filtering -------------------------------------------------------
|
||||||
|
|
||||||
|
function matchesFacets(row) {
|
||||||
|
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 = rowValues(row, facet);
|
||||||
|
if (!values.some(function (v) { return selected.indexOf(v) !== -1; })) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesRanges(row) {
|
||||||
|
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 === "datum") {
|
||||||
|
var d = Date.parse(row.dataset.datum);
|
||||||
|
if (isNaN(d) || d < fMin || d > fMax) return false;
|
||||||
|
} else if (facet === "dauer") {
|
||||||
|
var dMinRaw = row.dataset.dauerMin, dMaxRaw = row.dataset.dauerMax;
|
||||||
|
if (dMinRaw === "" || dMaxRaw === "") return false;
|
||||||
|
if (parseFloat(dMaxRaw) < fMin || parseFloat(dMinRaw) > fMax) return false;
|
||||||
|
} else if (facet === "groesse") {
|
||||||
|
var gMinRaw = row.dataset.gruppengroesseMin, gMaxRaw = row.dataset.gruppengroesseMax;
|
||||||
|
if (gMinRaw === "" || gMaxRaw === "") return false;
|
||||||
|
if (parseFloat(gMaxRaw) < fMin || parseFloat(gMinRaw) > fMax) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyFilters() {
|
||||||
|
var visible = 0;
|
||||||
|
rows.forEach(function (row) {
|
||||||
|
var match = matchesFacets(row) && matchesRanges(row);
|
||||||
|
row.hidden = !match;
|
||||||
|
if (match) visible++;
|
||||||
|
});
|
||||||
|
if (resultCount) resultCount.textContent = visible + " von " + rows.length + " Änderungen";
|
||||||
|
if (noResults) noResults.hidden = visible !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resetButton) {
|
||||||
|
resetButton.addEventListener("click", function () {
|
||||||
|
checkboxes.forEach(function (el) { el.checked = false; });
|
||||||
|
rangeStates.forEach(function (state) {
|
||||||
|
var b = bounds(state);
|
||||||
|
state.minInput.value = b[0];
|
||||||
|
state.maxInput.value = b[1];
|
||||||
|
updateRangeVisuals(state);
|
||||||
|
});
|
||||||
|
applyFilters();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
checkboxes.forEach(function (el) {
|
||||||
|
el.addEventListener("change", applyFilters);
|
||||||
|
});
|
||||||
|
|
||||||
|
applyFilters();
|
||||||
|
})();
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#!/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"
|
|
||||||
Executable
+156
@@ -0,0 +1,156 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
# Generates hugo/data/methoden.json and hugo/data/varianten.json: creation
|
||||||
|
# date, last-modified date, and a full chronological change history
|
||||||
|
# (verlauf, newest first) per method/variant - all derived from the git
|
||||||
|
# history of _content/. Replaces generate-dates.sh (same underlying reason
|
||||||
|
# for reading git history ourselves instead of relying on Hugo's
|
||||||
|
# enableGitInfo/.GitInfo, which doesn't see _content/'s separate git repo -
|
||||||
|
# see the installation guide on the project website. No Hugo-native
|
||||||
|
# "created" equivalent exists anyway, https://github.com/gohugoio/hugo/issues/11810).
|
||||||
|
#
|
||||||
|
# Recomputed fresh whenever _content/ actually changed, not maintained (see
|
||||||
|
# sync-methoden.sh, which calls this script automatically) - no manual
|
||||||
|
# date/history field, git stays the single source of truth (Manifest
|
||||||
|
# Prinzip 8). "Whenever actually changed", not "on every call": walking the
|
||||||
|
# full history of every entry (one "git show"-equivalent read per historical
|
||||||
|
# commit) is real, recurring cost on every deploy - skipped entirely via
|
||||||
|
# hugo/data/verlauf-cache.json when _content/'s HEAD hasn't moved since the
|
||||||
|
# last run, see skip_wenn_unveraendert below.
|
||||||
|
require_relative 'lib/frontmatter'
|
||||||
|
require 'json'
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
|
ROOT = File.expand_path('..', __dir__)
|
||||||
|
CONTENT_REPO = File.join(ROOT, '_content')
|
||||||
|
CACHE_FILE = File.join(ROOT, 'hugo', 'data', 'verlauf-cache.json')
|
||||||
|
|
||||||
|
def content_head
|
||||||
|
`cd #{CONTENT_REPO} && git rev-parse HEAD`.strip
|
||||||
|
end
|
||||||
|
|
||||||
|
# Skips the whole run (both files untouched, left exactly as the last
|
||||||
|
# successful run produced them) when _content/'s current HEAD is the same
|
||||||
|
# commit as last time - a no-op sync/cron tick (by far the common case
|
||||||
|
# under the 10-minute cron) then costs one "git rev-parse" instead of
|
||||||
|
# walking the entire history of every method/variant again.
|
||||||
|
def skip_wenn_unveraendert
|
||||||
|
return false unless File.exist?(CACHE_FILE)
|
||||||
|
cache = JSON.parse(File.read(CACHE_FILE)) rescue nil
|
||||||
|
return false unless cache
|
||||||
|
return false unless cache['content_head'] == content_head
|
||||||
|
out_methoden = File.join(ROOT, 'hugo', 'data', 'methoden.json')
|
||||||
|
out_varianten = File.join(ROOT, 'hugo', 'data', 'varianten.json')
|
||||||
|
return false unless File.exist?(out_methoden) && File.exist?(out_varianten)
|
||||||
|
puts 'verlauf: _content/ unveraendert seit letztem Lauf, ueberspringe Neuberechnung.'
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
# One combined "git log" call per file instead of one per commit - %x09 is
|
||||||
|
# a literal tab byte as field separator, safe against contents containing
|
||||||
|
# regular spaces/dashes. --numstat (instead of --name-only) gives both the
|
||||||
|
# historical path at each commit (needed for --follow across renames, same
|
||||||
|
# technique scripts/validate.rb's vorherige_kennung already uses for the
|
||||||
|
# single most recent rename) AND the added/deleted line count in the same
|
||||||
|
# pass, no second git call needed for that. --no-merges: merge commits
|
||||||
|
# (e.g. from a regularly merged Pull Request against the content repo, see
|
||||||
|
# the "Ein Server oder zwei"/PR workflow docs) carry no file list under
|
||||||
|
# --name-only/--numstat by default - left in, the fixed 2-lines-per-commit
|
||||||
|
# pairing below would desync at exactly that commit and misattribute every
|
||||||
|
# following entry. Excluding them is also correct on its own terms: a merge
|
||||||
|
# commit isn't itself a content edit, the actual edits are the commits it
|
||||||
|
# merges, which still appear individually here regardless.
|
||||||
|
def commits_for(relpath, content_dir)
|
||||||
|
raw = `cd #{content_dir} && git log --no-merges --follow --format='%H%x09%an%x09%aI' --numstat -- #{relpath}`
|
||||||
|
zeilen = raw.split("\n").reject(&:empty?)
|
||||||
|
commits = []
|
||||||
|
i = 0
|
||||||
|
while i < zeilen.length
|
||||||
|
hash, autor, datum = zeilen[i].split("\t")
|
||||||
|
hinzu, weg, pfad = zeilen[i + 1].split("\t")
|
||||||
|
zeilen_geaendert = [hinzu, weg].map { |n| n =~ /\A\d+\z/ ? n.to_i : 0 }.sum # "-\t-" for binary files, treated as 0
|
||||||
|
commits << { hash: hash, autor: autor, datum: datum, pfad: pfad, zeilen: zeilen_geaendert }
|
||||||
|
i += 2
|
||||||
|
end
|
||||||
|
commits.reverse
|
||||||
|
end
|
||||||
|
|
||||||
|
def inhalt_bei(hash, pfad, content_dir)
|
||||||
|
text = `cd #{content_dir} && git show #{hash}:#{pfad} 2>/dev/null`.force_encoding('UTF-8')
|
||||||
|
return nil if text.empty?
|
||||||
|
Frontmatter.parse(text)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Compares frontmatter key-by-key (simple value inequality, including for
|
||||||
|
# list-type fields - a reordered-but-unchanged list would show as
|
||||||
|
# "changed", accepted as a rare, harmless false positive rather than
|
||||||
|
# building element-level list diffing for this) plus the document body, for
|
||||||
|
# variants where the actual content (Vorbereitung/Ablauf/Hintergründe)
|
||||||
|
# lives.
|
||||||
|
def geaenderte_felder(vorher_fm, vorher_body, jetzt_fm, jetzt_body)
|
||||||
|
felder = (vorher_fm.keys | jetzt_fm.keys).select { |k| vorher_fm[k] != jetzt_fm[k] }
|
||||||
|
felder << 'inhalt' if vorher_body != jetzt_body
|
||||||
|
felder
|
||||||
|
end
|
||||||
|
|
||||||
|
def verlauf_fuer(relpath, content_dir)
|
||||||
|
commits = commits_for(relpath, content_dir)
|
||||||
|
return nil if commits.empty?
|
||||||
|
|
||||||
|
eintraege = []
|
||||||
|
vorher_fm = nil
|
||||||
|
vorher_body = nil
|
||||||
|
|
||||||
|
commits.each do |c|
|
||||||
|
parsed = inhalt_bei(c[:hash], c[:pfad], content_dir)
|
||||||
|
unless parsed
|
||||||
|
warn "verlauf: Konnte #{relpath} bei Commit #{c[:hash]} nicht lesen, uebersprungen."
|
||||||
|
next
|
||||||
|
end
|
||||||
|
fm, body = parsed
|
||||||
|
|
||||||
|
basis = { datum: c[:datum], autor: c[:autor], hash: c[:hash], zeilen: c[:zeilen] }
|
||||||
|
if vorher_fm.nil?
|
||||||
|
eintraege << basis.merge(typ: 'erstellt', felder: [])
|
||||||
|
else
|
||||||
|
felder = geaenderte_felder(vorher_fm, vorher_body, fm, body)
|
||||||
|
eintraege << basis.merge(typ: 'geaendert', felder: felder) unless felder.empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
vorher_fm = fm
|
||||||
|
vorher_body = body
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil if eintraege.empty?
|
||||||
|
|
||||||
|
eintraege = eintraege.reverse # newest first
|
||||||
|
{ erstellt: eintraege.last[:datum], geaendert: eintraege.first[:datum], verlauf: eintraege }
|
||||||
|
end
|
||||||
|
|
||||||
|
# Both methods and variants are one folder per entry with content in
|
||||||
|
# index.md (Hugo page bundle).
|
||||||
|
def generate_bundle_verlauf(name)
|
||||||
|
dir = File.join(CONTENT_REPO, name)
|
||||||
|
out = File.join(ROOT, 'hugo', 'data', "#{name}.json")
|
||||||
|
FileUtils.mkdir_p(File.dirname(out))
|
||||||
|
|
||||||
|
entries = {}
|
||||||
|
if Dir.exist?(dir)
|
||||||
|
Dir.glob(File.join(dir, '*')).select { |d| File.directory?(d) }.each do |entry_dir|
|
||||||
|
slug = File.basename(entry_dir)
|
||||||
|
next unless File.exist?(File.join(entry_dir, 'index.md'))
|
||||||
|
daten = verlauf_fuer("#{name}/#{slug}/index.md", CONTENT_REPO)
|
||||||
|
entries[slug] = daten if daten
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
File.write(out, JSON.pretty_generate(entries))
|
||||||
|
puts "#{name}.json aktualisiert: #{entries.length} Einträge"
|
||||||
|
end
|
||||||
|
|
||||||
|
exit if skip_wenn_unveraendert
|
||||||
|
|
||||||
|
generate_bundle_verlauf('methoden')
|
||||||
|
generate_bundle_verlauf('varianten')
|
||||||
|
|
||||||
|
FileUtils.mkdir_p(File.dirname(CACHE_FILE))
|
||||||
|
File.write(CACHE_FILE, JSON.pretty_generate({ content_head: content_head }))
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
# marker - once a fork's own commits land, this reflects those, not the
|
# marker - once a fork's own commits land, this reflects those, not the
|
||||||
# template's history.
|
# template's history.
|
||||||
#
|
#
|
||||||
# Unlike hugo/data/methoden.json/varianten.json (generate-dates.sh), this
|
# Unlike hugo/data/methoden.json/varianten.json (generate-verlauf.rb), this
|
||||||
# reads the website repo's own git history directly - no separate
|
# reads the website repo's own git history directly - no separate
|
||||||
# module.mounts repo involved, Hugo's enableGitInfo/.GitInfo would actually
|
# module.mounts repo involved, Hugo's enableGitInfo/.GitInfo would actually
|
||||||
# work here, but a plain "git log" call keeps this consistent with the
|
# work here, but a plain "git log" call keeps this consistent with the
|
||||||
|
|||||||
@@ -51,8 +51,9 @@ echo "_content/ aktuell: $(git -C "$TARGET" rev-parse --short HEAD)"
|
|||||||
# warnings (exit code 0) deliberately do not block.
|
# warnings (exit code 0) deliberately do not block.
|
||||||
ruby "$(dirname "${BASH_SOURCE[0]}")/validate.rb"
|
ruby "$(dirname "${BASH_SOURCE[0]}")/validate.rb"
|
||||||
|
|
||||||
# Recompute creation dates from the freshly fetched history.
|
# Recompute creation/change dates and the change history from the freshly
|
||||||
"$(dirname "${BASH_SOURCE[0]}")/generate-dates.sh"
|
# fetched history.
|
||||||
|
ruby "$(dirname "${BASH_SOURCE[0]}")/generate-verlauf.rb"
|
||||||
|
|
||||||
# Translate the variants' "veroeffentlicht" field (positive polarity) into
|
# Translate the variants' "veroeffentlicht" field (positive polarity) into
|
||||||
# Hugo's native draft field - must run before compute-methoden-
|
# Hugo's native draft field - must run before compute-methoden-
|
||||||
|
|||||||
+1
-1
@@ -235,7 +235,7 @@ Dir.glob(File.join(varianten_dir, '*')).select { |d| File.directory?(d) }.each d
|
|||||||
|
|
||||||
# Regel 12 (no derived fields)
|
# Regel 12 (no derived fields)
|
||||||
%w[draft erstellt geaendert].each do |feld|
|
%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)
|
warnungen << "#{rel_path}: enthält abgeleitetes Feld '#{feld}' - das übernimmt apply-veroeffentlicht.rb/generate-verlauf.rb selbst (Regel 12)" if fm.key?(feld)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Regel 8 (required fields)
|
# Regel 8 (required fields)
|
||||||
|
|||||||
Reference in New Issue
Block a user