github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/shortcodes/expand.html (about) 1 {{- $page := .page }} 2 {{- if and (not $page) .context }} 3 {{- $page = .context }} 4 {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'expand' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} 5 {{- end }} 6 {{- $content := .content }} 7 {{- $title := .title | default (T "Expand-title") }} 8 {{- $title = trim $title " " }} 9 {{- $expanded := .open | default false }} 10 {{- if eq (printf "%T" $expanded) "string" }} 11 {{- $expanded = (eq $expanded "true") }} 12 {{- end }} 13 {{- $id := cond (or (eq .id nil) (eq .id "")) (partial "make-random-md5.hugo" $page) .id }} 14 {{- with $page }} 15 <div class="expand"> 16 <input type="checkbox" id="R-expand-{{ $id }}" aria-controls="R-expandcontent-{{ $id }}" {{ if $expanded }} checked{{ end }}> 17 <label class="expand-label" for="R-expand-{{ $id }}" > 18 <i class="fa-fw fas fa-chevron-down"></i> 19 <i class="fa-fw fas fa-chevron-right"></i> 20 {{ $title | .RenderString }} 21 </label> 22 <div id="R-expandcontent-{{ $id }}" class="expand-content"> 23 {{ if ne "<" (substr (strings.TrimLeft " \n\r\t" $content) 0 1) }}<p>{{ end }}<!-- we add a DOM element here if there is none to make collapsing marings work --> 24 {{ $content | safeHTML }}</div><!-- no line break allowed here because of awkward behavior of Hugo 110 or this theme when tag shortcode is called standalone outside of tags shortcode ? --> 25 </div> 26 {{- end }}