Files
FixIt/layouts/partials/function/format-number.html
T
2024-04-10 11:04:44 +08:00

13 lines
398 B
HTML

{{- /* How to use */ -}}
{{- /* partial "function/format-number" (dict "PRECISION" 2 "NUMBER" 5201314 */ -}}
{{- $number := .NUMBER -}}
{{- $precision := .PRECISION | default 1 -}}
{{- with $number -}}
{{- if ge . 1000 -}}
{{- $number = printf "%vk" (lang.FormatNumberCustom $precision (div . 1000.0) "- .") -}}
{{ printf "%v" $number }}
{{- end -}}
{{- end -}}
{{- return $number -}}