2022-02-01 15:43:49 +08:00
|
|
|
{{- $from := .Get "from" -}}
|
2022-02-03 12:21:30 +08:00
|
|
|
{{- $to := .Get "to" | default "CNY" -}}
|
|
|
|
{{- $value := .Get "value" | float -}}
|
2022-02-03 09:52:17 +08:00
|
|
|
{{- $qs := querify "Amount" $value "From" $from "To" $to -}}
|
|
|
|
<a class="currency" href="https://www.xe.com/currencyconverter/convert/?{{ $qs | safeURL }}">
|
2022-02-03 12:21:30 +08:00
|
|
|
{{- $units := slice "" "k" "M" -}}
|
|
|
|
{{- $unit := div (math.Log $value) (math.Log 1000) | math.Floor | int -}}
|
|
|
|
{{- $base := math.Pow 1000 $unit -}}
|
|
|
|
{{- div $value $base }}{{ index $units $unit }} {{ $from -}}
|
2022-02-03 09:52:17 +08:00
|
|
|
</a>
|