aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/meta-word-count.html
blob: 8aaa30d5662d3d1d97ff8e7816c20eedf34f2197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{{- $author    := partial "function-authors-data.html" . -}}
{{- $limit     := $author.wordlimit -}}
{{- $wordLimit := gt  .WordCount $limit -}}
{{- $overLimit := sub .WordCount $limit -}}
{{- $bitCount  := lang.FormatNumberCustom 0 (len .Content) -}}

<micro-metadata-wordcount
title="
{{- if $wordLimit -}}
  {{ $overLimit }} words over the limit
 {{- else -}}
  {{ .WordCount }} words
{{- end }}
{{ $bitCount }} bits
{{- /* This comment removes trailing newlines and white spaces. */ -}}
">
{{- /* This comment removes trailing newlines and white spaces. */ -}}
  <word-limit>
    {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/file-text.svg")) -}}
    <word-count>
      {{- if $wordLimit -}}
        <em>{{ .WordCount }}</em>
      {{- else -}}
        {{ .WordCount }}
      {{- end -}}
      /{{ $limit }} words
{{- /* This comment removes trailing newlines and white spaces. */ -}}
    </word-count>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
  </word-limit>
{{- /* This comment removes trailing newlines and white spaces. */ -}}
</micro-metadata-wordcount>
{{- /* This comment removes trailing newlines and white spaces. */ -}}