9 lines
408 B
HTML
9 lines
408 B
HTML
{{- $from := .Get "from" -}}
|
||
{{- $to := default "CNY" (.Get "to") -}}
|
||
{{- $value := float (.Get "value") -}}
|
||
{{- with getJSON (printf "https://api.exchangerate-api.com/v4/latest/%s" $from) -}}
|
||
<abbr class="currency">
|
||
<span class="from">{{- lang.FormatCurrency 2 $from $value -}}</span>
|
||
<span class="to">( ≈ {{ lang.FormatCurrency 2 $to (mul $value (index .rates $to)) }})</span>
|
||
</abbr>
|
||
{{- end -}} |