github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/shortcodes/resources.html (about)

     1  {{- $page := .page }}
     2  {{- if and (not $page) .context }}
     3    {{- $page = .context }}
     4    {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'resources' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }}
     5  {{- end }}
     6  {{- $color := .color | default "" }}
     7  {{- $content := .content }}
     8  {{- $style := .style | default "default" }}
     9  {{- if and (not $color) (eq (len $color) 0) }}
    10    {{- $style = .style | default "transparent" }}
    11  {{- end }}
    12  {{- $title := .title }}
    13  {{- if not $title }}
    14    {{- if eq $style "info" }}{{ $title = $style | T }}{{ end }}
    15    {{- if eq $style "warning" }}{{ $title = $style | T }}{{ end }}
    16    {{- if eq $style "note" }}{{ $title = $style | T }}{{ end }}
    17    {{- if eq $style "tip" }}{{ $title = $style | T }}{{ end }}
    18  {{- end }}
    19  {{- $title = trim ($title | default ("Attachments-label" | T)) " " }}
    20  {{- $icon := .icon | default "" }}
    21  {{- if and (not $icon) (eq (len $icon) 0) }}
    22    {{- $icon = "paperclip" }}
    23    {{- if eq $style "info" }}{{ $icon = default "info-circle" }}{{ end }}
    24    {{- if eq $style "warning" }}{{ $icon = default "exclamation-triangle" }}{{ end }}
    25    {{- if eq $style "note" }}{{ $icon = default "exclamation-circle" }}{{ end }}
    26    {{- if eq $style "tip" }}{{ $icon = default "lightbulb" }}{{ end }}
    27  {{- end }}
    28  {{- $icon = trim $icon " " }}
    29  {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }}
    30    {{- $icon = printf "fa-fw fas fa-%s" $icon }}
    31  {{- end }}
    32  {{- $sort := .sort | default "asc" }}
    33  {{- $pattern := .pattern | default "" }}
    34  {{- with $page }}
    35  {{- if eq .BundleType "" }}
    36    {{- warnf "%q: UNSUPPORTED usage of 'resources' shortcode found, use a page bundle instead" $page.File.Filename }}
    37  {{- end }}
    38  <div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>
    39    <div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | .RenderString }}</div>
    40    <ul class="box-content attachments-files">
    41  {{- range sort .Resources "Name" $sort }}
    42    {{- if findRE $pattern .Name }}
    43      {{- $size := len .Content }}
    44      {{- $unit := "Byte-symbol" }}
    45      {{- if ge $size 1024 }}
    46        {{- $size = div $size 1024 }}
    47        {{- $unit = "Kilobyte-symbol" }}
    48      {{- end }}
    49      {{- if ge $size 1024 }}
    50        {{- $size = div $size 1024 }}
    51        {{- $unit = "Megabyte-symbol" }}
    52      {{- end }}
    53      {{- $unitsymbol := $unit | T }}
    54      <li><a href="{{ .RelPermalink }}">{{.Name}}</a> ({{$size}} {{$unitsymbol}})</li>
    55    {{- end }}
    56  {{- end }}
    57    </ul>
    58    {{- $content }}
    59  </div>
    60  {{- end }}