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.
37 lines
1.5 KiB
HTML
37 lines
1.5 KiB
HTML
{{/* 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" -}}
|