Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

81 rinda
4.1 KiB

  1. {{ $currentNode := . }}
  2. {{ range $p := .Site.RegularPages }}
  3. {{ $pageFilePath := printf "/%s" $p.File }}
  4. {{ $pageDir := "" }}
  5. {{ with $p.File }}
  6. {{ $pageDir = (substr .Dir 0 -1)}}
  7. {{ end }}
  8. {{ range $triad := (index $currentNode.Site.Data.sandpointsnamegraph "triads") }}
  9. {{ with intersect $triad (slice $pageDir) }}
  10. {{ $t := index . 0 }}
  11. {{ if eq $t (index $triad 0) }}
  12. {{ $.Scratch.SetInMap $pageFilePath "depth" "core" }}
  13. {{ $.Scratch.SetInMap $pageFilePath "child_depth" "mantle" }}
  14. {{ $.Scratch.SetInMap $pageFilePath "plural" (index $triad 1)}}
  15. {{ $.Scratch.SetInMap $pageFilePath "has" (slice (index $triad 2) (index $triad 3))}}
  16. {{ $gp := $.GetPage $pageFilePath }}
  17. {{ $hasmantles := (slice) }}
  18. {{ range index $gp.Params (printf "has_%s" (index $triad 3)) }}
  19. {{ $hasmantles = $hasmantles | append ($.GetPage (printf "/%s/%s" (index $triad 2) . )) }}
  20. {{ end }}
  21. {{ $.Scratch.SetInMap $pageFilePath "has_children" $hasmantles }}
  22. {{ range index $p.Params (printf "has_%s" (index $triad 3)) }}
  23. {{ $childPath := printf "/%s/%s" (index $triad 2) . }}
  24. {{ with $.Scratch.Get $childPath }}
  25. {{ if isset . "is_in" }}
  26. {{ $isin := index . "is_in" | append ($.GetPage $pageFilePath) }}
  27. {{ $.Scratch.SetInMap $childPath "is_in" $isin }}
  28. {{ else }}
  29. {{ $.Scratch.SetInMap $childPath "is_in" (slice ($.GetPage $pageFilePath)) }}
  30. {{ end }}
  31. {{ else }}
  32. {{ $.Scratch.SetInMap $childPath "is_in" (slice ($.GetPage $pageFilePath)) }}
  33. {{ end }}
  34. {{ end }}
  35. {{ else if eq $t (index $triad 2) }}
  36. {{ $.Scratch.SetInMap $pageFilePath "depth" "mantle" }}
  37. {{ $.Scratch.SetInMap $pageFilePath "child_depth" "crust" }}
  38. {{ $.Scratch.SetInMap $pageFilePath "plural" (index $triad 3)}}
  39. {{ $.Scratch.SetInMap $pageFilePath "has" (slice (index $triad 4) (index $triad 5))}}
  40. {{ $gp := $.GetPage $pageFilePath }}
  41. {{ $hascrusts := (slice) }}
  42. {{ range index $gp.Params (printf "has_%s" (index $triad 5)) }}
  43. {{ $hascrusts = $hascrusts | append ($.GetPage (printf "/%s/%s" (index $triad 4) . )) }}
  44. {{ end }}
  45. {{ $.Scratch.SetInMap $pageFilePath "has_children" $hascrusts }}
  46. {{ range index $p.Params (printf "has_%s" (index $triad 5)) }}
  47. {{ $childPath := printf "/%s/%s" (index $triad 4) . }}
  48. {{ with $.Scratch.Get $childPath }}
  49. {{ if isset . "is_in" }}
  50. {{ $isin := index . "is_in" | append ($.GetPage $pageFilePath) }}
  51. {{ $.Scratch.SetInMap $childPath "is_in" $isin }}
  52. {{ else }}
  53. {{ $.Scratch.SetInMap $childPath "is_in" (slice ($.GetPage $pageFilePath)) }}
  54. {{ end }}
  55. {{ else }}
  56. {{ $.Scratch.SetInMap $childPath "is_in" (slice ($.GetPage $pageFilePath)) }}
  57. {{ end }}
  58. {{ end }}
  59. {{ else if eq $t (index $triad 4) }}
  60. {{ $.Scratch.SetInMap $pageFilePath "depth" "crust" }}
  61. {{ $.Scratch.SetInMap $pageFilePath "mantle_has" (index $triad 5) }}
  62. {{ $.Scratch.SetInMap $pageFilePath "plural" (index $triad 5)}}
  63. {{ $.Scratch.SetInMap $pageFilePath "in" (slice (index $triad 2) (index $triad 3))}}
  64. {{ end }}
  65. {{ $.Scratch.SetInMap $pageFilePath "core" (index $triad 0) }}
  66. {{ $.Scratch.SetInMap $pageFilePath "mantle" (index $triad 2) }}
  67. {{ $.Scratch.SetInMap $pageFilePath "crust" (index $triad 4) }}
  68. {{ end }}
  69. {{ end }}
  70. {{ end }}
  71. {{ return $.Scratch }}