Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

162 строки
6.4 KiB

  1. {{ $currentNode := . }}
  2. {{ $debug := (slice) }}
  3. {{ $pPath := "" }}
  4. {{ range $p := .Site.RegularPages }}
  5. {{ $pPath = printf "/%s" $p.File }}
  6. {{ $pageDir := "" }}
  7. {{ with $p.File }}
  8. {{ $pageDir = (substr .Dir 0 -1)}}
  9. {{ end }}
  10. {{ $gp := $.GetPage $pPath }}
  11. {{ $gpPath := printf "/%s" $gp.File }}
  12. {{ range $k, $v := $gp.Params }}
  13. {{ with in $k "has_" }}
  14. {{ $s := index (split $k "has_") 1 }}
  15. {{ range $sin,$plur := $currentNode.Site.Data.sandpointsnamegraph }}
  16. {{ if eq $s $plur }}
  17. {{ range index $gp.Params $k }}
  18. {{ $cp := $.GetPage (printf "/%s/%s" $sin .) }}
  19. {{ $cpPath := printf "/%s" $cp.File }}
  20. {{ range $kcp, $vcp := $cp.Params }}
  21. {{ with in $kcp "has_" }}
  22. {{ $scp := index (split $kcp "has_") 1 }}
  23. {{ range $sincp,$plurcp := $currentNode.Site.Data.sandpointsnamegraph }}
  24. {{ if eq $scp $plurcp }}
  25. {{ $.Scratch.SetInMap $gpPath "depth" "core" }}
  26. {{ $.Scratch.SetInMap $gpPath "child_depth" "mantle" }}
  27. {{ $.Scratch.SetInMap $gpPath "has" $s }}
  28. {{ with $gp.File }}
  29. {{ $core := substr .Dir 0 -1 }}
  30. {{ if isset ($.Scratch.Get $gpPath) "core" }}
  31. {{ $.Scratch.SetInMap $gpPath "core" (uniq ((index ($.Scratch.Get $gpPath) "core") | append $core)) }}
  32. {{ else }}
  33. {{ $.Scratch.SetInMap $gpPath "core" (slice $core) }}
  34. {{ end }}
  35. {{ if isset ($.Scratch.Get $cpPath) "core" }}
  36. {{ $.Scratch.SetInMap $cpPath "core" (uniq ((index ($.Scratch.Get $cpPath) "core") | append $core)) }}
  37. {{ else }}
  38. {{ $.Scratch.SetInMap $cpPath "core" (slice $core) }}
  39. {{ end }}
  40. {{ end }}
  41. {{ with $cp.File }}
  42. {{ $mantle := substr .Dir 0 -1 }}
  43. {{ if isset ($.Scratch.Get $gpPath) "mantle" }}
  44. {{ $.Scratch.SetInMap $gpPath "mantle" (uniq ((index ($.Scratch.Get $gpPath) "mantle") | append $mantle)) }}
  45. {{ else }}
  46. {{ $.Scratch.SetInMap $gpPath "mantle" (slice $mantle) }}
  47. {{ end }}
  48. {{ if isset ($.Scratch.Get $cpPath) "mantle" }}
  49. {{ $.Scratch.SetInMap $cpPath "mantle" (uniq ((index ($.Scratch.Get $cpPath) "mantle") | append $mantle)) }}
  50. {{ else }}
  51. {{ $.Scratch.SetInMap $cpPath "mantle" (slice $mantle) }}
  52. {{ end }}
  53. {{ end }}
  54. {{ with $.Scratch.Get $gpPath }}
  55. {{ if .has_children }}
  56. {{ $hasChildren := index . "has_children" | append $cp }}
  57. {{ $.Scratch.SetInMap $gpPath "has_children" (uniq $hasChildren) }}
  58. {{ else }}
  59. {{ $.Scratch.SetInMap $gpPath "has_children" (slice $cp) }}
  60. {{ end }}
  61. {{ end }}
  62. {{ $.Scratch.SetInMap $cpPath "depth" "mantle" }}
  63. {{ $.Scratch.SetInMap $cpPath "child_depth" "crust" }}
  64. {{ $.Scratch.SetInMap $cpPath "plural" $plur }}
  65. {{ $.Scratch.SetInMap $cpPath "has" $scp }}
  66. {{ if isset $cp.Params $kcp }}
  67. {{ $.Scratch.SetInMap $cpPath "has_children" (slice) }}
  68. {{ if isset ($.Scratch.Get $cpPath) "is_in" }}
  69. {{ $isincore := index ($.Scratch.Get $cpPath) "is_in" | append $gp}}
  70. {{ $.Scratch.SetInMap $cpPath "is_in" (uniq $isincore) }}
  71. {{ else }}
  72. {{ $.Scratch.SetInMap $cpPath "is_in" (slice $gp) }}
  73. {{ end }}
  74. {{ end }}
  75. {{ range index $cp.Params $kcp }}
  76. {{ $gcp := $.GetPage (printf "/%s/%s" $sincp .) }}
  77. {{ $gcpPath := printf "/%s" $gcp.File }}
  78. {{ with $.Scratch.Get $cpPath }}
  79. {{ if .has_children }}
  80. {{ $hasGChildren := index . "has_children" | append $gcp }}
  81. {{ $.Scratch.SetInMap $cpPath "has_children" (uniq $hasGChildren) }}
  82. {{ else }}
  83. {{ $.Scratch.SetInMap $cpPath "has_children" (slice $gcp) }}
  84. {{ end }}
  85. {{ end }}
  86. {{ $.Scratch.SetInMap $gcpPath "depth" "crust" }}
  87. {{ $.Scratch.SetInMap $gcpPath "plural" $plurcp }}
  88. {{ $.Scratch.SetInMap $gcpPath "in" (slice $sin $plur) }}
  89. {{ with $gp.File }}
  90. {{ $core := substr .Dir 0 -1 }}
  91. {{ if isset ($.Scratch.Get $gcpPath) "core" }}
  92. {{ $.Scratch.SetInMap $gcpPath "core" (uniq ((index ($.Scratch.Get $gcpPath) "core") | append $core)) }}
  93. {{ else }}
  94. {{ $.Scratch.SetInMap $gcpPath "core" (slice $core) }}
  95. {{ end }}
  96. {{ end }}
  97. {{ with $cp.File }}
  98. {{ $mantle := substr .Dir 0 -1 }}
  99. {{ if isset ($.Scratch.Get $gcpPath) "mantle" }}
  100. {{ $.Scratch.SetInMap $gcpPath "mantle" (uniq ((index ($.Scratch.Get $gcpPath) "mantle") | append $mantle)) }}
  101. {{ else }}
  102. {{ $.Scratch.SetInMap $gcpPath "mantle" (slice $mantle) }}
  103. {{ end }}
  104. {{ end }}
  105. {{ with $gcp.File }}
  106. {{ $crust := substr .Dir 0 -1 }}
  107. {{ if isset ($.Scratch.Get $gpPath) "crust" }}
  108. {{ $.Scratch.SetInMap $gpPath "crust" (uniq ((index ($.Scratch.Get $gpPath) "crust") | append $crust)) }}
  109. {{ else }}
  110. {{ $.Scratch.SetInMap $gpPath "crust" (slice $crust) }}
  111. {{ end }}
  112. {{ if isset ($.Scratch.Get $cpPath) "crust" }}
  113. {{ $.Scratch.SetInMap $cpPath "crust" (uniq ((index ($.Scratch.Get $cpPath) "crust") | append $crust)) }}
  114. {{ else }}
  115. {{ $.Scratch.SetInMap $cpPath "crust" (slice $crust) }}
  116. {{ end }}
  117. {{ if isset ($.Scratch.Get $gcpPath) "crust" }}
  118. {{ $.Scratch.SetInMap $gcpPath "crust" (uniq ((index ($.Scratch.Get $gcpPath) "crust") | append $crust)) }}
  119. {{ else }}
  120. {{ $.Scratch.SetInMap $gcpPath "crust" (slice $crust) }}
  121. {{ end }}
  122. {{ end }}
  123. {{ with $.Scratch.Get $gcpPath }}
  124. {{ if .is_in }}
  125. {{ $isinmantle := index . "is_in" | append $cp}}
  126. {{ $.Scratch.SetInMap $gcpPath "is_in" (uniq $isinmantle) }}
  127. {{ else }}
  128. {{ $.Scratch.SetInMap $gcpPath "is_in" (slice $cp) }}
  129. {{ end }}
  130. {{ end }}
  131. {{ end }}
  132. {{ end }}
  133. {{ end }}
  134. {{ end }}
  135. {{ end }}
  136. {{ end }}
  137. {{ end }}
  138. {{ end }}
  139. {{ end }}
  140. {{ end }}
  141. {{ $.Scratch.SetInMap $pPath "debug" (printf "%#v" $debug) }}
  142. {{ end }}
  143. {{ return $.Scratch }}