{{- $units := slice "" "k" "M" -}} {{- $from := .Get "from" -}} {{- $to := default "CNY" (.Get "to") -}} {{- $value := float (.Get "value") -}} {{- $unit := math.Floor (div (math.Log $value) (math.Log 1000)) | int -}} {{- $base := math.Pow 1000 $unit -}} {{- $formatted := printf "%g%s" (div $value $base) (index $units $unit) -}} {{- $qs := querify "Amount" $value "From" $from "To" $to -}} {{- $formatted }} {{ $from -}}