From 7316238f16655bd127b04476bbf7864b27f940f9 Mon Sep 17 00:00:00 2001 From: Sivaldo Date: Sat, 13 Jun 2026 19:20:23 -0300 Subject: Commit inicial --- layouts/_default/list.html | 146 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 layouts/_default/list.html (limited to 'layouts/_default/list.html') diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..09804c9 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,146 @@ +{{ define "title" }} + {{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} · {{ .Site.Title }}{{ end }} +{{ end }} + +{{ define "header" }} + direito + {{ if not .IsHome }} + / + {{ .Title }} + {{ end }} +{{ end }} + +{{ define "main" }} +{{ if .IsHome }} + + {{/* Mapas por slug de disciplina */}} + {{ $simMap := dict }} + {{ $quizMap := dict }} + {{ $discsQz := slice }} + {{ range .Site.RegularPages }} + {{ if eq .Section "quizzes" }} + {{ $slug := .File.Dir | strings.TrimSuffix "/" | path.Base }} + {{ if not (in $discsQz $slug) }}{{ $discsQz = $discsQz | append $slug }}{{ end }} + {{ $isSim := or (.Params.simulado) (in (.File.BaseFileName | lower) "simulado") }} + {{ if $isSim }} + {{ $simMap = merge $simMap (dict $slug (add (index $simMap $slug | default 0) 1)) }} + {{ else }} + {{ $quizMap = merge $quizMap (dict $slug (add (index $quizMap $slug | default 0) 1)) }} + {{ end }} + {{ end }} + {{ end }} + +
+ {{ $txtsSlugs := slice }} + {{ range .Site.Sections }} + {{ if eq .Section "txts" }} + {{ range .Sections }} + {{ $slug := .RelPermalink | strings.TrimSuffix "/" | path.Base }} + {{ $txtsSlugs = $txtsSlugs | append $slug }} + {{ $sims := index $simMap $slug | default 0 }} + {{ $qz := index $quizMap $slug | default 0 }} + +
{{ .Title }}
+
+ {{ $n := len .RegularPages }} + {{ if $n }}{{ $n }} assunto{{ if gt $n 1 }}s{{ end }}{{ else }}sem textos{{ end }} + {{ if $sims }} · simulado{{ end }} + {{ if $qz }} · {{ $qz }} exercício{{ if gt $qz 1 }}s{{ end }}{{ end }} +
+
+ {{ end }} + {{ end }} + {{ end }} + + {{/* Disciplinas que só existem em quizzes (sem txts) */}} + {{ range $slug := $discsQz }} + {{ if not (in $txtsSlugs $slug) }} + {{ $sims := index $simMap $slug | default 0 }} + {{ $qz := index $quizMap $slug | default 0 }} + +
{{ humanize (replace $slug "-" " ") }}
+
+ {{ if $sims }}simulado · {{ end }}{{ $qz }} exercício{{ if gt $qz 1 }}s{{ end }} +
+
+ {{ end }} + {{ end }} +
+ +{{ else }} + {{/* Página de disciplina */}} + {{ $discSlug := .RelPermalink | strings.TrimSuffix "/" | path.Base }} +
+ +
{{ .Title }}
+ + {{ if .Content }} +
+
{{ .Content }}
+
+ {{ end }} + +
+ {{ partial "disc-extras.html" . }} +
+ + {{/* Simulados desta disciplina */}} + {{ $simulados := slice }} + {{ range $.Site.RegularPages }} + {{ if eq .Section "quizzes" }} + {{ $parent := .File.Dir | strings.TrimSuffix "/" | path.Base }} + {{ if eq $parent $discSlug }} + {{ if or (.Params.simulado) (in (.File.BaseFileName | lower) "simulado") }} + {{ $simulados = $simulados | append . }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} + {{ with $simulados }} +
+
simulados
+
+ {{ range . }} + + {{ .Title }} + simulado + + {{ end }} +
+
+ {{ end }} + + {{/* Assuntos com vínculo aos exercícios */}} + {{ $exercises := slice }} + {{ range $.Site.RegularPages }} + {{ if eq .Section "quizzes" }} + {{ $parent := .File.Dir | strings.TrimSuffix "/" | path.Base }} + {{ if eq $parent $discSlug }} + {{ if not (or (.Params.simulado) (in (.File.BaseFileName | lower) "simulado")) }} + {{ $exercises = $exercises | append . }} + {{ end }} + {{ end }} + {{ end }} + {{ end }} + +
+ {{ range .RegularPages }} + {{ $assuntoSlug := .File.BaseFileName }} + {{ $linkedQuiz := false }} + {{ range $exercises }} + {{ if eq .File.BaseFileName $assuntoSlug }} + {{ $linkedQuiz = . }} + {{ end }} + {{ end }} + + {{ .Title }} + + texto{{ if $linkedQuiz }} · exercícios{{ end }} + + + {{ end }} + {{ if not .RegularPages }}

sem assuntos ainda

{{ end }} +
+
+{{ end }} +{{ end }} -- cgit v1.2.3